template<class T>
class CircularBuffer< T >
The circular buffer class. Pass the datatype to be stored in the buffer as template parameter.
Definition at line 34 of file CircularBuffer.h.
#include <CircularBuffer.h>
|
T * | get (const uint8_t idx) const |
|
uint8_t | back (void) const |
|
|
const uint8_t | m_size |
| Total number of records that can be stored in the buffer.
|
|
T *const | m_buff |
| Ptr to buffer holding all records.
|
|
volatile uint8_t | m_front |
| Index of front element (not pushed yet).
|
|
volatile uint8_t | m_fill |
| Amount of records currently pushed.
|
|
◆ CircularBuffer()
Constructor
- Parameters
-
buffer | Preallocated buffer of at least size records. |
size | Number of records available in the buffer. |
Definition at line 42 of file CircularBuffer.h.
◆ available()
Return the number of records stored in the buffer.
- Returns
- number of records.
Definition at line 89 of file CircularBuffer.h.
◆ back()
Internal getter for index of last used record in buffer.
- Returns
- Index of last record.
Definition at line 186 of file CircularBuffer.h.
◆ clear()
◆ empty()
Test if the circular buffer is empty.
- Returns
- True, when empty.
Definition at line 63 of file CircularBuffer.h.
◆ full()
Test if the circular buffer is full.
- Returns
- True, when full.
Definition at line 76 of file CircularBuffer.h.
◆ get()
Internal getter for records.
- Parameters
-
idx | Record index in buffer. |
- Returns
- Ptr to record.
Definition at line 177 of file CircularBuffer.h.
◆ getBack()
Aquire record on back of the buffer, for reading. After reading the record, it has to be pop'ed to actually remove it from the buffer.
- Returns
- Pointer to record, or NULL when buffer is empty.
Definition at line 144 of file CircularBuffer.h.
◆ getFront()
Aquire unused record on front of the buffer, for writing. After filling the record, it has to be pushed to actually add it to the buffer.
- Returns
- Pointer to record, or NULL when buffer is full.
Definition at line 104 of file CircularBuffer.h.
◆ popBack()
Remove record from back of the buffer.
- Returns
- True, when record was pop'ed successfully.
Definition at line 159 of file CircularBuffer.h.
◆ pushFront()
Push record to front of the buffer.
- Parameters
-
record | Record to push. If record was aquired previously (using getFront) its data will not be copied as it is already present in the buffer. |
- Returns
- True, when record was pushed successfully.
Definition at line 121 of file CircularBuffer.h.
The documentation for this class was generated from the following file: