Base class of different statistic collecting classes. More...
#include <cstatistic.h>
Public Member Functions | |
Constructors, destructor, assignment. | |
cStatistic (const cStatistic &r) | |
cStatistic (const char *name=NULL) | |
virtual | ~cStatistic () |
cStatistic & | operator= (const cStatistic &res) |
Redefined cObject member functions. | |
virtual void | parsimPack (cCommBuffer *buffer) |
virtual void | parsimUnpack (cCommBuffer *buffer) |
Collecting values. | |
virtual void | collect (double value)=0 |
virtual void | collect (SimTime value) |
virtual bool | isWeighted () const =0 |
virtual void | collect2 (double value, double weight) |
virtual void | merge (const cStatistic *other)=0 |
virtual void | clearResult ()=0 |
Statistics of collected data. | |
virtual long | getCount () const =0 |
virtual double | getSum () const =0 |
virtual double | getSqrSum () const =0 |
virtual double | getMin () const =0 |
virtual double | getMax () const =0 |
virtual double | getMean () const =0 |
virtual double | getStddev () const =0 |
virtual double | getVariance () const =0 |
Weighted statistics. | |
virtual double | getWeights () const =0 |
virtual double | getWeightedSum () const =0 |
virtual double | getSqrSumWeights () const =0 |
virtual double | getWeightedSqrSum () const =0 |
Transient and result accuracy detection. | |
void | addTransientDetection (cTransientDetection *object) |
void | addAccuracyDetection (cAccuracyDetection *object) |
cTransientDetection * | getTransientDetectionObject () const |
cAccuracyDetection * | getAccuracyDetectionObject () const |
Generating random numbers based on the collected data | |
void | setGenK (int gen_nr) |
virtual double | random () const =0 |
Writing to text file, reading from text file, recording to scalar file. | |
virtual void | saveToFile (FILE *) const =0 |
virtual void | loadFromFile (FILE *)=0 |
virtual void | record () |
virtual void | recordWithUnit (const char *unit) |
virtual void | recordAs (const char *name, const char *unit=NULL) |
Base class of different statistic collecting classes.
cStatistic is the base class for all statistical data collection classes. cStatistic itself adds no data members or algorithms to cOwnedObject, it only defines virtual functions that will be redefined in descendants. No instance of cStatistic can be created.
virtual double cStatistic::getSqrSum | ( | ) | const [pure virtual] |
Returns the sum of the squared values.
Implemented in cStdDev.
Referenced by cStdDev::getWeightedSqrSum().
virtual double cStatistic::getSum | ( | ) | const [pure virtual] |
Returns the sum of the values.
Implemented in cStdDev.
Referenced by cStdDev::getWeightedSum().
virtual void cStatistic::loadFromFile | ( | FILE * | ) | [pure virtual] |
Reads the object data from a file written out by saveToFile().
This method is pure virtual, implementation is provided in subclasses.
Implemented in cDensityEstBase, cHistogramBase, cHistogram, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram.
virtual void cStatistic::merge | ( | const cStatistic * | other | ) | [pure virtual] |
Updates this object with data coming from another statistics object.
The result is as if this object had collected all the observations fed into the other object as well.
Implemented in cDensityEstBase, cKSplit, cPSquare, cStdDev, and cWeightedStdDev.
cStatistic& cStatistic::operator= | ( | const cStatistic & | res | ) |
Assignment operator.
It is present since descendants may refer to it. The name member is not copied; see cNamedObject's operator=() for more details.
virtual void cStatistic::parsimPack | ( | cCommBuffer * | buffer | ) | [virtual] |
Serializes the object into an MPI send buffer.
Used by the simulation kernel for parallel execution. See cObject for more details.
Reimplemented from cOwnedObject.
Reimplemented in cDensityEstBase, cHistogramBase, cHistogram, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram.
virtual void cStatistic::parsimUnpack | ( | cCommBuffer * | buffer | ) | [virtual] |
Deserializes the object from an MPI receive buffer Used by the simulation kernel for parallel execution.
See cObject for more details.
Reimplemented from cOwnedObject.
Reimplemented in cDensityEstBase, cHistogramBase, cHistogram, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram.
virtual double cStatistic::random | ( | ) | const [pure virtual] |
Generates a random number based on the collected data.
Uses the random number generator set by setGenK(). This method is pure virtual, implementation is provided in subclasses.
Implemented in cHistogram, cKSplit, cPSquare, cStdDev, and cVarHistogram.
virtual void cStatistic::record | ( | ) | [inline, virtual] |
Records the statistics into the scalar result file.
(Recorded data includes the number of observations, mean, standard deviation, min, max, potential histogram data, etc.) The name of the recorded statistic will be the object name (see getFullName()).
Note that this operation may have side effect: if this object is a histogram, the method may invoke the transform() on the histogram object, to force it set up histogram cells before recording.
virtual void cStatistic::recordAs | ( | const char * | name, | |
const char * | unit = NULL | |||
) | [virtual] |
Records the statistics into the scalar result file, with the given name, and optionally, the given unit (e.g.
"s", "m/s", etc).
Note that this operation may have side effect: if this object is a histogram, the method may invoke the transform() on the histogram object, to force it set up histogram cells before recording.
virtual void cStatistic::recordWithUnit | ( | const char * | unit | ) | [inline, virtual] |
Records the statistics into the scalar result file, with the given unit (e.g.
"s", "m/s", etc). The name of the recorded statistic will be the object name (see getName()).
Note that this operation may have side effect: if this object is a histogram, the method may invoke the transform() on the histogram object, to force it set up histogram cells before recording.
virtual void cStatistic::saveToFile | ( | FILE * | ) | const [pure virtual] |
Writes the contents of the object into a text file.
This method is pure virtual, implementation is provided in subclasses.
Implemented in cDensityEstBase, cHistogramBase, cHistogram, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram.