RAUL
0.7.0
|
A lock-free RingBuffer. More...
#include <RingBuffer.hpp>
Public Member Functions | |
RingBuffer (size_t size) | |
void | reset () |
Reset(empty) the ringbuffer. | |
size_t | write_space () const |
size_t | read_space () const |
size_t | capacity () const |
size_t | peek (size_t size, T *dst) |
Peek at the ringbuffer (read w/o advancing read pointer). | |
bool | full_peek (size_t size, T *dst) |
size_t | read (size_t size, T *dst) |
Read from the ringbuffer. | |
bool | full_read (size_t size, T *dst) |
bool | skip (size_t size) |
void | write (size_t size, const T *src) |
Protected Attributes | |
int | _write_ptr |
int | _read_ptr |
size_t | _size |
Size (capacity) in bytes. | |
char * | _buf |
Contents. |
A lock-free RingBuffer.
Read/Write realtime safe. Single-reader Single-writer thread safe.
Raul::RingBuffer< T >::RingBuffer | ( | size_t | size | ) | [inline] |
size | Size in bytes. |
void Raul::RingBuffer< T >::reset | ( | ) | [inline] |
Reset(empty) the ringbuffer.
NOT thread safe.
Referenced by Raul::RingBuffer< uint8_t >::RingBuffer().
size_t Raul::RingBuffer< T >::peek | ( | size_t | size, |
T * | dst | ||
) |
Peek at the ringbuffer (read w/o advancing read pointer).
Note that a full read may not be done if the data wraps around. Caller must check return value and call again if necessary, or use the full_peek method which does this automatically.
size_t Raul::RingBuffer< T >::read | ( | size_t | size, |
T * | dst | ||
) |
Read from the ringbuffer.
Note that a full read may not be done if the data wraps around. Caller must check return value and call again if necessary, or use the full_read method which does this automatically.