Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Public Member Functions | Private Attributes

SgStatisticsVltBase< VALUE, COUNT > Class Template Reference

Specialized version of SgStatisticsBase for volatile member variables. More...

#include <SgStatisticsVlt.h>

List of all members.

Public Member Functions

 SgStatisticsVltBase ()
 SgStatisticsVltBase (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 ()
COUNT Count () const
void Initialize (VALUE val, COUNT count)
 Initialize with values.
bool IsDefined () const
 Check if the mean value is defined.
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

volatile COUNT m_count
volatile VALUE m_mean

Detailed Description

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

Specialized version of SgStatisticsBase for volatile member variables.

See also:
SgStatisticsVlt.h SgStatisticsBase

Definition at line 32 of file SgStatisticsVlt.h.


Constructor & Destructor Documentation

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

Definition at line 89 of file SgStatisticsVlt.h.

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

template<typename VALUE, typename COUNT>
SgStatisticsVltBase< VALUE, COUNT >::SgStatisticsVltBase ( 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 95 of file SgStatisticsVlt.h.


Member Function Documentation

template<typename VALUE, typename COUNT >
void SgStatisticsVltBase< VALUE, COUNT >::Add ( VALUE  val  ) 
template<typename VALUE, typename COUNT>
void SgStatisticsVltBase< VALUE, COUNT >::Add ( VALUE  val,
COUNT  n 
)
template<typename VALUE , typename COUNT >
void SgStatisticsVltBase< VALUE, COUNT >::Clear (  ) 
template<typename VALUE , typename COUNT >
COUNT SgStatisticsVltBase< VALUE, COUNT >::Count (  )  const
template<typename VALUE, typename COUNT>
void SgStatisticsVltBase< VALUE, COUNT >::Initialize ( VALUE  val,
COUNT  count 
)

Initialize with values.

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

Definition at line 179 of file SgStatisticsVlt.h.

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

Referenced by SgUctNode::InitializeRaveValue(), and SgUctNode::InitializeValue().

template<typename VALUE , typename COUNT >
bool SgStatisticsVltBase< 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 187 of file SgStatisticsVlt.h.

References SgStatisticsVltBase< VALUE, COUNT >::m_count.

Referenced by SgUctNode::HasMean(), SgUctNode::HasRaveValue(), SgStatisticsVltBase< VALUE, COUNT >::Mean(), SgUctNode::MergeResults(), and SgStatisticsVltBase< VALUE, COUNT >::Write().

template<typename VALUE , typename COUNT >
void SgStatisticsVltBase< VALUE, COUNT >::LoadFromText ( std::istream &  in  ) 
template<typename VALUE , typename COUNT >
VALUE SgStatisticsVltBase< VALUE, COUNT >::Mean (  )  const
template<typename VALUE, typename COUNT >
void SgStatisticsVltBase< VALUE, COUNT >::Remove ( VALUE  val  ) 
template<typename VALUE, typename COUNT>
void SgStatisticsVltBase< VALUE, COUNT >::Remove ( VALUE  val,
COUNT  n 
)
template<typename VALUE , typename COUNT >
void SgStatisticsVltBase< 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 218 of file SgStatisticsVlt.h.

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

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

Write in human readable format.

Definition at line 209 of file SgStatisticsVlt.h.

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


Member Data Documentation

template<typename VALUE, typename COUNT>
volatile COUNT SgStatisticsVltBase< VALUE, COUNT >::m_count [private]
template<typename VALUE, typename COUNT>
volatile VALUE SgStatisticsVltBase< VALUE, COUNT >::m_mean [private]

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


Sun Mar 13 2011 Doxygen 1.7.1