- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# cWeightedStdDev Class Reference
[Statistical data collection]

`#include <cstat.h>`

Inheritance diagram for cWeightedStdDev:

List of all members.

## Detailed Description

Statistics class to collect doubles and calculate weighted statistics of them.

It can be used for example to calculate time average.

## Public Member Functions
Constructors, destructor, assignment.
| cWeightedStdDev (const cWeightedStdDev &r)
| cWeightedStdDev (const char *name=NULL)
virtual | ~cWeightedStdDev ()
cWeightedStdDev & | operator= (const cWeightedStdDev &res)
Redefined cObject member functions.
virtual cPolymorphic * | dup () const
virtual void | netPack (cCommBuffer *buffer)
virtual void | netUnpack (cCommBuffer *buffer)
Redefined cStatistic functions.
virtual void | collect (double val)
virtual void | collect2 (double val, double weight)
virtual void | clearResult ()
virtual double | weights () const
virtual double | mean () const
virtual double | variance () const
virtual void | saveToFile (FILE *) const
virtual void | loadFromFile (FILE *)

## Constructor & Destructor Documentation

cWeightedStdDev::cWeightedStdDev | ( | const cWeightedStdDev & | r | ) | `[inline]`

| Constructors, destructor, duplication and assignment.

cWeightedStdDev::cWeightedStdDev | ( | const char * | name = `NULL` | ) | `[inline, explicit]`

| Constructors, destructor, duplication and assignment.

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

| Constructors, destructor, duplication and assignment.

## Member Function Documentation

virtual void cWeightedStdDev::clearResult | ( |  | ) | `[virtual]`

| Clears the results collected so far. Reimplemented from cStdDev.

virtual void cWeightedStdDev::collect | ( | double | val | ) | `[inline, virtual]`

| Collects one value. Reimplemented from cStdDev.

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

| Collects one value with a given weight. Reimplemented from cStatistic.

virtual cPolymorphic* cWeightedStdDev::dup | ( |  | ) | const`[inline, virtual]`

| Creates and returns an exact copy of this object. See cObject for more details. Reimplemented from cStdDev.

virtual void cWeightedStdDev::loadFromFile | ( | FILE * |  | ) | `[virtual]`

| Reads the object data from a file, in the format written out by saveToFile(). Reimplemented from cStdDev.

virtual double cWeightedStdDev::mean | ( |  | ) | const`[inline, virtual]`

| Returns the mean of the samples collected. Reimplemented from cStdDev.

virtual void cWeightedStdDev::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 cStdDev.

virtual void cWeightedStdDev::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 cStdDev.

cWeightedStdDev& cWeightedStdDev::operator= | ( | const cWeightedStdDev & | res | ) |

| Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details.

virtual void cWeightedStdDev::saveToFile | ( | FILE * |  | ) | const`[virtual]`

| Writes the contents of the object into a text file. Reimplemented from cStdDev.

virtual double cWeightedStdDev::variance | ( |  | ) | const`[virtual]`

| Returns the variance of the samples collected. Reimplemented from cStdDev.

virtual double cWeightedStdDev::weights | ( |  | ) | const`[inline, virtual]`

| Returns the sum of weights of the samples collected. Reimplemented from cStdDev.

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

- cstat.h