template<class SH>
class StatHandler< SH >
A class to compute and store the summary statistics associated with a SimComponent.
The template type must be the type of the class that declares the methods linked into the StatRecorder elements.
template<class SH >
virtual StatRecorder< SH > * StatHandler< SH >::add |
( |
std::string |
Title, |
|
|
std::string |
Name, |
|
|
age_t |
AGE, |
|
|
unsigned int |
ARG1, |
|
|
unsigned int |
ARG2, |
|
|
double(SH::*)(void) |
getStatNoArg, |
|
|
double(SH::*)(unsigned int) |
getStatOneArg, |
|
|
double(SH::*)(unsigned int, unsigned int) |
getStatTwoArg, |
|
|
void(SH::*)(void) |
setStat |
|
) |
| |
|
inlinevirtual |
Adds a StatRecorder to the list, it is also added to the StatHandlerBase::_stats list.
Two types of function variables are passed to this function. The "getter" and "setter". A "getter" returns a double value that will be stored in the StatRecorder structure. It may or may not take an argument. Only one getter should be passed to the stat recorder. The setter is used to set variables in the SH class which are then read by the getter. A setter and a getter may be given together but a setter alone will issue an error at runtime as no getter is present in the stat recorder.
- Parameters
-
Title | the stat title (as shown in the R frontend fro eg.) |
Name | the stat name (headers in the stat output file) |
AGE | the age class for which the stat will be recorded |
ARG1 | the first argument to pass to the SH function |
ARG2 | the second argument to pass to the SH function |
getStatNoArg | function ptr to a SH getter that takes no argument |
getStatOneArg | function ptr to a SH getter with a single integer argument |
getStatTwoArg | function ptr to a SH getter with two integer arguments |
setStat | function ptr to a SH setter |
147 {
149
150 new_rec->
set(Title, Name, AGE, ARG1, ARG2,
151 getStatNoArg, getStatOneArg, getStatTwoArg, setStat);
152
153 new_rec->
setHandler(
dynamic_cast<SH*
> (
this));
154
156
158
159 return new_rec;
160 }
virtual void add(StatRecBase *rec)
Definition: stathandler.h:87
std::list< StatRecorder< SH > * > _recorders
The list of stat recorders.
Definition: stathandler.h:114
Stores the pointers to the StatHandler's stat functions.
Definition: statrecorder.h:93
void setHandler(S *theHandler)
Sets the pointer to the StatHandler that owns this recorder.
Definition: statrecorder.h:129
void set(std::string T, std::string N, age_t AGE, unsigned int ARG1, unsigned int ARG2, double(S::*getNoArg)(void), double(S::*getOneArg)(unsigned int), double(S::*getTwoArg)(unsigned int, unsigned int), void(S::*setStat)(void))
Sets the recorder attributes.
Definition: statrecorder.h:145
References StatHandler< SH >::_recorders, StatHandlerBase::add(), StatRecorder< S >::set(), and StatRecorder< S >::setHandler().
Referenced by TTQuantiSH::addAvgPerPatch(), TTQuantiSH::addCovarPerPatch(), TTQuantiSH::addEigen(), TTQuantiSH::addEigenPerPatch(), TTQuantiSH::addEigenValues(), TTQuantiSH::addEigenValuesPerPatch(), TTQuantiSH::addEigenVect1(), TTQuantiSH::addEigenVect1PerPatch(), LCE_SelectionSH::addMeanPerPatch(), TTQuantiSH::addQuanti(), TTQuantiSH::addSkewPerPatch(), TTBDMI_SH::addStats(), LCE_SelectionSH::addVarPerPatch(), TTQuantiSH::addVarPerPatch(), TTNeutralGenesSH::setCoaMatrixRecorders(), TTNeutralGenesSH::setDxyRecorders(), TTNeutralGenesSH::setFreqRecorders(), TTNeutralGenesSH::setFstat2Recorders(), TTNeutralGenesSH::setFstatRecorders(), TTNeutralGenesSH::setFstatWCRecorders(), TTNeutralGenesSH::setFstMatrixRecorders(), TTNeutralGenesSH::setNeiGeneticDistanceRecorders(), TTDeletMutBitstrSH::setStatRecorders(), TTNeutralGenesSH::setStatRecorders(), LCE_SelectionSH::setStatRecorders(), TTWolbachiaSH::setStatRecorders(), TTDeletMutBitstrSH::setStatsForDeletMutations(), and TTDeletMutBitstrSH::setViabStats().