Sampler< TYPE > Class Template Reference

#include <sampler.hpp>

Public Member Functions

 Sampler (int numSamples)
 
 ~Sampler ()
 
void storeSample (const TYPE &sample)
 
TYPE getAverage (void) const
 
TYPE getLatest (void) const
 
TYPE getHighest (void) const
 
TYPE getLowest (void) const
 
bool allSamplesReady (void) const
 
int getMaxSampleCount (void) const
 
int getSampleCount (void) const
 
TYPE getSampleNum (int idx) const
 
void clear (void)
 

Detailed Description

template<typename TYPE>
class Sampler< TYPE >

Sampler class. The purpose of this class is to store samples of a variable type and be able to get the average, low, high from the samples.

Sampler<int> samples(2);
samples.storeSample(10);
samples.storeSample(20);
int avg = samples.getAverage(); // Should be 15

Constructor & Destructor Documentation

template<typename TYPE>
Sampler< TYPE >::Sampler ( int  numSamples)
inline
template<typename TYPE>
Sampler< TYPE >::~Sampler ( )
inline

Member Function Documentation

template<typename TYPE>
bool Sampler< TYPE >::allSamplesReady ( void  ) const
inline
template<typename TYPE>
void Sampler< TYPE >::clear ( void  )
inline
template<typename TYPE>
TYPE Sampler< TYPE >::getAverage ( void  ) const
inline
template<typename TYPE>
TYPE Sampler< TYPE >::getHighest ( void  ) const
inline
template<typename TYPE>
TYPE Sampler< TYPE >::getLatest ( void  ) const
inline
template<typename TYPE>
TYPE Sampler< TYPE >::getLowest ( void  ) const
inline
template<typename TYPE>
int Sampler< TYPE >::getMaxSampleCount ( void  ) const
inline
template<typename TYPE>
int Sampler< TYPE >::getSampleCount ( void  ) const
inline
template<typename TYPE>
TYPE Sampler< TYPE >::getSampleNum ( int  idx) const
inline
template<typename TYPE>
void Sampler< TYPE >::storeSample ( const TYPE &  sample)
inline

The documentation for this class was generated from the following file:
  • /var/www/html/SJSU-DEV-Linux/firmware/default/lib/L3_Utils/sampler.hpp