Implements a rolling average filter of the specified type.
More...
#include <RollingAvgFilter.h>
|
| RollingAvgFilter (size_t numPoints) |
| Construct a new rolling average filter.
|
|
T | get () const |
| Get the output of the filter.
|
|
T | get (const T &val) |
| Adds data to the filter and gets the new output.
|
|
void | reset () |
| Clears all data in the buffer.
|
|
int | getSize () const |
| Returns the number of points stored in the buffer.
|
|
int | getBufferSize () const |
| Get the maximum number of points that can be stored in the buffer.
|
|
std::list< T > | getData () const |
| Get the underlying buffer of the filter.
|
|
template<typename T>
class filters::RollingAvgFilter< T >
Implements a rolling average filter of the specified type.
- Template Parameters
-
T | The data type to filter. Must support commutative addition as well as scalar division. |
◆ RollingAvgFilter()
Construct a new rolling average filter.
- Parameters
-
numPoints | The maximum number of points that can be stored in the buffer. |
◆ get() [1/2]
Get the output of the filter.
Behavior is undefined if no data is in the filter.
- Returns
- The output of the filter.
- Warning
- If no data is in the filter the behavior is undefined.
◆ get() [2/2]
Adds data to the filter and gets the new output.
- Parameters
-
val | The data to add to the filter. |
- Returns
- The new output of the filter after adding this data.
◆ getBufferSize()
Get the maximum number of points that can be stored in the buffer.
- Returns
- The maximum number of points that can be stored in the buffer.
◆ getData()
Get the underlying buffer of the filter.
- Returns
- A copy of the underlying buffer.
◆ getSize()
Returns the number of points stored in the buffer.
- Returns
- The number of points stored in the buffer, in the range [0, numPoints]
The documentation for this class was generated from the following file: