DUNE: Uniform Navigational Environment
2016.05.0
|
Circular buffer with a maximum fixed-size capacity.
Additions beyond the buffer capacity will result in eviction of the oldest datum.
Classes | |
class | Error |
Public Member Functions | |
CircularBuffer (uint32_t capacity=1) | |
CircularBuffer (const CircularBuffer< T > &other) | |
~CircularBuffer (void) | |
void | clear (void) |
void | setCapacity (uint32_t n) |
void | add (const T &data) |
T & | operator() (uint32_t index) |
const T & | operator() (uint32_t index) const |
uint32_t | getCapacity (void) const |
uint32_t | getSize (void) const |
|
inline |
Constructor.
capacity | maximum capacity |
|
inline |
other | instance of CircularBuffer<T> to copy. |
|
inline |
Destructor.
|
inline |
Add data to the buffer.
If the buffer is using all its capacity, the oldest data will be overwritten.
data | data to add. |
|
inline |
Clear the buffer.
|
inline |
Get buffer capacity.
|
inline |
Get size of the buffer in use.
|
inline |
Access buffer position.
index | position. |
|
inline |
Access buffer position.
index | position. |
|
inline |
Reset the buffer capacity.
Previous contents are saved in FIFO order up to the new capacity.
n | new capacity |