Simple circular buffer. More...
#include <circular.h>
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 |
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.
circular_buffer_t< T >::circular_buffer_t | ( | IN int | size | ) | [inline] |
Definition at line 48 of file circular.h.
void circular_buffer_t< T >::addSample | ( | IN const T & | t | ) | [inline] |
Definition at line 57 of file circular.h.
int circular_buffer_t< T >::size | ( | void | ) | const throw () [inline] |
Definition at line 69 of file circular.h.
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.
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.