turbo::RotativeBuffer< T > Class Template Reference

Simple cirular buffer implementation. More...

#include <RotativeBuffer.hpp>

Public Member Functions

 RotativeBuffer (T initial_value, unsigned short size)
 Initialize the cirular buffer. More...
 
 RotativeBuffer ()
 Initialize a cirular buffer of size 10 and the default value of the type as memset.
 
T & get_data (unsigned short position) const
 get an item of the circular buffer More...
 
T * get_array () const
 get the buffer rotated by the buffer position
 
void turn ()
 
void set_first (const T &val)
 
void set_last (const T &val)
 
unsigned short get_size () const
 
const T & operator[] (unsigned short pos)
 
 operator const char * ()
 

Protected Attributes

T * buffer = nullptr
 
unsigned short size
 
unsigned short position = 0
 

Detailed Description

template<typename T = unsigned char>
class turbo::RotativeBuffer< T >

Simple cirular buffer implementation.

Template Parameters
Tcontent type

Constructor & Destructor Documentation

◆ RotativeBuffer()

template<typename T = unsigned char>
turbo::RotativeBuffer< T >::RotativeBuffer ( initial_value,
unsigned short  size 
)
inline

Initialize the cirular buffer.

Parameters
initial_valuevalue to memset
sizesize of the circular buffer

Member Function Documentation

◆ get_data()

template<typename T = unsigned char>
T& turbo::RotativeBuffer< T >::get_data ( unsigned short  position) const
inline

get an item of the circular buffer

Parameters
positionposition in the buffer

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