OMNeT++ Simulation Library  6.0.3
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 cHistogram cPrecollectionBasedDensityEst cPSquare cKSplit

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
 
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)
 
- 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)
 
- 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
 
- 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)=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 cObjectgetThisPtr () const
 
virtual std::ostream & printOn (std::ostream &os) const
 
virtual bool isSoftOwner () const
 
virtual void forEachChild (cVisitor *v)
 
cObjectfindObject (const char *name, bool deep=true)
 
virtual cClassDescriptorgetDescriptor () const
 
void copyNotSupported () const
 

Additional Inherited Members

- Static Public Member Functions inherited from cOwnedObject
static long getTotalObjectCount ()
 
static long getLiveObjectCount ()
 
static void resetObjectCounters ()
 
static cSoftOwnergetOwningContext ()
 
- 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::operator=() for details.

Referenced by cAbstractHistogram::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 cKSplit, cHistogram, 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 cKSplit, cHistogram, cPrecollectionBasedDensityEst, and cPSquare.

◆ 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 cKSplit, cHistogram, cPrecollectionBasedDensityEst, and cPSquare.

◆ isWeighted()

virtual bool isWeighted ( ) const
inlineoverridevirtual

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

Implements cStatistic.

◆ collect() [1/3]

virtual void collect ( double  value)
overridevirtual

Collects one observation.

Implements cStatistic.

Reimplemented in cHistogram, cPrecollectionBasedDensityEst, and cPSquare.

◆ collectWeighted() [1/5]

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.

◆ 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 cAbstractHistogram, and cPSquare.

◆ clear()

virtual void clear ( )
overridevirtual

Clears the results collected so far.

Implements cStatistic.

Reimplemented in cKSplit, cPSquare, cHistogram, and cPrecollectionBasedDensityEst.

◆ saveToFile()

virtual void saveToFile ( FILE *  ) const
overridevirtual

Writes the contents of the object into a text file.

Implements cStatistic.

Reimplemented in cHistogram, cKSplit, cPSquare, and cPrecollectionBasedDensityEst.

◆ 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 cHistogram, cKSplit, cPSquare, and cPrecollectionBasedDensityEst.

◆ collect() [2/3]

virtual void collect

Collects one value.

◆ collect() [3/3]

virtual void collect
inline

Convenience method, delegates to collect(double).

◆ collectWeighted() [2/5]

virtual void collectWeighted

Collects one value with a given weight.

◆ collectWeighted() [3/5]

virtual void collectWeighted
inline

Convenience method, delegates to collectWeighted(double, double).

◆ collectWeighted() [4/5]

virtual void collectWeighted
inline

Convenience method, delegates to collectWeighted(double, double).

◆ collectWeighted() [5/5]

virtual void collectWeighted
inline

Convenience method, delegates to collectWeighted(double, double).


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