SLProject 4.0.000
|
Averaged template class provides an average value from a fixed size array. More...
#include <Averaged.h>
Public Member Functions | |
Averaged () | |
Averaged (int numValues, T initValue=0) | |
void | init (int numValues, T initValue) |
Initializes the average value array to a given value. More... | |
void | set (T value) |
Sets the current value in the value array and builds the average. More... | |
T | average () |
size_t | size () |
Private Attributes | |
float | _oneOverNumValues {} |
multiplier instead of divider More... | |
vector< T > | _values |
value array More... | |
int | _currentValueIndex {} |
current value index within _values More... | |
T | _sum |
sum of all values More... | |
T | _average |
average value More... | |
Averaged template class provides an average value from a fixed size array.
The Average template class provides a simple moving average value continuously averaged from a fixed size vector. The template class can be used for any template type T that provides the following operators: =, -, +, T* float
|
inline |
|
inline |
|
inline |
|
inline |
Initializes the average value array to a given value.
|
inline |
Sets the current value in the value array and builds the average.
|
inline |
|
private |
average value
|
private |
current value index within _values
|
private |
multiplier instead of divider
|
private |
sum of all values
|
private |
value array