OMNeT++ Simulation Library
5.6.1
|
#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) |
Methods deprecated due to renaming. | |
virtual _OPPDEPRECATED double | getWeights () const final |
virtual _OPPDEPRECATED void | collect2 (double value, double weight) final |
virtual _OPPDEPRECATED void | collect2 (SimTime value, double weight) final |
virtual _OPPDEPRECATED void | collect2 (double value, SimTime weight) final |
virtual _OPPDEPRECATED void | collect2 (SimTime value, SimTime weight) final |
virtual _OPPDEPRECATED double | random () const final |
virtual _OPPDEPRECATED void | clearResult () final |
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 |
virtual bool | isSoftOwner () const |
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) | |
virtual | ~cObject () |
virtual const char * | getClassName () const |
bool | isName (const char *s) const |
virtual const char * | getFullName () const |
virtual std::string | getFullPath () const |
const cObject * | getThisPtr () const |
virtual std::string | str () const |
virtual _OPPDEPRECATED std::string | info () const |
virtual _OPPDEPRECATED std::string | detailedInfo () const |
virtual cObject * | dup () const |
virtual void | forEachChild (cVisitor *v) |
cObject * | findObject (const char *name, bool deep=true) |
void | copyNotSupported () const |
Additional Inherited Members | |
Static Public Member Functions inherited from cOwnedObject | |
static long | getTotalObjectCount () |
static long | getLiveObjectCount () |
static void | resetObjectCounters () |
static cDefaultList * | getDefaultOwner () |
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
|
virtual |
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's operator=() for more 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 cLegacyHistogram, cKSplit, cHistogram, cPrecollectionBasedDensityEst, cVarHistogram, cStdDev, cPSquare, and cLegacyHistogramBase.
|
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 cLegacyHistogram, cKSplit, cHistogram, cPrecollectionBasedDensityEst, cVarHistogram, cStdDev, cPSquare, and cLegacyHistogramBase.
|
pure virtual |
Returns true if this object collects weighted statistics.
Implemented in cStdDev.
|
pure virtual |
Collects one value.
Implemented in cLongHistogram, cHistogram, cPrecollectionBasedDensityEst, cPSquare, and cStdDev.
Referenced by cPrecollectionBasedDensityEst::cPrecollectionBasedDensityEst(), cStdDev::isWeighted(), and cPSquare::setUpBins().
|
inlinevirtual |
Convenience method, delegates to collect(double).
Reimplemented in cLongHistogram.
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.
Referenced by cPrecollectionBasedDensityEst::cPrecollectionBasedDensityEst(), cStdDev::isWeighted(), and cPSquare::setUpBins().
|
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, cPrecollectionBasedDensityEst, cVarHistogram, and cLegacyHistogramBase.
|
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 cLegacyHistogram, cKSplit, cStdDev, cPSquare, cHistogram, cPrecollectionBasedDensityEst, cVarHistogram, and cLegacyHistogramBase.
|
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 cLegacyHistogram, cKSplit, cStdDev, cPSquare, cHistogram, cPrecollectionBasedDensityEst, cVarHistogram, and cLegacyHistogramBase.
|
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.
|
inlinefinalvirtual |
Please use getSumWeights() to obtain the sum of weights.
|
inlinefinalvirtual |
Deprecated method, please use collectWeighted() instead.
|
inlinefinalvirtual |
Deprecated method, please use collectWeighted() instead.
|
inlinefinalvirtual |
Deprecated method, please use collectWeighted() instead.
Deprecated method, please use collectWeighted() instead.
|
inlinefinalvirtual |
Deprecated method, please use draw() to obtain a random number from the collected data.
|
inlinefinalvirtual |
Deprecated method, please use clear() instead.