Class daisy::RingBuffer¶
template <typename T, size_t size>
ClassList > daisy > RingBuffer
#include <ringbuffer.h>
Public Functions¶
| Type | Name |
|---|---|
| void | Advance (size_t num_elements) |
| void | Flush () |
| T * | GetMutableBuffer () |
| T | ImmediateRead () |
| void | ImmediateRead (T * destination, size_t num_elements) |
| void | Init () |
| void | Overwrite (T v) |
| void | Overwrite (const T * source, size_t num_elements) |
| T | Read () |
| RingBuffer () |
|
| void | Swallow (size_t n) |
| void | Write (T v) |
| size_t | capacity () const |
| bool | isEmpty () const |
| size_t | readable () const |
| size_t | writable () const |
Detailed Description¶
Utility Ring Buffer imported from pichenettes/stmlib
Public Functions Documentation¶
function Advance¶
Advances the write pointer, for when a peripheral is writing to the buffer.
function Flush¶
Flushes unread elements from the ring buffer
function GetMutableBuffer¶
Returns a pointer to the actual Ring Buffer Useful for when a peripheral needs direct access to the buffer.
function ImmediateRead [½]¶
Reads next element from ring buffer immediately
Returns:
read value
function ImmediateRead [2/2]¶
Reads a number of elements into a buffer immediately
Parameters:
destinationbuffer to write tonum_elementsnumber of elements in buffer
function Init¶
Initializes the Ring Buffer
function Overwrite [½]¶
Writes the new element to the ring buffer, overwriting unread data if necessary.
Parameters:
vValue to overwrite
function Overwrite [2/2]¶
Overwrites a number of elements using the source buffer as input.
Parameters:
sourceInput buffernum_elementsNumber of elements in source
function Read¶
Reads the first available element from the ring buffer
Returns:
read value
function RingBuffer¶
function Swallow¶
Read enough samples to make it possible to read 1 sample.
Parameters:
nSize of T ?
function Write¶
Writes the value to the next available position in the ring buffer
Parameters:
vValue to write
function capacity¶
Returns:
The total size of the ring buffer
function isEmpty¶
Returns:
True, if the buffer is empty.
function readable¶
Returns:
number of unread elements in ring buffer
function writable¶
Returns:
the number of samples that can be written to ring buffer without overwriting unread data.
The documentation for this class was generated from the following file external-docs/libDaisy/src/util/ringbuffer.h