#include <ringbuffer.h>
Ring buffer array template. This class implements a ring buffer using your preferred ARRAY type.
ARRAYTYPE | Type of the array. |
RINGSIZE | Maximum number of elements in the ring buffer. |
Classes | |
class | IteratorTemplate |
Public Types | |
using | T = typename ARRAYTYPE::ValueType |
using | Iterator = IteratorTemplate< false > |
using | ConstIterator = IteratorTemplate< true > |
Public Member Functions | |
template<typename... ARGS> | |
MAXON_ATTRIBUTE_FORCE_INLINE ResultRef< T > | Append (ARGS &&... args) |
MAXON_ATTRIBUTE_FORCE_INLINE ResultPtr< T > | Append (const std::initializer_list< T > &values) |
MAXON_ATTRIBUTE_FORCE_INLINE const T & | operator[] (Int idx) const |
MAXON_ATTRIBUTE_FORCE_INLINE T & | operator[] (Int idx) |
MAXON_ATTRIBUTE_FORCE_INLINE const T * | GetFirst () const |
MAXON_ATTRIBUTE_FORCE_INLINE T * | GetFirst () |
MAXON_ATTRIBUTE_FORCE_INLINE const T * | GetLast () const |
MAXON_ATTRIBUTE_FORCE_INLINE T * | GetLast () |
void | Reset () |
void | Flush () |
ConstIterator | Begin () const |
Iterator | Begin () |
ConstIterator | End () const |
Iterator | End () |
Private Attributes | |
Int | _ringPos |
using T = typename ARRAYTYPE::ValueType |
using Iterator = IteratorTemplate<false> |
using ConstIterator = IteratorTemplate<true> |
MAXON_ATTRIBUTE_FORCE_INLINE ResultRef<T> Append | ( | ARGS &&... | args | ) |
Adds a new element at the end of the buffer and moves the content of x to it.
[in] | args | Values to be forwarded. |
MAXON_ATTRIBUTE_FORCE_INLINE ResultPtr<T> Append | ( | const std::initializer_list< T > & | values | ) |
Appends new elements at the end of the array.
[in] | values | Initializer list with values to be copied. |
MAXON_ATTRIBUTE_FORCE_INLINE const T& operator[] | ( | Int | idx | ) | const |
MAXON_ATTRIBUTE_FORCE_INLINE T& operator[] | ( | Int | idx | ) |
MAXON_ATTRIBUTE_FORCE_INLINE const T* GetFirst | ( | ) | const |
Returns a pointer to the first element in the ring buffer (which is different from the first element in the array).
MAXON_ATTRIBUTE_FORCE_INLINE T* GetFirst | ( | ) |
Returns a pointer to the first element in the ring buffer (which is different from the first element in the array).
MAXON_ATTRIBUTE_FORCE_INLINE const T* GetLast | ( | ) | const |
Returns a pointer to the last element in the ring buffer (which is different from the last element in the array).
MAXON_ATTRIBUTE_FORCE_INLINE T* GetLast | ( | ) |
Returns a pointer to the last element in the ring buffer (which is different from the last element in the array).
void Reset | ( | void | ) |
Deletes all elements (calls destructors and frees memory).
void Flush | ( | void | ) |
Deletes all elements, but doesn't free memory (calls destructors though).
ConstIterator Begin | ( | ) | const |
Iterator Begin | ( | ) |
ConstIterator End | ( | ) | const |
Iterator End | ( | ) |
|
private |