Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | List of all members
Mezzanine::RollingAverage< RecordType > Class Template Referenceabstract

The interface for rolling averages used in the Mezzanine, and threading library. More...

#include <rollingaverage.h>

+ Inheritance diagram for Mezzanine::RollingAverage< RecordType >:

Public Types

typedef RecordType Type
 Used for accessing the derived type when it may not be directly known.
 

Public Member Functions

virtual ~RollingAverage ()
 Empty virtual Destructor.
 
virtual RecordType GetAverage () const =0
 What is the current rolling average. More...
 
virtual void Insert (RecordType Datum)=0
 Add another record. More...
 
virtual RecordType & operator[] (Whole Index)=0
 Get a 0 indexed record of the past few insertions. More...
 
virtual RecordType operator[] (Whole Index) const =0
 Get a 0 indexed record of the past few insertions. More...
 
virtual Whole RecordCapacity () const =0
 How many records does this use to calculate its wolling average. More...
 

Detailed Description

template<typename RecordType>
class Mezzanine::RollingAverage< RecordType >

The interface for rolling averages used in the Mezzanine, and threading library.

Definition at line 52 of file rollingaverage.h.

Member Function Documentation

template<typename RecordType>
virtual RecordType Mezzanine::RollingAverage< RecordType >::GetAverage ( ) const
pure virtual

What is the current rolling average.

Returns
The current rolling average.

The is no gaurantee on the time this runs in. It run in linear time relative to the amount of records or it could run in constant time

Implemented in Mezzanine::WeightedRollingAverage< RecordType, MathType >, and Mezzanine::BufferedRollingAverage< RecordType >.

template<typename RecordType>
virtual void Mezzanine::RollingAverage< RecordType >::Insert ( RecordType  Datum)
pure virtual

Add another record.

Parameters
DatumThe record to be added. No gaurantee is provided that this record will be preserved, it could be use just once then discarded.

Implemented in Mezzanine::WeightedRollingAverage< RecordType, MathType >, and Mezzanine::BufferedRollingAverage< RecordType >.

template<typename RecordType>
virtual RecordType& Mezzanine::RollingAverage< RecordType >::operator[] ( Whole  Index)
pure virtual

Get a 0 indexed record of the past few insertions.

Parameters
IndexWhich entry to access. This may have different effects with different rolling averages, such as being ignored or estimated.

This returns one insertion, with RecordCapacity()-1 being the newest, and 0 being the oldest.

Warning
This is not guaranteed to accurate in all rolling averages.
Returns
A reference to something the resembles an inserted record.

Implemented in Mezzanine::WeightedRollingAverage< RecordType, MathType >, and Mezzanine::BufferedRollingAverage< RecordType >.

template<typename RecordType>
virtual RecordType Mezzanine::RollingAverage< RecordType >::operator[] ( Whole  Index) const
pure virtual

Get a 0 indexed record of the past few insertions.

This returns one insertion, with RecordCapacity()-1 being the newest, and 0 being the oldest.

Parameters
IndexWhich entry to access. This may have different effects with different rolling averages, such as being ignored or estimated.

This returns one insertion, with RecordCapacity()-1 being the newest, and 0 being the oldest.

Returns
A copy to something the resembles an inserted record.

Implemented in Mezzanine::WeightedRollingAverage< RecordType, MathType >, and Mezzanine::BufferedRollingAverage< RecordType >.

template<typename RecordType>
virtual Whole Mezzanine::RollingAverage< RecordType >::RecordCapacity ( ) const
pure virtual

How many records does this use to calculate its wolling average.

Returns
A Whole containing the capacity.

Implemented in Mezzanine::WeightedRollingAverage< RecordType, MathType >, and Mezzanine::BufferedRollingAverage< RecordType >.


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