Allolib
1.0
C++ Components For Interactive Multimedia
|
Public Member Functions | |
SingleRWRingBuffer (size_t sz=256) | |
size_t | writeSpace () const |
size_t | readSpace () const |
size_t | write (const char *src, size_t sz) |
size_t | read (char *dst, size_t sz) |
size_t | peek (char *dst, size_t sz) |
void | clear () |
Protected Attributes | |
size_t | mSize |
size_t | mWrap |
size_t | mRead |
size_t | mWrite |
char * | mData |
Lock free single-reader-single-writer ring buffer. Can be used to stream data safely between two threads, one being a reader, one a writer. There is no locking in this ring buffer, so it is ideal to pass data to and from a high priority thread like an audio thread.
Definition at line 62 of file al_SingleRWRingBuffer.hpp.
|
inline |
Allocate ringbuffer. Actual size rounded up to next power of 2.
Definition at line 113 of file al_SingleRWRingBuffer.hpp.
|
inline |
Clear any data in the ringbuffer
Definition at line 95 of file al_SingleRWRingBuffer.hpp.
|
inline |
Read data without advancing the read pointer Returns bytes actually copied
Definition at line 178 of file al_SingleRWRingBuffer.hpp.
|
inline |
Read sz bytes of data from the ring buffer and advance the read pointer. Returns bytes actually copied
Definition at line 157 of file al_SingleRWRingBuffer.hpp.
|
inline |
The number of bytes available for reading.
Definition at line 130 of file al_SingleRWRingBuffer.hpp.
|
inline |
Copy sz bytes from src into the ringbuffer. Returns bytes actually copied.
Definition at line 136 of file al_SingleRWRingBuffer.hpp.
|
inline |
The number of bytes available for writing.
Definition at line 123 of file al_SingleRWRingBuffer.hpp.