XII Release 0.1.0
Loading...
Searching...
No Matches
xiiStaticRingBuffer< T, Capacity > Class Template Reference

A ring-buffer container that will use a static array of a given capacity to cycle through elements. More...

#include <StaticRingBuffer.h>

Public Member Functions

 xiiStaticRingBuffer ()
 Constructs an empty ring-buffer.
 
 xiiStaticRingBuffer (const xiiStaticRingBuffer< T, Capacity > &rhs)
 Copies the content from rhs into this ring-buffer.
 
 ~xiiStaticRingBuffer ()
 Destructs all remaining elements.
 
void operator= (const xiiStaticRingBuffer< T, Capacity > &rhs)
 Copies the content from rhs into this ring-buffer.
 
bool operator== (const xiiStaticRingBuffer< T, Capacity > &rhs) const
 Compares two ring-buffers for equality.
 
void PushBack (const T &element)
 Appends an element at the end of the ring-buffer. Asserts that CanAppend() is true.
 
void PushBack (T &&element)
 Appends an element at the end of the ring-buffer. Asserts that CanAppend() is true.
 
T & PeekBack ()
 Accesses the latest element in the ring-buffer.
 
const T & PeekBack () const
 Accesses the latest element in the ring-buffer.
 
void PopFront (xiiUInt32 uiElements=1)
 Removes the oldest element from the ring-buffer.
 
const T & PeekFront () const
 Accesses the oldest element in the ring-buffer.
 
T & PeekFront ()
 Accesses the oldest element in the ring-buffer.
 
const T & operator[] (xiiUInt32 uiIndex) const
 Accesses the n-th element in the ring-buffer.
 
T & operator[] (xiiUInt32 uiIndex)
 Accesses the n-th element in the ring-buffer.
 
xiiUInt32 GetCount () const
 Returns the number of elements that are currently in the ring-buffer.
 
bool IsEmpty () const
 Returns true if the ring-buffer currently contains no elements.
 
bool CanAppend (xiiUInt32 uiElements=1)
 Returns true, if the ring-buffer can store at least uiElements additional elements.
 
void Clear ()
 Destructs all elements in the ring-buffer.
 

Detailed Description

template<typename T, xiiUInt32 Capacity>
class xiiStaticRingBuffer< T, Capacity >

A ring-buffer container that will use a static array of a given capacity to cycle through elements.

If you need a dynamic ring-buffer, use a xiiDeque.


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