This class provides an implementation for calculating a moving average with a fixed window. More...
#include <Radiant/MovingAverage.hpp>
Public Member Functions | |
| void | add (const T &t, Radiant::TimeStamp ts=Radiant::TimeStamp::currentTime()) |
| Add a sample with the given timestamp to the buffer. More... | |
| T | avg (Radiant::TimeStamp ts=Radiant::TimeStamp::currentTime()) const |
| Compute the average of the history values before given timestamp. More... | |
| void | forget (int number) |
| Forget samples. More... | |
| MovingAverage (const T &t, double history) | |
| Construct a new buffer. More... | |
| T | operator* () const |
| Implicit conversion to value-type. More... | |
| void | set (const T &t) |
| Sets the average of the buffer to given value. More... | |
This class provides an implementation for calculating a moving average with a fixed window.
|
inline |
Construct a new buffer.
| t | initial value |
| history | history length in seconds |
|
inline |
Add a sample with the given timestamp to the buffer.
| t | sample value |
| ts | timestamp of the value |
|
inline |
Compute the average of the history values before given timestamp.
| ts | time limit |
|
inline |
Forget samples.
| number | of samples to forget from the end of the buffer |
|
inline |
Implicit conversion to value-type.
|
inline |
Sets the average of the buffer to given value.
| t | new buffer average |