Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ixion::ring_queue Class Template Reference

#include <ixlib_ring_queue.hh>

List of all members.

Public Methods

 ring_queue (TIndex capacity=0)
TSize capacity () const
 Query the maximal capacity of the ring queue. More...

TSize size () const
 Query the number of entries in the ring_queue. More...

TSize pop (T *data, TSize maxcount=1)
 Retrieve maximally maxcount entries from the ring queue. More...

void push (T *data, TSize count=1)
 Place count entries starting at data in the ring queue. More...

T * popPointer (TSize &maxcount)
 Get a pointer where data may be read directly out of the ring_queue buffer. More...

void popPointerCommit (TSize count)
 Inform the ring_queue that count entries have actually been read. More...

T * pushPointer (TSize &maxcount)
 Get a pointer where data may be written directly into the ring_queue buffer. More...

void pushPointerCommit (TSize count)
 Inform the ring_queue that count entries have actually been written. More...

void allocate (TSize capacity)
 Reallocate the buffer, invalidate all current contents. More...


Detailed Description

template<class T, class Allocator = std::allocator<T>>
class ixion::ring_queue< T, Allocator >

A class implementing a ring queue, often also known as a ring buffer or in-place FIFO. This data structure does not do any reallocation once it is created.

The "Pointer" variants of the push and pop operations are guaranteed not to throw exceptions, making them the perfect choice for operations in other threads and other critical environments where standard library functionality is only available in a restricted way.

Definition at line 33 of file ixlib_ring_queue.hh.


Constructor & Destructor Documentation

template<class T, class Allocator = std::allocator<T>>
ixion::ring_queue< T, Allocator >::ring_queue TIndex    capacity = 0 [inline]
 

Definition at line 40 of file ixlib_ring_queue.hh.


Member Function Documentation

template<class T, class Allocator = std::allocator<T>>
void ixion::ring_queue< T, Allocator >::allocate TSize    capacity [inline]
 

Reallocate the buffer, invalidate all current contents.

Definition at line 84 of file ixlib_ring_queue.hh.

template<class T, class Allocator = std::allocator<T>>
TSize ixion::ring_queue< T, Allocator >::capacity   const [inline]
 

Query the maximal capacity of the ring queue.

Definition at line 45 of file ixlib_ring_queue.hh.

template<class T, class Allocator>
ixion::TSize ixion::ring_queue< T, Allocator >::pop T *    data,
TSize    maxcount = 1
[inline]
 

Retrieve maximally maxcount entries from the ring queue.

Parameters:
data  The retrieved entries are copied to the area starting at data.
Returns:
how many entries actually have been retrieved.

Definition at line 96 of file ixlib_ring_queue.hh.

template<class T, class Allocator>
T * ixion::ring_queue< T, Allocator >::popPointer TSize   maxcount [inline]
 

Get a pointer where data may be read directly out of the ring_queue buffer.

Parameters:
maxcount  is set to the number of T's that may maximally be read.

Definition at line 138 of file ixlib_ring_queue.hh.

Referenced by pop().

template<class T, class Allocator>
void ixion::ring_queue< T, Allocator >::popPointerCommit TSize    count [inline]
 

Inform the ring_queue that count entries have actually been read.

Definition at line 150 of file ixlib_ring_queue.hh.

Referenced by pop().

template<class T, class Allocator>
void ixion::ring_queue< T, Allocator >::push T *    data,
TSize    count = 1
[inline]
 

Place count entries starting at data in the ring queue.

Definition at line 116 of file ixlib_ring_queue.hh.

template<class T, class Allocator>
T * ixion::ring_queue< T, Allocator >::pushPointer TSize   maxcount [inline]
 

Get a pointer where data may be written directly into the ring_queue buffer.

Parameters:
maxcount  is set to the number of T's that may maximally be written.
Returns:
the pointer.

Definition at line 158 of file ixlib_ring_queue.hh.

Referenced by push().

template<class T, class Allocator>
void ixion::ring_queue< T, Allocator >::pushPointerCommit TSize    count [inline]
 

Inform the ring_queue that count entries have actually been written.

Definition at line 173 of file ixlib_ring_queue.hh.

Referenced by push().

template<class T, class Allocator = std::allocator<T>>
TSize ixion::ring_queue< T, Allocator >::size   const [inline]
 

Query the number of entries in the ring_queue.

Definition at line 50 of file ixlib_ring_queue.hh.


The documentation for this class was generated from the following file:
Generated on Wed Oct 31 17:12:26 2001 for ixlib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001