daisy::RingBuffer¶
#include <ringbuffer.h>
Public Functions¶
Name | |
---|---|
RingBuffer() | |
void | Init() |
size_t | capacity() const |
size_t | writable() const |
size_t | readable() const |
bool | isEmpty() const |
void | Write(T v) |
void | Overwrite(T v) |
T | Read() |
T | ImmediateRead() |
void | Flush() |
void | Swallow(size_t n) |
void | ImmediateRead(T * destination, size_t num_elements) |
void | Overwrite(const T * source, size_t num_elements) |
void | Advance(size_t num_elements) |
T * | GetMutableBuffer() |
Detailed Description¶
Utility Ring Buffer
imported from pichenettes/stmlib
Public Functions Documentation¶
function RingBuffer¶
function Init¶
Initializes the Ring Buffer
function capacity¶
Return: The total size of the ring buffer
function writable¶
Return: the number of samples that can be written to ring buffer without overwriting unread data.
function readable¶
Return: number of unread elements in ring buffer
function isEmpty¶
Return: True, if the buffer is empty.
function Write¶
Parameters:
- v Value to write
Writes the value to the next available position in the ring buffer
function Overwrite¶
Parameters:
- v Value to overwrite
Writes the new element to the ring buffer, overwriting unread data if necessary.
function Read¶
Return: read value
Reads the first available element from the ring buffer
function ImmediateRead¶
Return: read value
Reads next element from ring buffer immediately
function Flush¶
Flushes unread elements from the ring buffer
function Swallow¶
Parameters:
- n Size of T ?
Read enough samples to make it possible to read 1 sample.
function ImmediateRead¶
Parameters:
- destination buffer to write to
- num_elements number of elements in buffer
Reads a number of elements into a buffer immediately
function Overwrite¶
Parameters:
- source Input buffer
- num_elements Number of elements in source
Overwrites a number of elements using the source buffer as input.
function Advance¶
Advances the write pointer, for when a peripheral is writing to the buffer.
function GetMutableBuffer¶
Returns a pointer to the actual Ring Buffer Useful for when a peripheral needs direct access to the buffer.
---¶
Updated on 2024-01-03 at 19:41:01 +0000