Skyward boardcore
|
#include <CircularBuffer.h>
Public Member Functions | |
CircularBuffer () | |
virtual | ~CircularBuffer () |
T & | put (const T &elem) |
Puts a copy of the element in the buffer. | |
T & | get (unsigned int i=0) |
Gets an element from the buffer, without removing it. | |
T & | last () |
Returns the last element added in the buffer. | |
const T & | pop () |
Pops the first element in the buffer. | |
size_t | count () const |
Counts the elements in the buffer. | |
bool | isEmpty () const |
bool | isFull () const |
size_t | getSize () const |
Returns the maximum number of elements that can be stored in the buffer. | |
Protected Attributes | |
T | buffer [Size] |
size_t | writePtr = 0 |
size_t | readPtr = 0 |
bool | empty = true |
Implementation of an non-synchronized circular buffer.
Definition at line 38 of file CircularBuffer.h.
|
inline |
Definition at line 43 of file CircularBuffer.h.
|
inlinevirtual |
Definition at line 45 of file CircularBuffer.h.
|
inline |
Counts the elements in the buffer.
Definition at line 138 of file CircularBuffer.h.
|
inline |
Gets an element from the buffer, without removing it.
Index starts from the oldest element in the buffer. get() returns the first element.
range_error | if index >= count(). |
i | Index of the element to get, starting from the oldest. |
Definition at line 81 of file CircularBuffer.h.
|
inline |
Returns the maximum number of elements that can be stored in the buffer.
Definition at line 162 of file CircularBuffer.h.
|
inline |
Definition at line 148 of file CircularBuffer.h.
|
inline |
Definition at line 150 of file CircularBuffer.h.
|
inline |
Returns the last element added in the buffer.
range_error | if buffer is empty. |
Definition at line 107 of file CircularBuffer.h.
|
inline |
Pops the first element in the buffer.
range_error | if buffer is empty. |
Definition at line 116 of file CircularBuffer.h.
|
inline |
Puts a copy of the element in the buffer.
elem | Element to be added to the queue. |
Definition at line 53 of file CircularBuffer.h.
|
protected |
Definition at line 165 of file CircularBuffer.h.
|
protected |
Definition at line 169 of file CircularBuffer.h.
|
protected |
Definition at line 168 of file CircularBuffer.h.
|
protected |
Definition at line 167 of file CircularBuffer.h.