![]() |
VR-Forces 4.1 Class Documentation
|
class DtAverager: More...
Public Member Functions | |
| DtAverager () | |
| Default constructor; assumes a maximum population of 100 samples. | |
| DtAverager (unsigned int maxPopulation) | |
| DtAverager (const DtAverager &orig) | |
| copy constructor | |
| DtAverager & | operator= (const DtAverager &orig) |
| assignment operator | |
| virtual | ~DtAverager () |
| destructor | |
| virtual double | sampleMean () const |
| Compute (if needed) and retrieve the sum of the samples divided by the current population size. | |
| virtual double | sampleMedian () const |
| Compute (if needed) by sorting samples and finding the middle value (or average of two middle values for an even population. | |
| virtual double | sampleStandardDeviation () const |
| Compute (if needed) the sample standard deviation. | |
| virtual double | sampleMinimum () const |
| Find (if needed) the sample maximum; note that this is found as a side effect of sampleMedian(), so if both are desired, call that first. | |
| virtual double | sampleMaximum () const |
| Find (if needed) the sample minumum; note that this is found as a side effect of sampleMedian(), so if both are desired, call that first. | |
| virtual void | addSample (double sample) |
| Add a sample to the population. This calls invalidateStatistics(). | |
| virtual double | lastSample () const |
| virtual unsigned int | maxPopulationSize () const |
| Retrieve the maximum population size. | |
| virtual void | setMaxPopulationSize (unsigned int maxPopulation) |
| Set the maximum population size. This invalidates the current population. | |
| virtual void | invalidatePopulation () |
| Clear all existing samples. | |
| virtual std::vector< double > & | samples () |
| A pointer to the array of samples. | |
| virtual const std::vector < double > & | samples () const |
| virtual unsigned int | currentSampleIndex () const |
| Index which points to the most recent sample in the array. | |
| virtual unsigned int | currentPopulationSize () const |
| Current population size. | |
Protected Member Functions | |
| virtual void | invalidateStatistics () |
| Mark all cached statistics as invalid, forcing them to be recomputed the next time they are accessed. | |
| virtual void | validateStatistics () |
| Reset all the cached flags as true. | |
| void | resetStatistics () |
Private Attributes | |
| double | mySampleMean |
| bool | mySampleMeanValid |
| double | mySampleMedian |
| bool | mySampleMedianValid |
| double | mySampleStandardDeviation |
| bool | mySampleStandardDeviationValid |
| double | mySampleMaximum |
| bool | mySampleMaximumValid |
| double | mySampleMinimum |
| bool | mySampleMinimumValid |
| unsigned int | myCurrentPopulationSize |
| unsigned int | myCurrentSampleIndex |
| std::vector< double > | mySamples |
| std::vector< double > | mySortedSamples |
class DtAverager:
DtAverager maintains a cyclical population of the N most recent samples and can, on command, compute the mean, median, standard deviation, minimum and maximum values of the population. N may be changed, and all samples may be invalidated to restart the process.
| DtAverager::DtAverager | ( | ) |
Default constructor; assumes a maximum population of 100 samples.
| DtAverager::DtAverager | ( | unsigned int | maxPopulation | ) |
| DtAverager::DtAverager | ( | const DtAverager & | orig | ) |
copy constructor
|
virtual |
destructor
| DtAverager& DtAverager::operator= | ( | const DtAverager & | orig | ) |
assignment operator
|
virtual |
Compute (if needed) and retrieve the sum of the samples divided by the current population size.
|
virtual |
Compute (if needed) by sorting samples and finding the middle value (or average of two middle values for an even population.
|
virtual |
Compute (if needed) the sample standard deviation.
|
virtual |
Find (if needed) the sample maximum; note that this is found as a side effect of sampleMedian(), so if both are desired, call that first.
|
virtual |
Find (if needed) the sample minumum; note that this is found as a side effect of sampleMedian(), so if both are desired, call that first.
|
virtual |
Add a sample to the population. This calls invalidateStatistics().
|
virtual |
|
virtual |
Retrieve the maximum population size.
Once the population reaches this size, old samples are removed as new ones are added.
|
virtual |
Set the maximum population size. This invalidates the current population.
|
virtual |
Clear all existing samples.
|
virtual |
A pointer to the array of samples.
|
virtual |
|
virtual |
Index which points to the most recent sample in the array.
|
virtual |
Current population size.
|
protectedvirtual |
Mark all cached statistics as invalid, forcing them to be recomputed the next time they are accessed.
|
protectedvirtual |
Reset all the cached flags as true.
|
protected |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |
|
mutableprivate |
|
mutableprivate |