iso::data::RingBuffer< Type > Class Template Reference

template ringbuffer class More...

#include <iso_data_ringbuffer.h>

Collaboration diagram for iso::data::RingBuffer< Type >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 RingBuffer (unsigned int pSize)
 parameter based constructor
 RingBuffer (const Type &pSampleElement, int pSize)
 parameter based constructor
virtual ~RingBuffer ()
 destructor
Type & operator[] (unsigned int pIndex)
 access nth element
const Type & operator[] (unsigned int pIndex) const
 access nth element
void update (const Type &pElement)
 update ringbuffer with new element
unsigned int size () const
 get the number of elements available in this ringbuffer

Protected Member Functions

 RingBuffer ()
 do not allow default constructor!
virtual void allocate ()
 creates ring buffer elements
virtual void allocate (const Type &pSampleElement)
 creates ring buffer elements
virtual void free ()
 needs to be called, when contained elements

Protected Attributes

Type ** mElements
 array elements
int mSize
 number of elements
int mIndex
 index to the newest element

Detailed Description

template<typename Type>
class iso::data::RingBuffer< Type >

template ringbuffer class

Ring Buffer Class.
Elements must possess public default constructor, copy constructor and assigment operator.

Created by John Flury on 22/03/07. Copyright 2007 John Flury All rights reserved.


Constructor & Destructor Documentation

template<typename Type>
iso::data::RingBuffer< Type >::RingBuffer ( unsigned int  pSize  ) 

parameter based constructor

Parameters:
pSize number of ring buffer elements
allocates ringer buffer and resets parameters elements are created via the default constructor

template<typename Type>
iso::data::RingBuffer< Type >::RingBuffer ( const Type &  pSampleElement,
int  pSize 
)

parameter based constructor

Parameters:
pSampleElement sample element
pSize number of ring buffer elements
allocates ringer buffer and resets parameters elements are created via copy constructor from the sample element

template<typename Type>
iso::data::RingBuffer< Type >::~RingBuffer (  )  [virtual]

destructor

template<typename Type>
iso::data::RingBuffer< Type >::RingBuffer (  )  [protected]

do not allow default constructor!


Member Function Documentation

template<typename Type>
Type & iso::data::RingBuffer< Type >::operator[] ( unsigned int  pIndex  )  [inline]

access nth element

Parameters:
pIndex nth element's index
0 = newest, nth = nth element (older)

template<typename Type>
const Type & iso::data::RingBuffer< Type >::operator[] ( unsigned int  pIndex  )  const [inline]

access nth element

Parameters:
pIndex nth element's index
0 = newest, nth = nth element (older)

template<typename Type>
void iso::data::RingBuffer< Type >::update ( const Type &  pElement  ) 

update ringbuffer with new element

Parameters:
pElement new element

template<typename Type>
unsigned int iso::data::RingBuffer< Type >::size (  )  const

get the number of elements available in this ringbuffer

template<typename Type>
void iso::data::RingBuffer< Type >::allocate (  )  [protected, virtual]

creates ring buffer elements

template<typename Type>
void iso::data::RingBuffer< Type >::allocate ( const Type &  pSampleElement  )  [protected, virtual]

creates ring buffer elements

Parameters:
pSampleElement sample element

template<typename Type>
void iso::data::RingBuffer< Type >::free (  )  [protected, virtual]

needs to be called, when contained elements


Member Data Documentation

template<typename Type>
Type** iso::data::RingBuffer< Type >::mElements [protected]

array elements

template<typename Type>
int iso::data::RingBuffer< Type >::mSize [protected]

number of elements

template<typename Type>
int iso::data::RingBuffer< Type >::mIndex [protected]

index to the newest element


The documentation for this class was generated from the following file:
Generated on Fri Feb 25 13:57:33 2011 for iso_data by  doxygen 1.5.1