#include <cstat.h>
Inheritance diagram for cStatistic:
cStatistic is the base class for all statistical data collection classes. cStatistic itself adds no data members or algorithms to cObject, it only defines virtual functions that will be redefined in descendants. No instance of cStatistic can be created.
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 | netPack (cCommBuffer *buffer) |
virtual void | netUnpack (cCommBuffer *buffer) |
Collecting values. | |
virtual void | collect (double val)=0 |
virtual void | collect2 (double val, double weight) |
void | operator+= (double val) |
virtual void | clearResult ()=0 |
Statistics of collected data. | |
virtual long | samples () const =0 |
virtual double | weights () const =0 |
virtual double | sum () const =0 |
virtual double | sqrSum () const =0 |
virtual double | min () const =0 |
virtual double | max () const =0 |
virtual double | mean () const =0 |
virtual double | stddev () const =0 |
virtual double | variance () const =0 |
Transient and result accuracy detection. | |
void | addTransientDetection (cTransientDetection *object) |
void | addAccuracyDetection (cAccuracyDetection *object) |
cTransientDetection * | transientDetectionObject () const |
cAccuracyDetection * | accuracyDetectionObject () 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 | recordScalar (const char *name=NULL) |
|
Copy constructor.
|
|
Constructor, creates an object with the given name.
|
|
Destructor.
|
|
Returns the assigned transient and accuracy detection objects.
|
|
Assigns transient and accuracy detection objects to the statistic object.
|
|
Assigns transient and accuracy detection objects to the statistic object.
|
|
This function should be redefined in derived classes to clear the results collected so far. This method is pure virtual, implementation is provided in subclasses. Implemented in cDensityEstBase, cHistogramBase, cStdDev, cWeightedStdDev, and cVarHistogram. |
|
Collects one value. This method is pure virtual, implementation is provided in subclasses. Implemented in cDensityEstBase, cLongHistogram, cStdDev, and cWeightedStdDev. |
|
Collects one value with a given weight.
Reimplemented in cWeightedStdDev. |
|
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, cEqdHistogramBase, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram. |
|
Returns the maximum of the samples collected. This method is pure virtual, implementation is provided in subclasses. Implemented in cStdDev. |
|
Returns the mean of the samples collected. This method is pure virtual, implementation is provided in subclasses. Implemented in cStdDev, and cWeightedStdDev. |
|
Returns the minimum of the samples collected. This method is pure virtual, implementation is provided in subclasses. Implemented in cStdDev. |
|
Serializes the object into a PVM or MPI send buffer. Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cObject. Reimplemented in cDensityEstBase, cHistogramBase, cEqdHistogramBase, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram. |
|
Deserializes the object from a PVM or MPI receive buffer Used by the simulation kernel for parallel execution. See cObject for more details. Reimplemented from cObject. Reimplemented in cDensityEstBase, cHistogramBase, cEqdHistogramBase, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram. |
|
Same as the collect(double) method.
|
|
Assignment operator. It is present since descendants may refer to it. The name member doesn't get copied; see cObject's operator=() for more details. |
|
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 cLongHistogram, cDoubleHistogram, cKSplit, cPSquare, cStdDev, and cVarHistogram. |
|
Records basic statistics (number of observations, mean, standard deviation, min, max) into the scalar output file by performing several calls to the current module's recordScalar() function. The values will be written under the name "name.samples", "name.mean", "name.stddev", "name.min", "name.max". If name is NULL or missing, the object name (name()) is used. This method may be overridden in subclasses. |
|
Returns the number of samples collected. This method is pure virtual, implementation is provided in subclasses. Implemented in cStdDev. |
|
Writes the contents of the object into a text file. This method is pure virtual, implementation is provided in subclasses. Implemented in cDensityEstBase, cHistogramBase, cEqdHistogramBase, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram. |
|
Sets the index of the random number generator to use when the object has to generate a random number based on the statistics stored.
|
|
Returns the squared sum of the collected data. This method is pure virtual, implementation is provided in subclasses. Implemented in cStdDev. |
|
Returns the standard deviation of the samples collected. This method is pure virtual, implementation is provided in subclasses. Implemented in cStdDev. |
|
Returns the sum of samples collected. This method is pure virtual, implementation is provided in subclasses. Implemented in cStdDev. |
|
Returns the assigned transient and accuracy detection objects.
|
|
Returns the variance of the samples collected. This method is pure virtual, implementation is provided in subclasses. Implemented in cStdDev, and cWeightedStdDev. |
|
Returns the sum of weights of the samples collected. This method is pure virtual, implementation is provided in subclasses. Implemented in cStdDev, and cWeightedStdDev. |