Specialized version of SgStatisticsBase for volatile member variables. More...
#include <SgStatisticsVlt.h>
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 |
Specialized version of SgStatisticsBase for volatile member variables.
Definition at line 32 of file SgStatisticsVlt.h.
SgStatisticsVltBase< VALUE, COUNT >::SgStatisticsVltBase | ( | ) |
Definition at line 89 of file SgStatisticsVlt.h.
References SgStatisticsVltBase< VALUE, COUNT >::Clear().
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.
void SgStatisticsVltBase< VALUE, COUNT >::Add | ( | VALUE | val | ) |
Definition at line 102 of file SgStatisticsVlt.h.
References SgStatisticsVltBase< VALUE, COUNT >::m_count, SgStatisticsVltBase< VALUE, COUNT >::m_mean, and SG_ASSERT.
Referenced by SgUctNode::AddGameResult(), SgUctNode::AddGameResults(), SgUctNode::AddRaveValue(), and SgUctNode::MergeResults().
void SgStatisticsVltBase< VALUE, COUNT >::Add | ( | VALUE | val, | |
COUNT | n | |||
) |
Add a value n times.
Definition at line 151 of file SgStatisticsVlt.h.
References SgStatisticsVltBase< VALUE, COUNT >::m_count, SgStatisticsVltBase< VALUE, COUNT >::m_mean, and SG_ASSERT.
void SgStatisticsVltBase< VALUE, COUNT >::Clear | ( | ) |
Definition at line 166 of file SgStatisticsVlt.h.
References SgStatisticsVltBase< VALUE, COUNT >::m_count, and SgStatisticsVltBase< VALUE, COUNT >::m_mean.
Referenced by SgStatisticsVltBase< VALUE, COUNT >::Remove(), and SgStatisticsVltBase< VALUE, COUNT >::SgStatisticsVltBase().
COUNT SgStatisticsVltBase< VALUE, COUNT >::Count | ( | ) | const |
Definition at line 173 of file SgStatisticsVlt.h.
References SgStatisticsVltBase< VALUE, COUNT >::m_count.
Referenced by SgUctNode::MergeResults(), SgUctNode::MoveCount(), and SgUctNode::RaveCount().
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().
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().
void SgStatisticsVltBase< VALUE, COUNT >::LoadFromText | ( | std::istream & | in | ) |
Load from text format.
See SaveAsText()
Definition at line 196 of file SgStatisticsVlt.h.
References SgStatisticsVltBase< VALUE, COUNT >::m_count, and SgStatisticsVltBase< VALUE, COUNT >::m_mean.
VALUE SgStatisticsVltBase< VALUE, COUNT >::Mean | ( | ) | const |
Definition at line 202 of file SgStatisticsVlt.h.
References SgStatisticsVltBase< VALUE, COUNT >::IsDefined(), SgStatisticsVltBase< VALUE, COUNT >::m_mean, and SG_ASSERT.
Referenced by SgUctNode::Mean(), SgUctNode::MergeResults(), SgUctNode::RaveValue(), and SgStatisticsVltBase< VALUE, COUNT >::Write().
void SgStatisticsVltBase< VALUE, COUNT >::Remove | ( | VALUE | val | ) |
Definition at line 117 of file SgStatisticsVlt.h.
References SgStatisticsVltBase< VALUE, COUNT >::Clear(), SgStatisticsVltBase< VALUE, COUNT >::m_count, and SgStatisticsVltBase< VALUE, COUNT >::m_mean.
Referenced by SgUctNode::RemoveGameResult(), SgUctNode::RemoveGameResults(), and SgUctNode::RemoveRaveValue().
void SgStatisticsVltBase< VALUE, COUNT >::Remove | ( | VALUE | val, | |
COUNT | n | |||
) |
Remove a value n times.
Definition at line 134 of file SgStatisticsVlt.h.
References SgStatisticsVltBase< VALUE, COUNT >::Clear(), SgStatisticsVltBase< VALUE, COUNT >::m_count, and SgStatisticsVltBase< VALUE, COUNT >::m_mean.
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.
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().
volatile COUNT SgStatisticsVltBase< VALUE, COUNT >::m_count [private] |
Definition at line 83 of file SgStatisticsVlt.h.
Referenced by SgStatisticsVltBase< VALUE, COUNT >::Add(), SgStatisticsVltBase< VALUE, COUNT >::Clear(), SgStatisticsVltBase< VALUE, COUNT >::Count(), SgStatisticsVltBase< VALUE, COUNT >::Initialize(), SgStatisticsVltBase< VALUE, COUNT >::IsDefined(), SgStatisticsVltBase< VALUE, COUNT >::LoadFromText(), SgStatisticsVltBase< VALUE, COUNT >::Remove(), and SgStatisticsVltBase< VALUE, COUNT >::SaveAsText().
volatile VALUE SgStatisticsVltBase< VALUE, COUNT >::m_mean [private] |
Definition at line 85 of file SgStatisticsVlt.h.
Referenced by SgStatisticsVltBase< VALUE, COUNT >::Add(), SgStatisticsVltBase< VALUE, COUNT >::Clear(), SgStatisticsVltBase< VALUE, COUNT >::Initialize(), SgStatisticsVltBase< VALUE, COUNT >::LoadFromText(), SgStatisticsVltBase< VALUE, COUNT >::Mean(), SgStatisticsVltBase< VALUE, COUNT >::Remove(), and SgStatisticsVltBase< VALUE, COUNT >::SaveAsText().