CircularQueue< T > Class Template Reference
[Collections]

#include <CircularQueue.h>

Inheritance diagram for CircularQueue< T >:

Inheritance graph
[legend]

List of all members.


Detailed Description

template<class T>
class CircularQueue< T >

an implementation of a circuluar queue

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.

Todo:
move to mace:: namespace

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

The documentation for this class was generated from the following file:

Generated on Sat Oct 4 21:30:26 2008 for Mace Library by  doxygen 1.5.5