Public Member Functions

circular_buffer_t< T > Class Template Reference
[Utility Library]

Simple circular buffer. More...

#include <circular.h>

List of all members.

Public Member Functions

 circular_buffer_t (IN int size)
void addSample (IN const T &t)
int size (void) const throw ()
const T & getSample (IN int idx) const throw ()
 idx = 0 is the oldest sample, always
T & getSample (IN int idx) throw ()
 idx = 0 is the oldest sample, always

Detailed Description

template<class T>
class circular_buffer_t< T >

Simple circular buffer.

You can repeatedly add samples, and this class will keep only the most current N samples in the buffer. You can ask for the number of samples in the buffer, and iterate through them. Starting at index 0 means you will always walk forward from the oldest to the newest sample in the buffer.

Definition at line 45 of file circular.h.


Constructor & Destructor Documentation

template<class T >
circular_buffer_t< T >::circular_buffer_t ( IN int  size  )  [inline]

Definition at line 48 of file circular.h.


Member Function Documentation

template<class T >
void circular_buffer_t< T >::addSample ( IN const T &  t  )  [inline]

Definition at line 57 of file circular.h.

template<class T >
int circular_buffer_t< T >::size ( void   )  const throw () [inline]

Definition at line 69 of file circular.h.

template<class T >
const T& circular_buffer_t< T >::getSample ( IN int  idx  )  const throw () [inline]

idx = 0 is the oldest sample, always

Definition at line 72 of file circular.h.

template<class T >
T& circular_buffer_t< T >::getSample ( IN int  idx  )  throw () [inline]

idx = 0 is the oldest sample, always

Definition at line 78 of file circular.h.


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