A lock-free RingBuffer.
More...
#include <RingBuffer.hpp>
List of all members.
Public Member Functions |
| RingBuffer (uint32_t size) |
void | reset () |
| Reset(empty) the ringbuffer.
|
uint32_t | write_space () const |
uint32_t | read_space () const |
uint32_t | capacity () const |
uint32_t | peek (uint32_t size, void *dst) |
| Peek at the ringbuffer (read w/o advancing read pointer).
|
bool | full_peek (uint32_t size, void *dst) |
uint32_t | read (uint32_t size, void *dst) |
| Read from the ringbuffer.
|
bool | full_read (uint32_t size, void *dst) |
bool | skip (uint32_t size) |
void | write (uint32_t size, const void *src) |
Protected Attributes |
uint32_t | _write_ptr |
uint32_t | _read_ptr |
char *const | _buf |
| Contents.
|
const uint32_t | _size |
| Size (capacity) in bytes.
|
Detailed Description
A lock-free RingBuffer.
Read/Write realtime safe. Single-reader Single-writer thread safe.
Constructor & Destructor Documentation
Raul::RingBuffer::RingBuffer |
( |
uint32_t |
size | ) |
[inline, explicit] |
Member Function Documentation
void Raul::RingBuffer::reset |
( |
| ) |
[inline] |
Reset(empty) the ringbuffer.
NOT thread safe.
Referenced by RingBuffer().
uint32_t Raul::RingBuffer::peek |
( |
uint32_t |
size, |
|
|
void * |
dst |
|
) |
| [inline] |
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.
References _buf, and _size.
uint32_t Raul::RingBuffer::read |
( |
uint32_t |
size, |
|
|
void * |
dst |
|
) |
| [inline] |
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.
References _buf, and _size.
The documentation for this class was generated from the following file: