RTP Audio System
2.0.0
|
Ring Buffer. More...
#include <ringbuffer.h>
Public Member Functions | |
RingBuffer () | |
~RingBuffer () | |
bool | init (const cardinal bytes) |
void | flush () |
size_t | bytesReadable () |
size_t | bytesWritable () |
ssize_t | read (char *data, const size_t length) |
ssize_t | write (const char *data, const size_t length) |
Private Attributes | |
char * | Buffer |
size_t | BufferSize |
size_t | WriteStart |
size_t | WriteEnd |
size_t | BytesStored |
Ring Buffer.
This class implements a ring buffer.
Constructor.
Destructor.
size_t RingBuffer::bytesReadable | ( | ) | [inline] |
Get number of bytes available for read.
size_t RingBuffer::bytesWritable | ( | ) | [inline] |
Get number of bytes available for write = (BufferSize - bytesReadable()).
void RingBuffer::flush | ( | ) |
Flush buffer.
bool RingBuffer::init | ( | const cardinal | bytes | ) |
Initialize ring buffer.
bytes | Number of bytes to allocate for buffer. |
ssize_t RingBuffer::read | ( | char * | data, |
const size_t | length | ||
) |
Read data from ring buffer.
data | Data buffer to store read data to. |
length | Size of data buffer. |
ssize_t RingBuffer::write | ( | const char * | data, |
const size_t | length | ||
) |
Write data into ring buffer.
data | Data buffer containing data to write. |
length | Length of data to write. |
char* RingBuffer::Buffer [private] |
size_t RingBuffer::BufferSize [private] |
size_t RingBuffer::BytesStored [private] |
size_t RingBuffer::WriteEnd [private] |
size_t RingBuffer::WriteStart [private] |