cStatistic Class Reference
[Statistical data collection]

#include <cstat.h>

Inheritance diagram for cStatistic:

cObject cPolymorphic cStdDev cDensityEstBase cWeightedStdDev cHistogramBase cKSplit cPSquare cEqdHistogramBase cVarHistogram cDoubleHistogram cLongHistogram List of all members.

Detailed Description

Base class of different statistic collecting classes.

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 ()
cStatisticoperator= (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)
cTransientDetectiontransientDetectionObject () const
cAccuracyDetectionaccuracyDetectionObject () 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)


Constructor & Destructor Documentation

cStatistic::cStatistic const cStatistic r  ) 
 

Copy constructor.

cStatistic::cStatistic const char *  name = NULL  )  [explicit]
 

Constructor, creates an object with the given name.

virtual cStatistic::~cStatistic  )  [virtual]
 

Destructor.


Member Function Documentation

cAccuracyDetection* cStatistic::accuracyDetectionObject  )  const [inline]
 

Returns the assigned transient and accuracy detection objects.

void cStatistic::addAccuracyDetection cAccuracyDetection object  ) 
 

Assigns transient and accuracy detection objects to the statistic object.

void cStatistic::addTransientDetection cTransientDetection object  ) 
 

Assigns transient and accuracy detection objects to the statistic object.

virtual void cStatistic::clearResult  )  [pure virtual]
 

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.

virtual void cStatistic::collect double  val  )  [pure virtual]
 

Collects one value.

This method is pure virtual, implementation is provided in subclasses.

Implemented in cDensityEstBase, cLongHistogram, cStdDev, and cWeightedStdDev.

virtual void cStatistic::collect2 double  val,
double  weight
[virtual]
 

Collects one value with a given weight.

Reimplemented in cWeightedStdDev.

virtual void cStatistic::loadFromFile FILE *   )  [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 cDensityEstBase, cHistogramBase, cEqdHistogramBase, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram.

virtual double cStatistic::max  )  const [pure virtual]
 

Returns the maximum of the samples collected.

This method is pure virtual, implementation is provided in subclasses.

Implemented in cStdDev.

virtual double cStatistic::mean  )  const [pure virtual]
 

Returns the mean of the samples collected.

This method is pure virtual, implementation is provided in subclasses.

Implemented in cStdDev, and cWeightedStdDev.

virtual double cStatistic::min  )  const [pure virtual]
 

Returns the minimum of the samples collected.

This method is pure virtual, implementation is provided in subclasses.

Implemented in cStdDev.

virtual void cStatistic::netPack cCommBuffer buffer  )  [virtual]
 

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.

virtual void cStatistic::netUnpack cCommBuffer buffer  )  [virtual]
 

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.

void cStatistic::operator+= double  val  )  [inline]
 

Same as the collect(double) method.

cStatistic& cStatistic::operator= const cStatistic res  ) 
 

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.

virtual double cStatistic::random  )  const [pure virtual]
 

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.

virtual void cStatistic::recordScalar const char *  name = NULL  )  [virtual]
 

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.

virtual long cStatistic::samples  )  const [pure virtual]
 

Returns the number of samples collected.

This method is pure virtual, implementation is provided in subclasses.

Implemented in cStdDev.

virtual void cStatistic::saveToFile FILE *   )  const [pure virtual]
 

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.

void cStatistic::setGenK int  gen_nr  )  [inline]
 

Sets the index of the random number generator to use when the object has to generate a random number based on the statistics stored.

virtual double cStatistic::sqrSum  )  const [pure virtual]
 

Returns the squared sum of the collected data.

This method is pure virtual, implementation is provided in subclasses.

Implemented in cStdDev.

virtual double cStatistic::stddev  )  const [pure virtual]
 

Returns the standard deviation of the samples collected.

This method is pure virtual, implementation is provided in subclasses.

Implemented in cStdDev.

virtual double cStatistic::sum  )  const [pure virtual]
 

Returns the sum of samples collected.

This method is pure virtual, implementation is provided in subclasses.

Implemented in cStdDev.

cTransientDetection* cStatistic::transientDetectionObject  )  const [inline]
 

Returns the assigned transient and accuracy detection objects.

virtual double cStatistic::variance  )  const [pure virtual]
 

Returns the variance of the samples collected.

This method is pure virtual, implementation is provided in subclasses.

Implemented in cStdDev, and cWeightedStdDev.

virtual double cStatistic::weights  )  const [pure virtual]
 

Returns the sum of weights of the samples collected.

This method is pure virtual, implementation is provided in subclasses.

Implemented in cStdDev, and cWeightedStdDev.


The documentation for this class was generated from the following file:
Generated on Sat Oct 21 17:47:57 2006 for OMNeT++/OMNEST Simulation Library by  doxygen 1.4.6