Raul::RingBuffer< T > Class Template Reference

A lock-free RingBuffer. More...

#include <RingBuffer.hpp>

Inherited by Raul::StampedChunkRingBuffer [private].

List of all members.

Public Member Functions

 RingBuffer (size_t size)
 
Parameters:
size Size in bytes.

void reset ()
 Reset(empty) the ringbuffer.
size_t write_space () const
size_t read_space () const
size_t capacity () const
size_t read (size_t size, T *dst)
 Read from the ringbuffer.
void write (size_t size, const T *src)
bool full_read (size_t size, T *dst)

Protected Attributes

gint _write_ptr
gint _read_ptr
size_t _size
 Size (capacity) in bytes.
T * _buf
 size, event, size, event...


Detailed Description

template<typename T>
class Raul::RingBuffer< T >

A lock-free RingBuffer.

Read/Write realtime safe. Single-reader Single-writer thread safe.


Member Function Documentation

template<typename T>
void Raul::RingBuffer< T >::reset (  )  [inline]

Reset(empty) the ringbuffer.

NOT thread safe.

template<typename T>
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.


The documentation for this class was generated from the following file:
Generated on Wed Apr 9 08:14:41 2008 for RAUL by  doxygen 1.5.1