The Sparta Modeling Framework
|
A data structure allowing appending at the end, beginning, or middle, but erase anywhere with collapse. More...
#include <Buffer.hpp>
Public Types | |
typedef Buffer< DataT > | BufferType |
typedef DataT | value_type |
typedef uint32_t | size_type |
typedef BufferIterator< false > | iterator |
Typedef for regular iterator. | |
typedef BufferIterator< true > | const_iterator |
Typedef for constant iterator. | |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
Typedef for regular reverse iterator. | |
typedef std::reverse_iterator< iterator > | reverse_iterator |
Typedef for constant reverse iterator. | |
Public Member Functions | |
Buffer (const std::string &name, const uint32_t num_entries, const Clock *clk, StatisticSet *statset=nullptr, InstrumentationNode::visibility_t stat_vis_general=InstrumentationNode::AUTO_VISIBILITY, InstrumentationNode::visibility_t stat_vis_detailed=InstrumentationNode::VIS_HIDDEN, InstrumentationNode::visibility_t stat_vis_max=InstrumentationNode::AUTO_VISIBILITY, InstrumentationNode::visibility_t stat_vis_avg=InstrumentationNode::AUTO_VISIBILITY) | |
Construct a buffer. | |
Buffer (const Buffer< value_type > &)=delete | |
No copies allowed for Buffer. | |
Buffer & | operator= (const Buffer< value_type > &)=delete |
No copies allowed for Buffer. | |
Buffer (Buffer< value_type > &&) | |
Move Constructor to allow moves. | |
~Buffer () | |
Clear (and destruct the Buffer's contents) | |
const std::string & | getName () const |
Name of this resource. | |
bool | isValid (uint32_t idx) const |
Determine if data at the index is valid. | |
const value_type & | read (uint32_t idx) const |
Read and return the data at the given index, const reference. | |
const value_type & | read (const const_iterator &entry) const |
read the entry at the BufferIterator's location | |
const value_type & | read (const const_reverse_iterator &entry) const |
read the entry at the BufferIterator's location | |
value_type & | access (uint32_t idx) |
Read and return the data at the given index, reference. | |
value_type & | access (const const_iterator &entry) |
Read and return the data at the given BufferIterator's location, reference. | |
value_type & | access (const const_reverse_iterator &entry) |
Read and return the data at the given BufferIterator's location, reference. | |
value_type & | accessBack () |
Read and return the data at the bottom of the Buffer. | |
size_type | capacity () const |
Return the fixed size of this buffer. | |
size_type | size () const |
Return the number of valid entries. | |
size_type | numFree () const |
Return the number of free entries. | |
iterator | push_back (const value_type &dat) |
Append data to the end of Buffer, and return a BufferIterator. | |
iterator | push_back (value_type &&dat) |
Append data to the end of Buffer, and return a BufferIterator. | |
iterator | insert (uint32_t idx, const value_type &dat) |
Insert the item BEFORE the given index. | |
iterator | insert (uint32_t idx, value_type &&dat) |
Insert the item BEFORE the given index. | |
iterator | insert (const const_iterator &entry, const value_type &dat) |
Do an insert before a BufferIterator see insert method above. | |
iterator | insert (const const_iterator &entry, value_type &&dat) |
Do an insert before a BufferIterator see insert method above. | |
iterator | insert (const const_reverse_iterator &entry, const value_type &dat) |
Do an insert before a BufferIterator see insert method above. | |
iterator | insert (const const_reverse_iterator &entry, value_type &&dat) |
Do an insert before a BufferIterator see insert method above. | |
void | erase (uint32_t idx) |
erase a position in the Buffer immediately. | |
iterator | erase (const const_iterator &entry) |
erase the index at which the entry exists in the Buffer. | |
reverse_iterator | erase (const const_reverse_iterator &entry) |
erase the index at which the entry exists in the Buffer. | |
void | clear () |
Empty the contents of the Buffer. | |
bool | empty () const |
Query if the buffer is empty. | |
void | enableCollection (TreeNode *parent) |
Request that this queue begin collecting its contents for pipeline collection. | |
iterator | begin () |
Get the iterator pointing to the beginning of Buffer. | |
iterator | end () |
Returns an iterator referring to past-the-end element in the Buffer container. | |
const_iterator | begin () const |
Get the const_iterator pointing to the begin of Buffer. | |
const_iterator | end () const |
Returns a const_iterator referring to past-the-end element in the Buffer container. | |
reverse_iterator | rbegin () |
Get the iterator pointing to the pass-the-end element of Buffer. | |
reverse_iterator | rend () |
Returns an reverse iterator referring to starting element in the Buffer container. | |
const_reverse_iterator | rbegin () const |
Get the const_reverse_iterator pointing to the pass-the-end of Buffer. | |
const_reverse_iterator | rend () const |
Returns a const_reverse_iterator referring to start element in the Buffer container. | |
void | makeInfinite (const uint32_t resize_delta=1) |
Makes the Buffer grow beyond its capacity. The buffer grows by adding new entries in its internal vectors. The number of new entries it adds defaults to the value 1, each time it resizes itself. | |
A data structure allowing appending at the end, beginning, or middle, but erase anywhere with collapse.
The Buffer allows a user to append data to the end, beginning, or middle of the buffer, and erase anywhere. The Buffer will collapse on empty entries unlike the sparta::Array.
The Buffer acks like a standard container via public push_back, insert, and erase methods. The BufferIterator can be used as an index into the Buffer, and maintains knowledge internally of its location in the Buffer, as well whether or not it still represents a valid entry.
Example:
DataT | The data type contained in the Buffer |
Definition at line 73 of file Buffer.hpp.
typedef Buffer<DataT> sparta::Buffer< DataT >::BufferType |
Definition at line 79 of file Buffer.hpp.
typedef BufferIterator<true> sparta::Buffer< DataT >::const_iterator |
Typedef for constant iterator.
Definition at line 337 of file Buffer.hpp.
typedef std::reverse_iterator<const_iterator> sparta::Buffer< DataT >::const_reverse_iterator |
Typedef for regular reverse iterator.
Definition at line 340 of file Buffer.hpp.
typedef BufferIterator<false> sparta::Buffer< DataT >::iterator |
Typedef for regular iterator.
Definition at line 334 of file Buffer.hpp.
typedef std::reverse_iterator<iterator> sparta::Buffer< DataT >::reverse_iterator |
Typedef for constant reverse iterator.
Definition at line 343 of file Buffer.hpp.
typedef uint32_t sparta::Buffer< DataT >::size_type |
Definition at line 85 of file Buffer.hpp.
typedef DataT sparta::Buffer< DataT >::value_type |
Definition at line 82 of file Buffer.hpp.
sparta::Buffer< DataT >::Buffer | ( | const std::string & | name, |
const uint32_t | num_entries, | ||
const Clock * | clk, | ||
StatisticSet * | statset = nullptr , |
||
InstrumentationNode::visibility_t | stat_vis_general = InstrumentationNode::AUTO_VISIBILITY , |
||
InstrumentationNode::visibility_t | stat_vis_detailed = InstrumentationNode::VIS_HIDDEN , |
||
InstrumentationNode::visibility_t | stat_vis_max = InstrumentationNode::AUTO_VISIBILITY , |
||
InstrumentationNode::visibility_t | stat_vis_avg = InstrumentationNode::AUTO_VISIBILITY |
||
) |
Construct a buffer.
name | The name of the buffer |
num_entries | The number of entries this buffer can hold |
clk | The clock this Buffer is associated; used for internal counters |
statset | Pointer to the counter set to register utilization counts; default nullptr. This works for timed and untimed. |
stat_vis_general | Sets the visibility of the stat counters for the 0th and last index of the utilization counts, so the empty and full counts. |
stat_vis_detailed | Sets the visibility of the stat counts between 0 and the last index. i.e. more detailed than the general stats, default VIS_HIDDEN |
stat_vis_max | Sets the visibility for a stat that contains the maximum utilization for this buffer. The default is AUTO_VISIBILITY. |
stat_vis_avg | Sets the visibility for a stat that contains the weighted utilization average for this buffer. The default is AUTO_VISIBILITY. |
Definition at line 1040 of file Buffer.hpp.
sparta::Buffer< DataT >::Buffer | ( | Buffer< value_type > && | rval | ) |
Move Constructor to allow moves.
Definition at line 1075 of file Buffer.hpp.
|
inline |
Clear (and destruct the Buffer's contents)
Definition at line 401 of file Buffer.hpp.
|
inline |
Read and return the data at the given BufferIterator's location, reference.
entry | the BufferIterator to read from. |
Definition at line 463 of file Buffer.hpp.
|
inline |
Read and return the data at the given BufferIterator's location, reference.
entry | the BufferIterator to read from. |
Definition at line 471 of file Buffer.hpp.
|
inline |
Read and return the data at the given index, reference.
idx | The index to read |
Definition at line 454 of file Buffer.hpp.
|
inline |
Read and return the data at the bottom of the Buffer.
Definition at line 480 of file Buffer.hpp.
|
inline |
Get the iterator pointing to the beginning of Buffer.
Definition at line 743 of file Buffer.hpp.
|
inline |
Get the const_iterator pointing to the begin of Buffer.
Definition at line 761 of file Buffer.hpp.
|
inline |
Return the fixed size of this buffer.
Definition at line 489 of file Buffer.hpp.
|
inline |
Empty the contents of the Buffer.
Definition at line 693 of file Buffer.hpp.
|
inline |
Query if the buffer is empty.
Definition at line 719 of file Buffer.hpp.
|
inline |
Request that this queue begin collecting its contents for pipeline collection.
parent | A pointer to the parent treenode for which to add Collectable objects under. |
Definition at line 733 of file Buffer.hpp.
|
inline |
Returns an iterator referring to past-the-end element in the Buffer container.
Definition at line 755 of file Buffer.hpp.
|
inline |
Returns a const_iterator referring to past-the-end element in the Buffer container.
Definition at line 772 of file Buffer.hpp.
|
inline |
erase the index at which the entry exists in the Buffer.
entry | a reference to the entry to be erased. |
Definition at line 671 of file Buffer.hpp.
|
inline |
erase the index at which the entry exists in the Buffer.
entry | a reference to the entry to be erased. |
Definition at line 684 of file Buffer.hpp.
|
inline |
erase a position in the Buffer immediately.
idx | the index to be erased. |
In a un-TimedBuffer, invalidations immediately changes the indexes in the buffer using this function. Therefore, it's recommended that erases are performed using a BufferIterator.
Definition at line 623 of file Buffer.hpp.
|
inline |
Name of this resource.
Definition at line 406 of file Buffer.hpp.
|
inline |
Do an insert before a BufferIterator see insert method above.
Definition at line 586 of file Buffer.hpp.
|
inline |
Do an insert before a BufferIterator see insert method above.
Definition at line 592 of file Buffer.hpp.
|
inline |
Do an insert before a BufferIterator see insert method above.
Definition at line 598 of file Buffer.hpp.
|
inline |
Do an insert before a BufferIterator see insert method above.
Definition at line 604 of file Buffer.hpp.
|
inline |
Insert the item BEFORE the given index.
idx | The index to insert the new item before |
dat | The data to insert |
As an example, if the buffer contains:
an insert(1, w) becomes
Definition at line 557 of file Buffer.hpp.
|
inline |
Insert the item BEFORE the given index.
idx | The index to insert the new item before |
dat | The data to insert |
As an example, if the buffer contains:
an insert(1, w) becomes
Definition at line 580 of file Buffer.hpp.
|
inline |
Determine if data at the index is valid.
idx | The index to determine validity |
Definition at line 416 of file Buffer.hpp.
|
inline |
Makes the Buffer grow beyond its capacity. The buffer grows by adding new entries in its internal vectors. The number of new entries it adds defaults to the value 1, each time it resizes itself.
Definition at line 808 of file Buffer.hpp.
|
inline |
Return the number of free entries.
Does not take into account the number of erased entries this cycle
Definition at line 507 of file Buffer.hpp.
|
inline |
Append data to the end of Buffer, and return a BufferIterator.
dat | Data to be pushed back into the buffer |
Append data to the end of Buffer, and return a BufferIterator for the location appeneded. Untimed Buffers will have the data become valid immediately.
Definition at line 520 of file Buffer.hpp.
|
inline |
Append data to the end of Buffer, and return a BufferIterator.
dat | Data to be pushed back into the buffer |
Append data to the end of Buffer, and return a BufferIterator for the location appeneded. Untimed Buffers will have the data become valid immediately.
Definition at line 534 of file Buffer.hpp.
|
inline |
Get the iterator pointing to the pass-the-end element of Buffer.
Definition at line 778 of file Buffer.hpp.
|
inline |
Get the const_reverse_iterator pointing to the pass-the-end of Buffer.
Definition at line 792 of file Buffer.hpp.
|
inline |
read the entry at the BufferIterator's location
entry | the BufferIterator to read from. |
Definition at line 434 of file Buffer.hpp.
|
inline |
read the entry at the BufferIterator's location
entry | the BufferIterator to read from. |
Definition at line 443 of file Buffer.hpp.
|
inline |
Read and return the data at the given index, const reference.
idx | The index to read |
Definition at line 425 of file Buffer.hpp.
|
inline |
Returns an reverse iterator referring to starting element in the Buffer container.
Definition at line 786 of file Buffer.hpp.
|
inline |
Returns a const_reverse_iterator referring to start element in the Buffer container.
Definition at line 800 of file Buffer.hpp.
|
inline |
Return the number of valid entries.
Definition at line 497 of file Buffer.hpp.