28 #ifndef __STAT_REC_H__
29 #define __STAT_REC_H__
64 void set (std::string T, std::string N,
age_t AGE,
65 unsigned int ARG1,
unsigned int ARG2)
123 void set(std::string T, std::string N,
age_t AGE,
unsigned int ARG1,
unsigned int ARG2,
124 double (S::* getNoArg)(
void),
double(S::* getOneArg)(
unsigned int),
125 double(S::* getTwoArg)(
unsigned int,
unsigned int),
void(S::* setStat)(
void));
147 double (S::* getNoArg) (
void),
148 double (S::* getOneArg)(
unsigned int),
149 double (S::* getTwoArg)(
unsigned int,
unsigned int),
150 void (S::* setStat) (
void) )
155 _getStatOneArg = getOneArg;
156 _getStatTwoArg = getTwoArg;
164 double statValue = 0;
168 message(
" %s",getName().c_str());
171 if(_setStat != 0) (_myHandler->*_setStat)();
176 statValue = (_myHandler->*_getStat)();
178 else if(_getStatOneArg != 0)
180 statValue = (_myHandler->*_getStatOneArg)(getArg1());
182 else if(_getStatTwoArg != 0)
184 statValue = (_myHandler->*_getStatTwoArg)(getArg1(), getArg2());
188 fatal(
"StatRecorder \"%s\" has no _getStat funct ptr !!\n", getName().c_str());
Base class for the StatRecorder's, declares the interface to record stat values.
Definition: statrecorder.h:37
unsigned int _arg2
Definition: statrecorder.h:46
virtual ~StatRecBase()
Definition: statrecorder.h:55
age_t getAge()
Definition: statrecorder.h:79
void set(std::string T, std::string N, age_t AGE, unsigned int ARG1, unsigned int ARG2)
Sets the recorder attributes.
Definition: statrecorder.h:64
age_t _age
The age class for which this stat applies.
Definition: statrecorder.h:48
unsigned int getArg2()
Definition: statrecorder.h:81
unsigned int getArg1()
Definition: statrecorder.h:80
std::string _title
The title of the stat recorder, longer and more explicite than the name.
Definition: statrecorder.h:41
std::string getName()
Definition: statrecorder.h:78
void setName(std::string N)
Definition: statrecorder.h:76
virtual double setVal(age_t AGE)=0
Stores the value in the vector following the ordering option.
std::string getTitle()
Definition: statrecorder.h:77
std::string _name
Name of the stat, should be short (20 char) and R compliant (no '-', '+', ' ')
Definition: statrecorder.h:43
StatRecBase()
Definition: statrecorder.h:52
unsigned int _arg1
A argument to be passed to one of the function variable stored in the StatRecorder structure.
Definition: statrecorder.h:45
Stores the pointers to the StatHandler's stat functions.
Definition: statrecorder.h:92
StatRecorder()
Definition: statrecorder.h:109
void setHandler(S *theHandler)
Sets the pointer to the StatHandler that owns this recorder.
Definition: statrecorder.h:128
double(S::* _getStat)(void)
Pointer to a 'stat getter' function of S using no argument.
Definition: statrecorder.h:95
double(S::* _getStatOneArg)(unsigned int)
Pointer to a 'stat getter' function of S using a single unsigned int argument.
Definition: statrecorder.h:97
void(S::* _setStat)(void)
Pointer to a 'stat setter' function of S using no argument.
Definition: statrecorder.h:103
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:144
virtual double setVal(age_t AGE)
Calls the linked stat function and returns the result.
Definition: statrecorder.h:162
double(S::* _getStatTwoArg)(unsigned int, unsigned int)
Pointer to a 'stat getter' function of S using two unsigned int arguments.
Definition: statrecorder.h:99
S * _myHandler
Pointer to the owner of this recorder.
Definition: statrecorder.h:105
void fatal(const char *str,...)
Definition: output.cc:99
void message(const char *message,...)
Definition: output.cc:39
#define ALL
All ages age class flag.
Definition: types.h:55
unsigned int age_t
Age class flags.
Definition: types.h:45