Simple CircularBuffer Class.
More...
#include <xmmCircularbuffer.hpp>
|
| CircularBuffer (unsigned int length=1) |
| Constructor. More...
|
|
T | operator() (unsigned int channel, unsigned int index) const |
| Access data by index & channel. More...
|
|
void | clear () |
| Clear the content of the buffer. More...
|
|
void | push (T const value) |
| Add an element to the buffer (single-channel method) More...
|
|
void | push (T const *value) |
| Add an element to the buffer (multi-channel method) More...
|
|
void | push (std::vector< T > const &value) |
| Add an element to the buffer (multi-channel method) More...
|
|
unsigned int | size () const |
| Get the size of the CircularBuffer. More...
|
|
unsigned int | size_t () const |
| Get the actual size of the CircularBuffer (< size() if the buffer is not full) More...
|
|
void | resize (unsigned int length) |
| Resize the buffer to a specific length. More...
|
|
std::vector< T > | mean () const |
| Compute the mean of the buffer. More...
|
|
template<typename T, unsigned int channels = 1>
class xmm::CircularBuffer< T, channels >
Simple CircularBuffer Class.
Multichannel Circular Buffer
- Template Parameters
-
T | Data type |
channels | number of channels |
template<typename T, unsigned int channels = 1>
Constructor.
- Parameters
-
length | length of the CircularBuffer |
template<typename T, unsigned int channels = 1>
Clear the content of the buffer.
template<typename T, unsigned int channels = 1>
Compute the mean of the buffer.
- Returns
- vector containing the mean of the buffer
template<typename T, unsigned int channels = 1>
T xmm::CircularBuffer< T, channels >::operator() |
( |
unsigned int |
channel, |
|
|
unsigned int |
index |
|
) |
| const |
|
inline |
Access data by index & channel.
- Returns
- value at the given index and channel
template<typename T, unsigned int channels = 1>
Add an element to the buffer (single-channel method)
- Parameters
-
value | element to add to the buffer |
- Exceptions
-
invalid_argument | if the buffer is multi-channel |
template<typename T, unsigned int channels = 1>
Add an element to the buffer (multi-channel method)
- Parameters
-
value | element to add to the buffer |
template<typename T, unsigned int channels = 1>
Add an element to the buffer (multi-channel method)
- Parameters
-
value | element to add to the buffer |
template<typename T, unsigned int channels = 1>
Resize the buffer to a specific length.
- Parameters
-
length | target length of the CircularBuffer |
template<typename T, unsigned int channels = 1>
Get the size of the CircularBuffer.
- Returns
- size of the CircularBuffer (length)
template<typename T, unsigned int channels = 1>
Get the actual size of the CircularBuffer (< size() if the buffer is not full)
- Returns
- actual size of the CircularBuffer (length)
template<typename T, unsigned int channels = 1>
current index in the buffer
template<typename T, unsigned int channels = 1>
template<typename T, unsigned int channels = 1>
Defines if the CircularBuffer is already full.
template<typename T, unsigned int channels = 1>
The documentation for this class was generated from the following file: