Allolib  1.0
C++ Components For Interactive Multimedia
al::ShiftBuffer< N, T > Class Template Reference

Constant size shift buffer. More...

#include <C:/Users/Andres/source/repos/casm_viewer/external/tinc/external/allolib/include/al/types/al_Buffer.hpp>

Public Member Functions

 ShiftBuffer (const T &v=T())
 
const T * elems () const
 Get pointer to elements (read-only)
 
T * elems ()
 Get pointer to elements.
 
T & operator[] (int i)
 Get reference to element at index.
 
const T & operator[] (int i) const
 Get reference to element at index (read-only)
 
void operator() (const T &v)
 Push new element onto buffer. Newest element is at index 0.
 
void assign (const T &v)
 Set all elements to argument.
 
void zero ()
 Zero bytes of all elements.
 

Static Public Member Functions

static int size ()
 Get number of elements.
 

Protected Attributes

mElems [N]
 

Detailed Description

template<int N, class T>
class al::ShiftBuffer< N, T >

Constant size shift buffer.

This is a first-in, first-out buffer with a constant number of elements. Adding new elements to the buffer physically moves existing elements. The advantage of moving memory like this is that elements stay logically ordered making access faster and operating on the history easier.

Definition at line 298 of file al_Buffer.hpp.

Constructor & Destructor Documentation

◆ ShiftBuffer()

template<int N, class T >
al::ShiftBuffer< N, T >::ShiftBuffer ( const T &  v = T())
inline
Parameters
[in]vValue to initialize all elements to

Definition at line 301 of file al_Buffer.hpp.


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