A weighted average that does math with every insertion and stores nothing. More...
#include <rollingaverage.h>
Public Types | |
typedef RecordType | Type |
Used for accessing the derived type when it may not be directly known. | |
Public Types inherited from Mezzanine::RollingAverage< RecordType > | |
typedef RecordType | Type |
Used for accessing the derived type when it may not be directly known. | |
Public Member Functions | |
WeightedRollingAverage (const Whole &Ignored=MEZZ_FRAMESTOTRACK) | |
Class Constructor. More... | |
virtual | ~WeightedRollingAverage () |
Class Destructor. | |
virtual RecordType | GetAverage () const |
Get the current rolling average. More... | |
virtual void | Insert (RecordType Datum) |
Update the currently stored Rolling average with a new data point/record. More... | |
virtual RecordType & | operator[] (Whole) |
Get the last insertion. More... | |
virtual RecordType | operator[] (Whole) const |
Get the last insertion. More... | |
virtual Whole | RecordCapacity () const |
Returns how many records this is emulating. More... | |
Public Member Functions inherited from Mezzanine::RollingAverage< RecordType > | |
virtual | ~RollingAverage () |
Empty virtual Destructor. | |
Protected Attributes | |
RecordType | CurrentAverage |
What the math says the current avergage is. | |
RecordType | LastEntry |
Sometimes retrieving the value just inserted is too useful. | |
A weighted average that does math with every insertion and stores nothing.
This is possibly an optimization over the BufferedRollingAverage. It has not yet been shown whether the amount of memory for each task will significantly affect load times (From RAM to CPU cache) when starting a rolling average, or whether any innaccuracies in sorting using this would outweigh that.
Definition at line 205 of file rollingaverage.h.
|
inline |
Class Constructor.
Ignored | This parameter is ignored. |
Definition at line 223 of file rollingaverage.h.
|
inlinevirtual |
Get the current rolling average.
Implements Mezzanine::RollingAverage< RecordType >.
Definition at line 246 of file rollingaverage.h.
|
inlinevirtual |
Update the currently stored Rolling average with a new data point/record.
Datum | Update the Current Average according to the following formula CurrentAverage = CurrentAverage * ((RecordCount-1)/RecordCount) + Datum/RecordCount. |
Implements Mezzanine::RollingAverage< RecordType >.
Definition at line 236 of file rollingaverage.h.
|
inlinevirtual |
Get the last insertion.
Implements Mezzanine::RollingAverage< RecordType >.
Definition at line 251 of file rollingaverage.h.
|
inlinevirtual |
Get the last insertion.
Implements Mezzanine::RollingAverage< RecordType >.
Definition at line 256 of file rollingaverage.h.
|
inlinevirtual |
Returns how many records this is emulating.
Implements Mezzanine::RollingAverage< RecordType >.
Definition at line 231 of file rollingaverage.h.