A data structure that allows appending at the back and invalidating from the front. More...
#include <Queue.hpp>
Classes | |
class | QueueIterator |
Class that alows queue elements to be accessed like a normal stl iterator. Queue iterator is a bidirectional sequential iterator isValid() method checks the validity of the iterator. This method can be used to check if the data in Queue has not yet been popped out Increment, decrement , dereferencing,less than and greater than operations are provided. More... | |
Public Types | |
using | value_type = DataT |
Typedef for the DataT. | |
using | QueueType = Queue<value_type> |
Typedef for the QueueType. | |
using | size_type = uint32_t |
using | iterator = QueueIterator<false> |
Typedef for regular iterator. | |
using | const_iterator = QueueIterator<true> |
Typedef for constant iterator. | |
Public Member Functions | |
Queue (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 queue. | |
~Queue () | |
Destroy the Queue, clearing everything out. | |
Queue (const Queue< value_type > &)=delete | |
No copies, no moves. | |
Queue & | operator= (const Queue< value_type > &)=delete |
Deleting default assignment operator to prevent copies. | |
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. | |
value_type & | access (uint32_t idx) |
Read and return the data at the given index, reference, non-const method. | |
value_type & | front () const |
Read and return the data at the front(oldest element), reference. | |
value_type & | back () const |
Read and return the last pushed in element(newest element), reference. | |
uint32_t | capacity () const |
Return the fixed size of this queue. | |
size_type | size () const |
Return the number of valid entries. | |
size_type | numFree () const |
Return the number of free entries. | |
bool | empty () const |
Return if the queue is empty or not. | |
void | clear () |
Empty the queue. | |
void | enableCollection (TreeNode *parent) |
Request that this queue begin collecting its contents for pipeline collection. | |
iterator | push (const value_type &dat) |
push data to the Queue. | |
iterator | push (value_type &&dat) |
push data to the Queue. | |
void | pop () |
Pops the data at the front of the structure (oldest element) After pop iterator always points to the last element. | |
void | pop_back () |
Pops the data at the back of the structure (newest element) After pop iterator always points to the last element. | |
iterator | begin () |
STL-like begin operation, starts at front (oldest element) | |
iterator | end () |
STL - like end operation, starts at element one past head. | |
const_iterator | begin () const |
STL-like begin operation, starts at front (oldest element) | |
const_iterator | end () const |
STL - like end operation, starts at element one past head. | |
A data structure that allows appending at the back and invalidating from the front.
The Queue allows user to push data to the back of the queue and pop it from the front.
The queue does not manage any type of state delaying. In order to use the queue as a present state/next state queue, the user should use delays when writing to the queue's ports or listening to the queue's ports.
The only precedence that the Queue follows is that invalidations precede writes.
The queue can also be used without the port mechanism via public methods push and pop. The pop method is special in that it will return an iterator which points to that entry in Queue. At any time the queue entry can be queried for that data's location in the queue via its public getIndex() method.
Example usage
using sparta::Queue< DataT >::const_iterator = QueueIterator<true> |
using sparta::Queue< DataT >::iterator = QueueIterator<false> |
using sparta::Queue< DataT >::QueueType = Queue<value_type> |
using sparta::Queue< DataT >::size_type = uint32_t |
using sparta::Queue< DataT >::value_type = DataT |
|
inline |
Construct a queue.
name | The name of the queue |
num_entries | The number of entries this queue can hold |
clk | The clock this queue belongs to |
statset | The Counter set to register read-only counters; default nullptr |
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. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
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 603 of file Queue.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
push data to the Queue.
dat | Data to be copied in |
|
inline |
push data to the Queue.
dat | Data to be moved in |
|
inline |
|
inline |