94 typedef list< StatHandlerBase* >::const_iterator
stat_it;
96 typedef list< StatRecBase* >::const_iterator
rec_it;
104 virtual bool init ( );
110 void set (
string& str,
unsigned int occ)
189 double* new_record =
new double[size];
191 memcpy(new_record, values, size*
sizeof(
double));
214 virtual void reset ( );
Service handler (an observer).
Definition: handler.h:36
Interface for the simulation services (files and stats).
Definition: service.h:43
Interface to all basic components of a simulation (traits, life cycle events, pop,...
Definition: simcomponent.h:45
Base class of the StatHandler class, implements the Handler interface.
Definition: stathandler.h:48
The Service class used to manage the StatHandler objects.
Definition: statservices.h:50
virtual void load(SimComponent *sc)
tell the SimComponent to load its stat handlers
Definition: statservices.cc:170
void setFieldPrecision(unsigned int val)
Definition: statservices.h:157
void setDefaultOutputFormat()
Definition: statservices.h:161
void setOcccurrence(unsigned int value)
Definition: statservices.h:120
Metapop * _popPtr
Definition: statservices.h:54
void cancelPrintAverages()
Definition: statservices.h:143
unsigned int getNumOccurrences()
Returns the maximum number of generation records per replicate.
Definition: statservices.h:126
void resetCurrentOccurrence()
Resets the occurrence iterator to the beginning of the list of generation occurrences.
Definition: statservices.h:138
unsigned char _separator
Definition: statservices.h:88
list< unsignedint >::const_iterator _current_occurrence
Iterator pointing to the current generation to record.
Definition: statservices.h:83
virtual bool init()
Definition: statservices.cc:47
void set(string &str, unsigned int occ)
Definition: statservices.h:110
unsigned int getNumOccurrences(unsigned int replicate)
Returns the number of generation records present in the stat table for a replicate.
Definition: statservices.h:131
unsigned int _occurrence
Deprecated.
Definition: statservices.h:75
list< unsigned int > _occurrences
List of all generations to record.
Definition: statservices.h:78
unsigned int _width
Definition: statservices.h:86
vector< double * > * getReplicateStatRecords(unsigned int replicate)
Definition: statservices.h:172
vector< vector< double * > > _statValues
Table containing all recorded stats, replicate x generation x (num recorders + 2) .
Definition: statservices.h:66
StatServices()
Definition: statservices.h:98
string _statArg
The string argument of the 'stat' input option.
Definition: statservices.h:72
void copyGenerationStatValues(unsigned int replicate, unsigned int occurence, double *values, unsigned int size)
Definition: statservices.h:183
void reset_stat_table()
Deletes the stat tables.
Definition: statservices.cc:231
void doPrintAverages()
Definition: statservices.h:142
void set_pop_ptr(Metapop *pop)
Definition: statservices.h:108
double * getGenerationStatValues(unsigned int replicate, unsigned int occurence) const
Definition: statservices.h:177
unsigned int getCurrentOccurrence()
Returns the last generation recorded for current replicate.
Definition: statservices.h:136
void setStatOptions(string &str)
Definition: statservices.h:113
unsigned int _precision
Definition: statservices.h:86
unsigned int _numRecorders
Number of stats to record.
Definition: statservices.h:63
void setFieldSeparator(unsigned char c)
Definition: statservices.h:159
list< StatRecBase * > _statRecorders
List of stat recorders.
Definition: statservices.h:60
Metapop * get_pop_ptr()
Definition: statservices.h:106
void recordStats(unsigned int gen)
record stat values in stat table by calling all stat recorders.
Definition: statservices.cc:246
virtual void notify()
Definition: statservices.cc:188
virtual void reset()
clear the list of StatHandler
Definition: statservices.cc:208
virtual void attach(Handler *H)
attach the StatHandler to the current list (_statHandlers) of the StatServices
Definition: statservices.cc:177
void setFieldWidth(unsigned int val)
Definition: statservices.h:155
stat_it getFirst()
Definition: statservices.h:168
void setOccurrences(map< unsigned int, unsigned int > timeTable)
Sets the list of generation for which statistics must be recorded during a run.
Definition: statservices.cc:121
void printStatHeaders(ofstream &FH)
Definition: statservices.cc:271
unsigned int getOccurrence()
Definition: statservices.h:118
string & getStatArg()
Definition: statservices.h:115
bool getPrintAveragesOpt()
Definition: statservices.h:144
virtual ~StatServices()
Definition: statservices.h:102
list< StatHandlerBase * > _statHandlers
List of stat handlers declared by currently active simulation components.
Definition: statservices.h:57
void setCompactOutputFormat()
Definition: statservices.h:153
list< StatRecBase * >::const_iterator rec_it
Definition: statservices.h:96
void printStatAverage(ofstream &FH)
Definition: statservices.cc:328
unsigned int getNumStats()
Definition: statservices.h:166
list< StatHandlerBase * >::const_iterator stat_it
Definition: statservices.h:94
void printStatValue(ofstream &FH, unsigned int repl_idx)
Prints the stat values to the '.txt' output file.
Definition: statservices.cc:280
bool _printAverages
Definition: statservices.h:90
stat_it getLast()
Definition: statservices.h:170
list< StatRecBase * > getAllStats()
Definition: statservices.cc:389
double * _currentStatValues
Pointer to the last recorded stats.
Definition: statservices.h:69