SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
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
Definition at line 31 of file Averaged.h.
|
inline |
Definition at line 34 of file Averaged.h.
|
inline |
Definition at line 35 of file Averaged.h.
|
inline |
Definition at line 74 of file Averaged.h.
|
inline |
Initializes the average value array to a given value.
Definition at line 41 of file Averaged.h.
|
inline |
Sets the current value in the value array and builds the average.
Definition at line 53 of file Averaged.h.
|
inline |
Definition at line 75 of file Averaged.h.
|
private |
average value
Definition at line 82 of file Averaged.h.
|
private |
current value index within _values
Definition at line 80 of file Averaged.h.
|
private |
multiplier instead of divider
Definition at line 78 of file Averaged.h.
|
private |
sum of all values
Definition at line 81 of file Averaged.h.
|
private |
value array
Definition at line 79 of file Averaged.h.