Skyward boardcore
|
#include <SyncCircularBuffer.h>
Public Member Functions | |
void | put (const T &elem) |
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. | |
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 |
void | waitUntilNotEmpty () |
Waits until the buffer contains at least one element. | |
size_t | getSize () const |
Returns the maximum number of elements that can be stored in the buffer. | |
Implementation of a synchronized circular buffer
Definition at line 42 of file SyncCircularBuffer.h.
|
inline |
Counts the elements in the buffer.
Definition at line 104 of file SyncCircularBuffer.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 67 of file SyncCircularBuffer.h.
|
inline |
Returns the maximum number of elements that can be stored in the buffer.
Definition at line 138 of file SyncCircularBuffer.h.
|
inline |
Definition at line 110 of file SyncCircularBuffer.h.
|
inline |
Definition at line 116 of file SyncCircularBuffer.h.
|
inline |
Returns the last element added in the buffer.
range_error | if buffer is empty. |
Definition at line 80 of file SyncCircularBuffer.h.
|
inline |
Pops the first element in the buffer.
range_error | if buffer is empty. |
Definition at line 93 of file SyncCircularBuffer.h.
|
inline |
Puts a copy of the element in the buffer
elem | element |
Definition at line 49 of file SyncCircularBuffer.h.
|
inline |
Waits until the buffer contains at least one element.
Definition at line 125 of file SyncCircularBuffer.h.