RingBuffer (circular buffer) template class A small circular queue to hold a fixed number of elements. More...
#include <Queue.hpp>
Public Member Functions | |
| constexpr | RingBuffer () |
| void | push (T val) |
| Pushes a new value into the ring buffer. This will overwrite the oldest value if the buffer is full. | |
| void | getLinearBuffer (T *out) |
| Returns the elements in the buffer in linear order. | |
Public Attributes | |
| T | buffer [size] |
| uint8_t | head |
| uint8_t | count |
RingBuffer (circular buffer) template class A small circular queue to hold a fixed number of elements.
| T | Type of elements stored in the buffer |
| size | Capacity of the buffer |
|
inlineconstexpr |
|
inline |
Returns the elements in the buffer in linear order.
| out | Pointer to an array where the linear buffer will be stored. This array shall be created by the caller and must have at least 'size' elements. |
Definition at line 51 of file Queue.hpp.
References RingBuffer< T, size >::buffer, RingBuffer< T, size >::count, and RingBuffer< T, size >::head.
|
inline |
Pushes a new value into the ring buffer. This will overwrite the oldest value if the buffer is full.
| val | The value to be added to the buffer. |
Definition at line 37 of file Queue.hpp.
References RingBuffer< T, size >::buffer, RingBuffer< T, size >::count, and RingBuffer< T, size >::head.
| T RingBuffer< T, size >::buffer[size] |
Definition at line 62 of file Queue.hpp.
Referenced by RingBuffer< T, size >::getLinearBuffer(), and RingBuffer< T, size >::push().
| uint8_t RingBuffer< T, size >::count |
Definition at line 64 of file Queue.hpp.
Referenced by RingBuffer< T, size >::getLinearBuffer(), and RingBuffer< T, size >::push().
| uint8_t RingBuffer< T, size >::head |
Definition at line 63 of file Queue.hpp.
Referenced by RingBuffer< T, size >::getLinearBuffer(), and RingBuffer< T, size >::push().