Main Page Modules Class Hierarchy Compound List File List Compound Members

# cStatistic Class Reference

`#include <cstat.h>`

Inheritance diagram for cStatistic::

List of all members.

## Public Methods
Constructors, destructor, assignment.
| cStatistic (const cStatistic &r)
| cStatistic (const char *name=NULL)
virtual | ~cStatistic ()
cStatistic& | operator= (const cStatistic &res)
Redefined cObject member functions.
virtual int | netPack ()
virtual int | netUnpack ()
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)
cTransientDetection* | transientDetectionObject () const
cAccuracyDetection* | accuracyDetectionObject () 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.
virtual void | saveToFile (FILE *) const=0
virtual void | loadFromFile (FILE *)=0

## 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.

## 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

cStatistic::~cStatistic ( | )`[inline, virtual]`

| The destructor does nothing.

## 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.

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. Reimplemented in cDensityEstBase, cHistogramBase, cStdDev, cWeightedStdDev, and cVarHistogram.

void cStatistic::collect ( | double val )`[pure virtual]`

| Collects one value. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cDensityEstBase, cLongHistogram, cStdDev, and cWeightedStdDev.

void cStatistic::collect2 ( | double val,
| double weight )`[virtual]`

| Collects one value with a given weight. Reimplemented in cWeightedStdDev.

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. Reimplemented in cDensityEstBase, cHistogramBase, cEqdHistogramBase, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram.

double cStatistic::max ( | ) const`[pure virtual]`

| Returns the maximum of the samples collected. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cStdDev.

double cStatistic::mean ( | ) const`[pure virtual]`

| Returns the mean of the samples collected. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cStdDev, and cWeightedStdDev.

double cStatistic::min ( | ) const`[pure virtual]`

| Returns the minimum of the samples collected. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cStdDev.

int cStatistic::netPack ( | )`[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, cLongHistogram, cDoubleHistogram, cKSplit, cPSquare, cStdDev, cWeightedStdDev, and cVarHistogram.

int cStatistic::netUnpack ( | )`[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, cLongHistogram, cDoubleHistogram, 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.

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. Reimplemented in cDensityEstBase, cLongHistogram, cDoubleHistogram, cKSplit, cPSquare, cStdDev, and cVarHistogram.

long cStatistic::samples ( | ) const`[pure virtual]`

| Returns the number of samples collected. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cStdDev.

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. Reimplemented 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.

double cStatistic::sqrSum ( | ) const`[pure virtual]`

| Returns the squared sum of the collected data. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cStdDev.

double cStatistic::stddev ( | ) const`[pure virtual]`

| Returns the standard deviation of the samples collected. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cStdDev.

double cStatistic::sum ( | ) const`[pure virtual]`

| Returns the sum of samples collected. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cStdDev.

cTransientDetection * cStatistic::transientDetectionObject ( | ) const`[inline]`

| Returns the assigned transient and accuracy detection objects.

double cStatistic::variance ( | ) const`[pure virtual]`

| Returns the variance of the samples collected. This method is pure virtual, implementation is provided in subclasses. Reimplemented in cStdDev, and cWeightedStdDev.

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. Reimplemented in cStdDev, and cWeightedStdDev.

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

- cstat.h