OMNeT++ Simulation Library  5.6.1
cStdDev Class Reference

#include <cstddev.h>

Description

Statistics class to collect min, max, mean, and standard deviation.

Inheritance diagram for cStdDev:
cStatistic cRandom cOwnedObject cNamedObject cObject cAbstractHistogram cWeightedStdDev cHistogram cPrecollectionBasedDensityEst cPSquare cKSplit cLegacyHistogramBase cLegacyHistogram cVarHistogram cDoubleHistogram cLongHistogram

Public Member Functions

Constructors, destructor, assignment.
 cStdDev (const cStdDev &r)
 
 cStdDev (const char *name=nullptr, bool weighted=false)
 
virtual ~cStdDev ()
 
cStdDevoperator= (const cStdDev &res)
 
Redefined cObject member functions.
virtual cStdDevdup () const override
 
virtual std::string str () const override
 
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
Redefined cStatistic functions.
virtual bool isWeighted () const override
 
virtual void collect (double value) override
 
virtual void collectWeighted (double value, double weight) override
 
virtual void merge (const cStatistic *other) override
 
virtual int64_t getCount () const override
 
virtual double getSum () const override
 
virtual double getSqrSum () const override
 
virtual double getMin () const override
 
virtual double getMax () const override
 
virtual double getMean () const override
 
virtual double getStddev () const override
 
virtual double getVariance () const override
 
virtual double getSumWeights () const override
 
virtual double getWeightedSum () const override
 
virtual double getSqrSumWeights () const override
 
virtual double getWeightedSqrSum () const override
 
virtual double draw () const override
 
virtual void clear () override
 
virtual void saveToFile (FILE *) const override
 
virtual void loadFromFile (FILE *) override
 
- Public Member Functions inherited from cStatistic
 cStatistic (const cStatistic &r)
 
 cStatistic (const char *name=nullptr)
 
virtual ~cStatistic ()
 
cStatisticoperator= (const cStatistic &res)
 
virtual void collect (SimTime value)
 
virtual void collectWeighted (SimTime value, double weight)
 
virtual void collectWeighted (double value, SimTime weight)
 
virtual void collectWeighted (SimTime value, SimTime weight)
 
virtual void record ()
 
virtual void recordWithUnit (const char *unit)
 
virtual void recordAs (const char *name, const char *unit=nullptr)
 
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)
 
cRNGgetRNG () const
 
- Public Member Functions inherited from cOwnedObject
 cOwnedObject ()
 
 cOwnedObject (const char *name, bool namepooling=true)
 
 cOwnedObject (const cOwnedObject &obj)
 
virtual ~cOwnedObject ()
 
cOwnedObjectoperator= (const cOwnedObject &o)
 
virtual cObjectgetOwner () 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 ()
 
cNamedObjectoperator= (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 cObjectgetThisPtr () const
 
virtual _OPPDEPRECATED std::string info () const
 
virtual _OPPDEPRECATED std::string detailedInfo () const
 
virtual void forEachChild (cVisitor *v)
 
cObjectfindObject (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 cDefaultListgetDefaultOwner ()
 
- Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
 
virtual void drop (cOwnedObject *obj)
 
void dropAndDelete (cOwnedObject *obj)
 

Constructor & Destructor Documentation

◆ cStdDev() [1/2]

cStdDev ( const cStdDev r)
inline

Copy constructor.

◆ cStdDev() [2/2]

cStdDev ( const char *  name = nullptr,
bool  weighted = false 
)
explicit

Constructor.

◆ ~cStdDev()

virtual ~cStdDev ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ operator=()

cStdDev& operator= ( const cStdDev res)

Assignment operator. The name member is not copied; see cNamedObject's operator=() for more details.

Referenced by cAbstractHistogram::operator=(), and cWeightedStdDev::operator=().

◆ dup()

virtual cStdDev* dup ( ) const
inlineoverridevirtual

Creates and returns an exact copy of this object. See cObject for more details.

Reimplemented from cObject.

Reimplemented in cDoubleHistogram, cLongHistogram, cWeightedStdDev, cKSplit, cHistogram, cVarHistogram, cPSquare, and cAbstractHistogram.

◆ str()

virtual std::string str ( ) const
overridevirtual

Produces a one-line description of the object's contents. See cObject for more details.

Reimplemented from cObject.

◆ parsimPack()

virtual void parsimPack ( cCommBuffer buffer) const
overridevirtual

Serializes the object into an MPI send buffer. Used by the simulation kernel for parallel execution. See cObject for more details.

Reimplemented from cStatistic.

Reimplemented in cLegacyHistogram, cKSplit, cHistogram, cPrecollectionBasedDensityEst, cVarHistogram, cPSquare, and cLegacyHistogramBase.

◆ parsimUnpack()

virtual void parsimUnpack ( cCommBuffer buffer)
overridevirtual

Deserializes the object from an MPI receive buffer Used by the simulation kernel for parallel execution. See cObject for more details.

Reimplemented from cStatistic.

Reimplemented in cLegacyHistogram, cKSplit, cHistogram, cPrecollectionBasedDensityEst, cVarHistogram, cPSquare, and cLegacyHistogramBase.

◆ isWeighted()

virtual bool isWeighted ( ) const
inlineoverridevirtual

Returns false if this object represents unweighted statistics, and true if weighted.

Implements cStatistic.

References cStatistic::collect(), and cStatistic::collectWeighted().

◆ collect()

virtual void collect ( double  value)
overridevirtual

Collects one observation.

Implements cStatistic.

Reimplemented in cLongHistogram, cHistogram, cPrecollectionBasedDensityEst, and cPSquare.

Referenced by cHistogram::dup().

◆ collectWeighted()

virtual void collectWeighted ( double  value,
double  weight 
)
overridevirtual

Collects one observation with a given weight. The weight must not be negative. (Zero-weight observations are allowed, but will not affect mean and stddev.)

Reimplemented from cStatistic.

Reimplemented in cHistogram, cPrecollectionBasedDensityEst, and cPSquare.

Referenced by cHistogram::dup().

◆ merge()

virtual void merge ( const cStatistic other)
overridevirtual

Merge another statistics object into this one.

Implements cStatistic.

Reimplemented in cKSplit, cHistogram, cPSquare, and cPrecollectionBasedDensityEst.

◆ getCount()

virtual int64_t getCount ( ) const
inlineoverridevirtual

Returns the number of values collected, regardless of their weights.

Implements cStatistic.

◆ getSum()

virtual double getSum ( ) const
inlineoverridevirtual

Returns the sum of the observations. The sum is only collected if the object represents unweighted statistics, i.e. it is an error to call this function for weighted statistics.

Implements cStatistic.

◆ getSqrSum()

virtual double getSqrSum ( ) const
inlineoverridevirtual

Returns the sum of squares of the collected observations. This is only collected if the object represents unweighted statistics, i.e. it is an error to call this function for weighted statistics.

Implements cStatistic.

◆ getMin()

virtual double getMin ( ) const
overridevirtual

Returns the minimum of the collected observations, or NaN if none have been collected yet.

Implements cStatistic.

◆ getMax()

virtual double getMax ( ) const
overridevirtual

Returns the maximum of the collected observations, or NaN if none have been collected yet.

Implements cStatistic.

◆ getMean()

virtual double getMean ( ) const
overridevirtual

Returns the (weighted/unweighted) mean of the collected observations, or NaN if none have been collected yet.

Implements cStatistic.

◆ getStddev()

virtual double getStddev ( ) const
overridevirtual

Returns the estimated (weighted/unweighted) standard deviation of the observations, or NaN if less than two observations have been collected.

Implements cStatistic.

◆ getVariance()

virtual double getVariance ( ) const
overridevirtual

Returns the variance of the observations collected, or NaN if less than two observations have been collected.

Implements cStatistic.

◆ getSumWeights()

virtual double getSumWeights ( ) const
inlineoverridevirtual

Returns the sum of weights. (For unweighted statistics, all weights are taken to be 1.0.)

Implements cStatistic.

◆ getWeightedSum()

virtual double getWeightedSum ( ) const
inlineoverridevirtual

Returns the sum of weight*value products. (For unweighted statistics, all weights are taken to be 1.0.)

Implements cStatistic.

◆ getSqrSumWeights()

virtual double getSqrSumWeights ( ) const
inlineoverridevirtual

Returns the sum of squared weights. (For unweighted statistics, all weights are taken to be 1.0.)

Implements cStatistic.

◆ getWeightedSqrSum()

virtual double getWeightedSqrSum ( ) const
inlineoverridevirtual

Returns the sum of weight*value*value products. (For unweighted statistics, all weights are taken to be 1.0.)

Implements cStatistic.

◆ draw()

virtual double draw ( ) const
overridevirtual

Returns a number from a normal distribution with the current mean and standard deviation.

Implements cRandom.

Reimplemented in cLegacyHistogram, cPSquare, cAbstractHistogram, and cVarHistogram.

◆ clear()

virtual void clear ( )
overridevirtual

Clears the results collected so far.

Implements cStatistic.

Reimplemented in cKSplit, cPSquare, cHistogram, cPrecollectionBasedDensityEst, cVarHistogram, and cLegacyHistogramBase.

◆ saveToFile()

virtual void saveToFile ( FILE *  ) const
overridevirtual

Writes the contents of the object into a text file.

Implements cStatistic.

Reimplemented in cLegacyHistogram, cKSplit, cPSquare, cHistogram, cPrecollectionBasedDensityEst, cVarHistogram, and cLegacyHistogramBase.

◆ loadFromFile()

virtual void loadFromFile ( FILE *  )
overridevirtual

Reads the object data from a file written out by saveToFile() (or written by hand)

Implements cStatistic.

Reimplemented in cLegacyHistogram, cKSplit, cPSquare, cHistogram, cPrecollectionBasedDensityEst, cVarHistogram, and cLegacyHistogramBase.


The documentation for this class was generated from the following file: