template<typename T>
class ecl::FiFo< T >
Really simple fifo implementation.
For control programs, fifo is typically used for data storage, moving average and some applications. It uses ecl::Array internally for storage (all exception handling is thus handled by ecl::Array).
Usage:
During the construction of fifo, typically length of buffer may be important.
FiFo<double> fifo(4);
fifo.push_back( data_incoming );
But initial value for whole buffer can be important to you.
Especially if you want to use fifo for moving average,
you should wait
for N (length of buffer) incoming of
data.
But if you use below code, you can use fifo immediately
@code
FiFo<double> fifo(4, initial_value);
fifo.push_back( next_data );
...
Data access
[0] always return oldest data set from the fifo and [N-1] returns always new data from the fifo once your buffer is full.
FiFo<double> fifo(4);
fifo.push_back(1.0);
fifo.push_back(2.0);
fifo.push_back(3.0);
fifo.push_back(4.0);
std::cout << fifo[0] << std::endl;
std::cout << fifo[3] << std::endl;
- See also
- ecl::Array.
Definition at line 82 of file fifo.hpp.