#include <CircularQueue.h>
Does not provide iteration. Only supports pushing at the end and pulling from the front. However, it does support a lock-free mechanism for queueing data between two threads, one pushing and the other popping. The circular queue is implemented as a fixed size array of pointers. First and last pointers keep the position in the queue, and elements can be added as long as the queue is not full.
Definition at line 59 of file CircularQueue.h.
Public Member Functions | |
virtual uint64_t | size () const |
Returns the number of elements in the queue. | |
virtual bool | isFull () const |
Returns whether the queue is full. | |
virtual bool | empty () const |
Returns whether the queue is empty. | |
virtual T & | front () const |
Returns a reference to the first item without removing it. | |
virtual void | pop () |
Removes the first item from the queue. | |
virtual void | push (const T &v) |
Places an item at the end of the queue. | |
virtual void | clear () |
Removes all elements from the queue. | |
Public Attributes | |
const size_t | MAX_SIZE |
the max size of the queue (and the number of slots reserved for the queue | |
Static Public Attributes | |
static const size_t | DEFAULT_MAX_SIZE = 4096 |
the default maximum size of the queue |