Represents a circular buffer data structure.
More...
#include <AuxCircularBuffer.h>
|
| CircularBuffer () |
| Default Constructor.
|
|
| CircularBuffer (const size_t &capacity) |
| Initializes a CircularBuffer Object with the given capacity.
|
|
| CircularBuffer (const std::vector< sample > &buffer) |
| Initializes a CircularBuffer Object using contents of a given vector.
|
|
| CircularBuffer (const sample *data, const size_t dataSize) |
| Initializes a CircularBuffer Object using pointer to an array of elements.
|
|
| CircularBuffer (const CircularBuffer< sample > &obj)=default |
| Default copy constructor.
|
|
virtual | ~CircularBuffer ()=default |
| Default destructor.
|
|
void | push (const sample &val) |
| Pushes an element onto the circular buffer.
|
|
sample | pop () |
| Pops an element from the circular buffer. The buffer should not be empty.
|
|
void | Log () override |
| Logs the details of the circular buffer.
|
|
void | reset () |
| Resets the circular buffer. This reduces size to zero.
|
|
void | meanRemoval () |
| Subtracts the mean of the buffer from each element in the buffer.
|
|
uint32_t | getSize () |
| Returns the size of the buffer.
|
|
void | resize (size_t newCapacity) |
| Resizes the buffer capacity but also resets the current buffer.
|
|
sample | getShiftedElement (int index) |
| Return the element at the given shifted index. (Read Head has index 0, and so on...).
|
|
|
void | incrementIndex (size_t &index) |
| Increments the given index in a circular manner.
|
|
void | setColour (const ColourType &colourType) |
| This function allows you to set text colour for the text to be printed onto the console.
|
|
template<class sample>
class AuxPort::CircularBuffer< sample >
Represents a circular buffer data structure.
Definition at line 50 of file AuxCircularBuffer.h.
◆ CircularBuffer() [1/4]
◆ CircularBuffer() [2/4]
◆ CircularBuffer() [3/4]
Initializes a CircularBuffer Object using contents of a given vector.
- Note
- The CircularBuffer will have same size and capacity as the vector.
-
First element of the given vector will be the first element of the buffer.
Definition at line 80 of file AuxCircularBuffer.h.
◆ CircularBuffer() [4/4]
Initializes a CircularBuffer Object using pointer to an array of elements.
- Note
- The CircularBuffer will have same size and capacity as the number of elements.
-
Initial element of the array will be the first element of the buffer.
Definition at line 93 of file AuxCircularBuffer.h.
◆ getShiftedElement()
Return the element at the given shifted index. (Read Head has index 0, and so on...).
- Note
- Make Sure that index is less than the number of elements actively in buffer. Otherwise, old elements might be returned from the buffer.
-
Negative Indexing is also supported.
Definition at line 211 of file AuxCircularBuffer.h.
◆ getSize()
◆ incrementIndex()
◆ Log()
◆ meanRemoval()
Subtracts the mean of the buffer from each element in the buffer.
Definition at line 181 of file AuxCircularBuffer.h.
◆ pop()
Pops an element from the circular buffer. The buffer should not be empty.
Definition at line 137 of file AuxCircularBuffer.h.
◆ push()
Pushes an element onto the circular buffer.
- Note
- If the buffer is already full, then the oldest element is removed and the new element is inserted.
Definition at line 120 of file AuxCircularBuffer.h.
◆ reset()
◆ resize()
Resizes the buffer capacity but also resets the current buffer.
Definition at line 199 of file AuxCircularBuffer.h.
◆ buffer
◆ capacity
◆ readIndex
◆ size
◆ writeIndex
The documentation for this class was generated from the following file: