solver  1.0
Public Member Functions | Private Attributes | List of all members
MovingAverage< T > Class Template Reference

The class encapsulating the calculation of the moving average. More...

#include <DataStructures.h>

+ Collaboration diagram for MovingAverage< T >:

Public Member Functions

 MovingAverage (uint32_t length)
 It constructs an instance of the moving average. More...
 
double average () const
 Current value of the running average.
 
void addValue (const T &val)
 Add a new value to the moving average.
 
bool filled () const
 Returns whether the average is calculated from the full length.
 
void clear ()
 Remove all the values from which the running average is calculated.
 

Private Attributes

uint32_t mLength
 The maximal number of values used for the calculation of the moving average.
 
std::vector< T > mData
 The vector of values from which the running average is calculated.
 

Detailed Description

template<class T>
class MovingAverage< T >

The class encapsulating the calculation of the moving average.

Template Parameters
TNumerical type.
See also
ParallelHeuristicSolver::workerThread

Definition at line 340 of file DataStructures.h.

Constructor & Destructor Documentation

template<class T>
MovingAverage< T >::MovingAverage ( uint32_t  length)
inline

It constructs an instance of the moving average.

Parameters
lengthThe number of values considered in the running average.

Definition at line 346 of file DataStructures.h.


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