MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
Mezzanine::WeightedRollingAverage< RecordType, MathType > Class Template Reference

A weighted average that does math with every insertion and stores nothing. More...

#include <rollingaverage.h>

+ Inheritance diagram for Mezzanine::WeightedRollingAverage< RecordType, MathType >:
+ Collaboration diagram for Mezzanine::WeightedRollingAverage< RecordType, MathType >:

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 &RecordCount=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.
 
Whole WeightCount
 Replaces the capacity of normal rolling averages.
 

Detailed Description

template<typename RecordType, typename MathType>
class Mezzanine::WeightedRollingAverage< RecordType, MathType >

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.

Constructor & Destructor Documentation

template<typename RecordType , typename MathType >
Mezzanine::WeightedRollingAverage< RecordType, MathType >::WeightedRollingAverage ( const Whole RecordCount = MEZZ_FRAMESTOTRACK)
inline

Class Constructor.

Parameters
RecordCountHow many records should this emulate.

Definition at line 223 of file rollingaverage.h.

Member Function Documentation

template<typename RecordType , typename MathType >
virtual RecordType Mezzanine::WeightedRollingAverage< RecordType, MathType >::GetAverage ( ) const
inlinevirtual

Get the current rolling average.

Returns
Get the Current Rolling average as a RecordType.

Implements Mezzanine::RollingAverage< RecordType >.

Definition at line 246 of file rollingaverage.h.

template<typename RecordType , typename MathType >
virtual void Mezzanine::WeightedRollingAverage< RecordType, MathType >::Insert ( RecordType  Datum)
inlinevirtual

Update the currently stored Rolling average with a new data point/record.

Parameters
DatumUpdate 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.

template<typename RecordType , typename MathType >
virtual RecordType& Mezzanine::WeightedRollingAverage< RecordType, MathType >::operator[] ( Whole  )
inlinevirtual

Get the last insertion.

Returns
The last insertion, always the last one, it is the only one stored.

Implements Mezzanine::RollingAverage< RecordType >.

Definition at line 251 of file rollingaverage.h.

template<typename RecordType , typename MathType >
virtual RecordType Mezzanine::WeightedRollingAverage< RecordType, MathType >::operator[] ( Whole  ) const
inlinevirtual

Get the last insertion.

Returns
The last insertion, always the last one, it is the only one stored.

Implements Mezzanine::RollingAverage< RecordType >.

Definition at line 256 of file rollingaverage.h.

template<typename RecordType , typename MathType >
virtual Whole Mezzanine::WeightedRollingAverage< RecordType, MathType >::RecordCapacity ( ) const
inlinevirtual

Returns how many records this is emulating.

Returns
A Whole that stores the count of record emulation.

Implements Mezzanine::RollingAverage< RecordType >.

Definition at line 231 of file rollingaverage.h.


The documentation for this class was generated from the following file: