Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RingBuffer< T > Class Template Reference

#include <ringbuffer.h>

Public Member Functions

 RingBuffer ()
 
 RingBuffer (int size)
 
void init (int size, const T &t)
 sets size of buffer and initializes buffer elements. More...
 
int getBufferSize () const
 
T & get (int index)
 returns object at index. More...
 
const T & get (int index) const
 
T & operator[] (int index)
 see get() More...
 
const T & operator[] (int index) const
 see get() More...
 

Protected Attributes

std::vector< T > buffer
 
int buffersize
 

Constructor & Destructor Documentation

RingBuffer ( )
inline
RingBuffer ( int  size)
inline

Member Function Documentation

T& get ( int  index)
inline

returns object at index.

Index can be larger than buffersize, it will be wrapped. Negative index means 0.

const T& get ( int  index) const
inline
int getBufferSize ( ) const
inline
void init ( int  size,
const T &  t 
)
inline

sets size of buffer and initializes buffer elements.

T& operator[] ( int  index)
inline

see get()

const T& operator[] ( int  index) const
inline

see get()

Member Data Documentation

std::vector<T> buffer
protected
int buffersize
protected

The documentation for this class was generated from the following file: