RTP Audio System  2.0.0
RingBuffer Class Reference

Ring Buffer. More...

#include <ringbuffer.h>

Inheritance diagram for RingBuffer:
Condition Synchronizable

List of all members.

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

Detailed Description

Ring Buffer.

This class implements a ring buffer.

Author:
Thomas Dreibholz
Version:
1.0

Constructor & Destructor Documentation

Constructor.

Destructor.


Member Function Documentation

size_t RingBuffer::bytesReadable ( ) [inline]

Get number of bytes available for read.

Returns:
Number of bytes readable.
size_t RingBuffer::bytesWritable ( ) [inline]

Get number of bytes available for write = (BufferSize - bytesReadable()).

Returns:
Number of bytes writable.

Flush buffer.

bool RingBuffer::init ( const cardinal  bytes)

Initialize ring buffer.

Parameters:
bytesNumber of bytes to allocate for buffer.
Returns:
true for success; false otherwise.
ssize_t RingBuffer::read ( char *  data,
const size_t  length 
)

Read data from ring buffer.

Parameters:
dataData buffer to store read data to.
lengthSize of data buffer.
Returns:
Bytes read from ring buffer.
ssize_t RingBuffer::write ( const char *  data,
const size_t  length 
)

Write data into ring buffer.

Parameters:
dataData buffer containing data to write.
lengthLength of data to write.
Returns:
Bytes written into ring buffer.

Member Data Documentation

char* RingBuffer::Buffer [private]
size_t RingBuffer::BufferSize [private]
size_t RingBuffer::BytesStored [private]
size_t RingBuffer::WriteEnd [private]
size_t RingBuffer::WriteStart [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines