15 #ifndef ECL_CONTAINERS_FIFO_HPP_ 16 #define ECL_CONTAINERS_FIFO_HPP_ 89 FiFo(
const unsigned int length = 0 ) :
93 if ( size_fifo > 0 ) {
94 data.resize( size_fifo );
103 FiFo(
const unsigned int length,
const T &value ) :
107 if ( size_fifo > 0 ) {
122 T & operator[] (
int idx) {
123 return data[ ((running_index+idx)%size_fifo) ];
132 const T & operator[] (
int idx)
const {
133 return data[ ((running_index+idx)%size_fifo) ];
144 data[ running_index++ ] = datum;
145 running_index %= size_fifo;
153 for(
unsigned int i=0; i<size_fifo; i++ ) data[i] = value;
160 unsigned int get_idx() {
return running_index;}
170 data.resize( size_fifo );
void resize(unsigned int length) ecl_assert_throw_decl(StandardException)
Resize the fifo storage.
void push_back(const T &datum)
Push back onto the fifo.
Embedded control libraries.
unsigned int running_index
FiFo(const unsigned int length=0)
Initialises the fifo, but does not fill it.
virtual ~FiFo()
Default destructor.
Really simple fifo implementation.
#define ecl_assert_throw(expression, exception)
Fixed size containers with a few bells and whistles.
unsigned int get_idx()
Index of the oldest element in the fifo.
void fill(const T &value)
One-shot fill method.
#define ecl_assert_throw_decl(exception)
static ConstantArray< Type, Size > Constant(const Type &value)
FiFo(const unsigned int length, const T &value)
Initialise and fill the fifo.