Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgStatisticsBase< VALUE, COUNT > Class Template Reference

#include <SgStatistics.h>

List of all members.


Detailed Description

template<typename VALUE, typename COUNT>
class SgStatisticsBase< VALUE, COUNT >

Computes mean of a statistical variable.

The template parameters are the floating point type and the counter type, depending on the precision-memory tradeoff.

Definition at line 36 of file SgStatistics.h.

Public Member Functions

 SgStatisticsBase ()
 SgStatisticsBase (VALUE val, COUNT count)
 Create statistics initialized with values.
void Add (VALUE val)
void Remove (VALUE val)
void Add (VALUE val, COUNT n)
 Add a value n times.
void Remove (VALUE val, COUNT n)
 Remove a value n times.
void Clear ()
const COUNT & Count () const
void Initialize (VALUE val, COUNT count)
 Initialize with values.
bool IsDefined () const
 Check if the mean value is defined.
const VALUE & Mean () const
void Write (std::ostream &out) const
 Write in human readable format.
void SaveAsText (std::ostream &out) const
 Save in a compact platform-independent text format.
void LoadFromText (std::istream &in)
 Load from text format.

Private Attributes

COUNT m_count
VALUE m_mean


Constructor & Destructor Documentation

template<typename VALUE, typename COUNT>
SgStatisticsBase< VALUE, COUNT >::SgStatisticsBase (  ) 

Definition at line 98 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::Clear().

template<typename VALUE, typename COUNT>
SgStatisticsBase< VALUE, COUNT >::SgStatisticsBase ( VALUE  val,
COUNT  count 
)

Create statistics initialized with values.

Note that value must be initialized to 0 if count is 0. Equivalent to creating a statistics and calling count times Add(val)

Definition at line 104 of file SgStatistics.h.


Member Function Documentation

template<typename VALUE, typename COUNT>
void SgStatisticsBase< VALUE, COUNT >::Add ( VALUE  val,
COUNT  n 
)

Add a value n times.

Definition at line 161 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::m_count, SgStatisticsBase< VALUE, COUNT >::m_mean, and SG_ASSERT.

template<typename VALUE, typename COUNT>
void SgStatisticsBase< VALUE, COUNT >::Add ( VALUE  val  ) 

Definition at line 111 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::m_count, SgStatisticsBase< VALUE, COUNT >::m_mean, and SG_ASSERT.

template<typename VALUE, typename COUNT>
void SgStatisticsBase< VALUE, COUNT >::Clear (  ) 

Definition at line 176 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::m_count, and SgStatisticsBase< VALUE, COUNT >::m_mean.

Referenced by SgStatisticsBase< VALUE, COUNT >::Remove(), and SgStatisticsBase< VALUE, COUNT >::SgStatisticsBase().

template<typename VALUE, typename COUNT>
const COUNT & SgStatisticsBase< VALUE, COUNT >::Count (  )  const

Definition at line 183 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::m_count.

template<typename VALUE, typename COUNT>
void SgStatisticsBase< VALUE, COUNT >::Initialize ( VALUE  val,
COUNT  count 
)

Initialize with values.

Equivalent to calling Clear() and calling count times Add(val)

Definition at line 189 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::m_count, SgStatisticsBase< VALUE, COUNT >::m_mean, and SG_ASSERT.

template<typename VALUE, typename COUNT>
bool SgStatisticsBase< VALUE, COUNT >::IsDefined (  )  const

Check if the mean value is defined.

The mean value is defined, if the count if greater than zero. The result of this function is equivalent to Count() > 0, for integer count types and Count() > epsilon() for floating point count types.

Definition at line 197 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::m_count.

Referenced by SgStatisticsBase< VALUE, COUNT >::Mean(), and SgStatisticsBase< VALUE, COUNT >::Write().

template<typename VALUE, typename COUNT>
void SgStatisticsBase< VALUE, COUNT >::LoadFromText ( std::istream &  in  ) 

Load from text format.

See SaveAsText()

Definition at line 206 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::m_count, and SgStatisticsBase< VALUE, COUNT >::m_mean.

template<typename VALUE, typename COUNT>
const VALUE & SgStatisticsBase< VALUE, COUNT >::Mean (  )  const

Definition at line 212 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::IsDefined(), SgStatisticsBase< VALUE, COUNT >::m_mean, and SG_ASSERT.

Referenced by SgStatisticsBase< VALUE, COUNT >::Write().

template<typename VALUE, typename COUNT>
void SgStatisticsBase< VALUE, COUNT >::Remove ( VALUE  val,
COUNT  n 
)

Remove a value n times.

Definition at line 143 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::Clear(), SgStatisticsBase< VALUE, COUNT >::m_count, SgStatisticsBase< VALUE, COUNT >::m_mean, and SG_ASSERT.

template<typename VALUE, typename COUNT>
void SgStatisticsBase< VALUE, COUNT >::Remove ( VALUE  val  ) 

Definition at line 126 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::Clear(), SgStatisticsBase< VALUE, COUNT >::m_count, and SgStatisticsBase< VALUE, COUNT >::m_mean.

template<typename VALUE, typename COUNT>
void SgStatisticsBase< VALUE, COUNT >::SaveAsText ( std::ostream &  out  )  const

Save in a compact platform-independent text format.

The data is written in a single line, without trailing newline.

Definition at line 228 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::m_count, and SgStatisticsBase< VALUE, COUNT >::m_mean.

template<typename VALUE, typename COUNT>
void SgStatisticsBase< VALUE, COUNT >::Write ( std::ostream &  out  )  const

Write in human readable format.

Definition at line 219 of file SgStatistics.h.

References SgStatisticsBase< VALUE, COUNT >::IsDefined(), and SgStatisticsBase< VALUE, COUNT >::Mean().


Member Data Documentation

template<typename VALUE, typename COUNT>
COUNT SgStatisticsBase< VALUE, COUNT >::m_count [private]

Definition at line 92 of file SgStatistics.h.

Referenced by SgStatisticsBase< VALUE, COUNT >::Add(), SgStatisticsBase< VALUE, COUNT >::Clear(), SgStatisticsBase< VALUE, COUNT >::Count(), SgStatisticsBase< VALUE, COUNT >::Initialize(), SgStatisticsBase< VALUE, COUNT >::IsDefined(), SgStatisticsBase< VALUE, COUNT >::LoadFromText(), SgStatisticsBase< VALUE, COUNT >::Remove(), and SgStatisticsBase< VALUE, COUNT >::SaveAsText().

template<typename VALUE, typename COUNT>
VALUE SgStatisticsBase< VALUE, COUNT >::m_mean [private]

Definition at line 94 of file SgStatistics.h.

Referenced by SgStatisticsBase< VALUE, COUNT >::Add(), SgStatisticsBase< VALUE, COUNT >::Clear(), SgStatisticsBase< VALUE, COUNT >::Initialize(), SgStatisticsBase< VALUE, COUNT >::LoadFromText(), SgStatisticsBase< VALUE, COUNT >::Mean(), SgStatisticsBase< VALUE, COUNT >::Remove(), and SgStatisticsBase< VALUE, COUNT >::SaveAsText().


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


17 Jun 2010 Doxygen 1.4.7