93 typedef std::list< FileHandler* >::const_iterator
file_it;
99 virtual bool init ( ) {
return false;}
107 bool init (list< ParamSet* >& params);
194 virtual void reset ( );
File Handler used to save the simulation parameters to a log file.
Definition: filehandler.h:272
Interface to handle file input/output for any SimComponent.
Definition: filehandler.h:53
A class to manage the files associated with each components of the simulation.
Definition: fileservices.h:52
string getGenerationCounter()
Accessor to the current generation counter string.
Definition: fileservices.cc:425
string & getReplicateFileName()
Accessor to the current replicate file name.
Definition: fileservices.cc:381
int _sampled_at_replicate
Definition: fileservices.h:87
void setBasename(string name)
Sets the base file name of the simulation.
Definition: fileservices.cc:438
Metapop * _sample_pop
Definition: fileservices.h:89
unsigned int _patch_sample_size
Number of individuals to sample from each patch for the file handlers.
Definition: fileservices.h:83
FileHandler * getReader(string &type)
Accessor to a specific file handler specified by its extension string.
Definition: fileservices.cc:456
virtual void notify()
Definition: fileservices.cc:188
string _basename
the base file name of the simulation, read from the init file (param "filename")
Definition: fileservices.h:70
void set_sampling_params(unsigned int size, age_t age)
Set the population sampling params.
Definition: fileservices.h:117
unsigned int _mode
File mode, sets behavior when file must be overwritten or not.
Definition: fileservices.h:80
list< ParamSet * > _params
the list of the parameters of the current simulation.
Definition: fileservices.h:77
list< FileHandler * > _writers
the list of the FileHandler's registered by the SimComponent in output mode
Definition: fileservices.h:61
Metapop * getSampledPop()
Sets the down-sampled population and provides accessor to file handlers.
Definition: fileservices.cc:197
file_it getFirstReader()
Accessor to first element of the list of input FileHandlers.
Definition: fileservices.h:147
void log(string message)
Write to the parameter logfile.
Definition: fileservices.cc:359
void setMode(unsigned int m)
Mode setter, determines if file will get overwritten or not.
Definition: fileservices.h:120
string getGenerationReplicateFileName()
Accessor to the current file name with generation and replicate counters added.
Definition: fileservices.cc:390
string _rep_filename
the file name associated with the current simulation replicate
Definition: fileservices.h:67
string & getFirstReplicateFileName()
Accessor to the first replicate file name.
Definition: fileservices.cc:366
string getReplicateCounter()
Accessor to the current replicate counter string.
Definition: fileservices.cc:412
virtual void attach_reader(FileHandler *FH)
Attaches the FileHandler to the current list (_readers) of the FileServices.
Definition: fileservices.cc:73
file_it getFirstWriter()
Accessor to first element of the list of output FileHandlers.
Definition: fileservices.h:141
age_t _patch_sample_age
Definition: fileservices.h:85
list< ParamSet * > & get_params()
Accessor to the list of the current parameters of the simulation.
Definition: fileservices.h:138
file_it getLastWriter()
Accessor to last element of the list of output FileHandlers.
Definition: fileservices.h:144
void subSamplePatch(sex_t SEX, age_idx AGE, Patch *source_patch, Patch *patch)
Definition: fileservices.cc:310
std::list< FileHandler * >::const_iterator file_it
Definition: fileservices.h:93
FHLogWriter * _logWriter
a FileHandler used to save the simulation parameters on disk.
Definition: fileservices.h:58
string & getRootDir()
Accessor to the name of the simulation's root output directory.
Definition: fileservices.cc:405
file_it getLastReader()
Accessor to last element of the list of input FileHandlers.
Definition: fileservices.h:150
void setRootDir(string name)
Sets the root directory of the simulation.
Definition: fileservices.cc:445
unsigned int getMode()
Writting mode getter.
Definition: fileservices.h:123
FileServices()
Definition: fileservices.cc:46
string & getBaseFileName()
Accessor to the base file name of the simulation.
Definition: fileservices.cc:398
Metapop * _popPtr
a pointer to the current Metapop
Definition: fileservices.h:56
list< FileHandler * > _readers
the list of the FileHandler's registered by the SimComponent in input mode
Definition: fileservices.h:64
virtual void set_pop_ptr(Metapop *pop)
Sets the Metapop reference.
Definition: fileservices.h:114
virtual bool init()
Definition: fileservices.h:99
int _sampled_at_generation
Definition: fileservices.h:87
string _root_dir
the root directory for the simulation's results, read from the init file (param "root_dir")
Definition: fileservices.h:73
virtual void load(SimComponent *sc)
Tells the SimComponent to load its file handlers.
Definition: fileservices.cc:81
virtual void attach(Handler *FH)
Attaches the FileHandler to the current list (_writers) of the FileServices.
Definition: fileservices.cc:60
void log_simparams()
Saves the current simulation parameters to the default parameter logfile.
Definition: fileservices.cc:349
virtual void reset()
Clears the list of FileHandlers.
Definition: fileservices.cc:340
virtual Metapop * get_pop_ptr()
Accessor to the pointer to the main population.
Definition: fileservices.h:111
virtual ~FileServices()
Definition: fileservices.cc:54
Service handler (an observer).
Definition: handler.h:36
Second class in the metapopulation design structure, between the Metapop and Individual classes.
Definition: metapop.h:430
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
void message(const char *message,...)
Definition: output.cc:40
sex_t
Sex types, males are always 0 and females 1!!
Definition: types.h:36
unsigned int age_t
Age class flags.
Definition: types.h:46
age_idx
Array index of the age classes in the patch sizes and containers arrays.
Definition: types.h:41