OMNeT++ Simulation Library
6.0.3
|
#include <cstatistic.h>
cStatistic is an abstract class for computing statistical properties of a random variable.
This class inherits from cRandom, because instances are able to generate random variates from the estimated distribution.
Public Member Functions | |
Constructors, destructor, assignment. | |
cStatistic (const cStatistic &r) | |
cStatistic (const char *name=nullptr) | |
virtual | ~cStatistic () |
cStatistic & | operator= (const cStatistic &res) |
Redefined cObject member functions. | |
virtual void | parsimPack (cCommBuffer *buffer) const override |
virtual void | parsimUnpack (cCommBuffer *buffer) override |
Collecting values. | |
virtual bool | isWeighted () const =0 |
virtual void | collect (double value)=0 |
virtual void | collect (SimTime value) |
virtual void | collectWeighted (double value, double weight) |
virtual void | collectWeighted (SimTime value, double weight) |
virtual void | collectWeighted (double value, SimTime weight) |
virtual void | collectWeighted (SimTime value, SimTime weight) |
virtual void | merge (const cStatistic *other)=0 |
virtual void | clear ()=0 |
Statistics of collected data. | |
virtual int64_t | 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 | getSumWeights () const =0 |
virtual double | getWeightedSum () const =0 |
virtual double | getSqrSumWeights () const =0 |
virtual double | getWeightedSqrSum () 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=nullptr) |
Public Member Functions inherited from cRandom | |
cRandom (cRNG *rng) | |
cRandom (const char *name=nullptr, cRNG *rng=nullptr) | |
virtual | ~cRandom () |
virtual void | setRNG (cRNG *rng) |
cRNG * | getRNG () const |
virtual double | draw () const =0 |
Public Member Functions inherited from cOwnedObject | |
cOwnedObject () | |
cOwnedObject (const char *name, bool namepooling=true) | |
cOwnedObject (const cOwnedObject &obj) | |
virtual | ~cOwnedObject () |
cOwnedObject & | operator= (const cOwnedObject &o) |
virtual cObject * | getOwner () const override |
virtual bool | isOwnedObject () const override |
Public Member Functions inherited from cNamedObject | |
cNamedObject () | |
cNamedObject (const char *name, bool namepooling=true) | |
cNamedObject (const cNamedObject &obj) | |
virtual | ~cNamedObject () |
cNamedObject & | operator= (const cNamedObject &o) |
virtual void | setName (const char *s) |
virtual const char * | getName () const override |
virtual void | setNamePooling (bool b) |
virtual bool | getNamePooling () |
Public Member Functions inherited from cObject | |
cObject () | |
cObject (const cObject &other)=default | |
virtual | ~cObject () |
virtual const char * | getClassName () const |
bool | isName (const char *s) const |
virtual const char * | getFullName () const |
virtual std::string | getFullPath () const |
virtual std::string | getClassAndFullName () const |
virtual std::string | getClassAndFullPath () const |
const cObject * | getThisPtr () const |
virtual std::string | str () const |
virtual std::ostream & | printOn (std::ostream &os) const |
virtual cObject * | dup () const |
virtual bool | isSoftOwner () const |
virtual void | forEachChild (cVisitor *v) |
cObject * | findObject (const char *name, bool deep=true) |
virtual cClassDescriptor * | getDescriptor () const |
void | copyNotSupported () const |
Additional Inherited Members | |
Static Public Member Functions inherited from cOwnedObject | |
static long | getTotalObjectCount () |
static long | getLiveObjectCount () |
static void | resetObjectCounters () |
static cSoftOwner * | getOwningContext () |
Protected Member Functions inherited from cObject | |
virtual void | take (cOwnedObject *obj) |
virtual void | drop (cOwnedObject *obj) |
void | dropAndDelete (cOwnedObject *obj) |
cStatistic | ( | const cStatistic & | r | ) |
Copy constructor.
|
explicit |
Constructor, creates an object with the given name
|
inlinevirtual |
Destructor.
cStatistic& operator= | ( | const cStatistic & | res | ) |
Assignment operator. It is present since descendants may refer to it. The name member is not copied; see cNamedObject::operator=() for details.
|
overridevirtual |
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 cKSplit, cHistogram, cPrecollectionBasedDensityEst, cStdDev, and cPSquare.
|
overridevirtual |
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 cKSplit, cHistogram, cPrecollectionBasedDensityEst, cStdDev, and cPSquare.
|
pure virtual |
Returns true if this object collects weighted statistics.
Implemented in cStdDev.
|
pure virtual |
Collects one value.
Implemented in cHistogram, cPrecollectionBasedDensityEst, cPSquare, and cStdDev.
|
inlinevirtual |
Convenience method, delegates to collect(double).
References cStatistic::collect(), and SimTime::dbl().
Referenced by cStatistic::collect().
|
virtual |
Collects one value with a given weight.
Reimplemented in cHistogram, cPrecollectionBasedDensityEst, cPSquare, and cStdDev.
|
inlinevirtual |
Convenience method, delegates to collectWeighted(double, double).
References cStatistic::collectWeighted(), and SimTime::dbl().
Referenced by cStatistic::collectWeighted().
|
inlinevirtual |
Convenience method, delegates to collectWeighted(double, double).
References cStatistic::collectWeighted(), and SimTime::dbl().
Referenced by cStatistic::collectWeighted().
Convenience method, delegates to collectWeighted(double, double).
References cStatistic::collectWeighted(), and SimTime::dbl().
Referenced by cStatistic::collectWeighted().
|
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 cKSplit, cHistogram, cPSquare, cPrecollectionBasedDensityEst, and cStdDev.
|
pure virtual |
This function should be redefined in derived classes to clear the results collected so far.
Implemented in cKSplit, cStdDev, cPSquare, cHistogram, and cPrecollectionBasedDensityEst.
|
pure virtual |
Returns the number of the observations, regardless of their weights.
Implemented in cStdDev.
|
pure virtual |
Returns the sum of the values. Not available for weighted statistics.
Implemented in cStdDev.
|
pure virtual |
Returns the sum of the squared values. Not available for weighted statistics.
Implemented in cStdDev.
|
pure virtual |
Returns the minimum of the values.
Implemented in cStdDev.
|
pure virtual |
Returns the maximum of the values.
Implemented in cStdDev.
|
pure virtual |
Returns the mean of the (weighted) observations.
Implemented in cStdDev.
|
pure virtual |
Returns the standard deviation of the (weighted) observations.
Implemented in cStdDev.
|
pure virtual |
Returns the variance of the (weighted) observations.
Implemented in cStdDev.
|
pure virtual |
Returns the sum of weights.
Implemented in cStdDev.
|
pure virtual |
Returns the sum of weight*value products.
Implemented in cStdDev.
|
pure virtual |
Returns the sum of squared weights.
Implemented in cStdDev.
|
pure virtual |
Returns the sum of weight*value*value products.
Implemented in cStdDev.
|
pure virtual |
Writes the contents of the object into a text file. This method is pure virtual, implementation is provided in subclasses.
Implemented in cHistogram, cKSplit, cStdDev, cPSquare, and cPrecollectionBasedDensityEst.
|
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 cHistogram, cKSplit, cStdDev, cPSquare, and cPrecollectionBasedDensityEst.
|
inlinevirtual |
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 setUpBins() on the histogram object, to force it set up histogram bins before recording.
|
inlinevirtual |
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 setUpBins() on the histogram object, to force it set up histogram bins before recording.
|
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 setUpBins() on the histogram object, to force it set up histogram bins before recording.