103 Param (
string& Name,
param_t Type,
bool mandatory,
bool bounded,
double low_bnd,
double up_bnd,
161 bool set (
string arg,
string& errmsg);
164 bool update (
unsigned int generation);
235 void print (ofstream& FILE,
bool commentOut =
false);
253 double low_bnd,
double up_bnd)
254 {
add_param(Name, Type, mandatory, isBounded, low_bnd, up_bnd, 0);}
264 bool set_param (
string Name,
string Arg);
280 bool update_param (
string Name,
unsigned int generation);
323 typedef list< Param* >::iterator
PIT;
339 virtual bool update (
unsigned int generation) = 0;
385 if((*pit)->getUpdater() ==
this) (*pit)->setUpdater(0);
397 virtual bool update (
unsigned int generation)
Service handler (an observer).
Definition: handler.h:36
Parameters container, implemented in each SimComponent.
Definition: param.h:206
map< string, Param * > _params
List of parameters indexed by name.
Definition: param.h:214
SimComponent * _myOwner
Pointer to the component that declared this parameter.
Definition: param.h:216
void clear()
Empties the parameter containers (no delete).
Definition: param.h:227
void getMatrix(string name, TMatrix *mat)
Accessor to the parameters matrix.
Definition: param.h:304
string getArg(string name)
Accessor to the parameters argument string.
Definition: param.h:300
void reset()
Put the container in the unset state, reset each Param it contains.
Definition: param.cc:569
int size()
Returns the number of parameters contained.
Definition: param.h:237
~ParamSet()
Definition: param.cc:558
double getValue(string name)
Accessor the parameters value.
Definition: param.h:302
bool check_consistency()
Checks for the status of the required parameters.
Definition: param.cc:669
ParamSet()
Definition: param.h:220
bool _isRequired
Flaf is true if component is required (mandatory) to run a simulation (e.g.
Definition: param.h:212
void show_up()
print info to stdout.
Definition: param.cc:757
string getName()
Name accessor.
Definition: param.h:290
bool has_param(string name)
Look for a param "name" in its parameters list.
Definition: param.cc:651
string _name
The name of the component.
Definition: param.h:208
bool isSet(string name)
Accessor to the parameters status flag.
Definition: param.h:294
void add_param(Param *param)
Adds the param argument to the list.
Definition: param.h:243
void setName(string value)
Sets the container's name.
Definition: param.h:282
void print(ofstream &FILE, bool commentOut=false)
print all set parameters to the outpout file stream
Definition: param.cc:769
bool update_param(string Name, unsigned int generation)
Calls the updating procedure of each of its Param.
Definition: param.cc:660
bool isMatrix(string name)
Check if the parameter "name" is of matrix type.
Definition: param.h:296
void setOwner(SimComponent *owner)
Sets the pointer to the SimComponents that owns this set.
Definition: param.h:286
bool set_param(string Name, string Arg)
Look for a param named "Name" and try to set it with the "Arg" argument string.
Definition: param.cc:605
Param * get_param(string name)
Look for a param "name" in its parameters list.
Definition: param.cc:637
void setIsRequired(bool value)
Sets the _isRequired flag meaning this container is mandatory and must be set in order to run a simul...
Definition: param.h:284
list< ParamUpdaterBase * > getUpdaters()
Collects the parameter updaters from the set of parameters.
Definition: param.cc:592
bool _isSet
Flag is true if all mandatory parameters are correctly set from user's input file.
Definition: param.h:210
map< string, Param * > & getAllParams()
Returns the complete list of parameters.
Definition: param.h:239
bool isSet()
Accessor to the status flag.
Definition: param.h:288
ParamSet & operator=(const ParamSet &PS)
Definition: param.cc:728
bool isRequired()
Accessor to the mandatory flag.
Definition: param.h:292
void add_param(string Name, param_t Type, bool mandatory, bool isBounded, double low_bnd, double up_bnd)
Adds a new param specified by arguments to the list.
Definition: param.h:252
Param * find_param(string name)
Look for a param "name" in its parameters list.
Definition: param.cc:625
bool isTemporal(string name)
Check if the parameter "name" has temporal arguments.
Definition: param.h:298
Base class of the ParamUpdater class used to handle the temporal parameter argument values.
Definition: param.h:315
virtual ~ParamUpdaterBase()
Definition: param.h:334
virtual void addParam(Param *param)
Adds a parameter to the stack.
Definition: param.h:343
virtual SimComponent * getComponent()=0
virtual void reset()
Clears the parameters stack.
Definition: param.h:345
list< Param * > getParams()
Returns the list of parameters.
Definition: param.h:347
virtual void update()
Definition: param.h:337
ParamUpdaterBase(const ParamUpdaterBase &PU)
Definition: param.h:329
ParamUpdaterBase()
Definition: param.h:327
virtual bool update(unsigned int generation)=0
Updating procedure.
list< Param * > _params
List of the parameters affected by this updater.
Definition: param.h:319
list< Param * >::iterator PIT
Definition: param.h:323
Implementation of the ParamUpdaterBase interface.
Definition: param.h:363
bool(SC::* _myUpdaterFunction)(void)
Definition: param.h:365
virtual bool update(unsigned int generation)
Calls the SimComponent's updating function using its pointer.
Definition: param.h:397
virtual void init()
Sets the pointer to the SimComponent.
Definition: param.h:389
ParamUpdater(bool(SC::*updateFuncPtr)(void))
Definition: param.h:370
SC * _myComponent
Definition: param.h:366
virtual ~ParamUpdater()
Definition: param.h:382
void setFuncPtr(bool(SC::*updateFuncPtr)(void))
Sets the pointer to the updating function.
Definition: param.h:402
virtual SC * getComponent()
Accessor to the SimComponent.
Definition: param.h:407
ParamUpdater(const ParamUpdater< SC > &PU)
Definition: param.h:375
This structure stores one parameter, its definition and its string argument.
Definition: param.h:54
bool hasMultipleArgs()
Definition: param.h:144
bool _hasMultipleArgs
Definition: param.h:90
unsigned int _setAtGeneration
Generation at which the parameter has been set/updated.
Definition: param.h:73
void setArg(string value)
Sets the parameter's argument.
Definition: param.h:118
bool parseAgeSpecArgument(const string &arg)
Definition: param.cc:299
double getValue()
Returns the argument value according to its type.
Definition: param.cc:347
bool _isSet
Flag set once the parameter has recieved the right argument.
Definition: param.h:64
void parse_matrix(TMatrix *mat)
Parses the matrix from the argument string.
Definition: param.cc:370
bool update(unsigned int generation)
Updates the parameter value at a given generation during the simulation.
Definition: param.cc:502
param_t getType()
Definition: param.h:139
bool isMatrix()
Checks if the argument is of matrix type.
Definition: param.h:172
vector< string > getExternalFiles()
Definition: param.h:156
bool isRequired()
Definition: param.h:142
param_t _type
The type of the argument, must one of DBL, INT, BOOL, STR or MAT (see types.h).
Definition: param.h:62
string getArgumentFromFile(string file)
Definition: param.cc:327
bool _isRequired
Flag telling if this parameter is mandatory.
Definition: param.h:69
bool isTemporal()
Definition: param.h:143
string getName()
Definition: param.h:137
map< unsigned int, string > _temporalArgs
The temporal arguments.
Definition: param.h:84
SimComponent * getOwner()
Definition: param.h:147
bool isBounded()
Definition: param.h:141
void reset()
Clears the _isSet flag and the argument string.
Definition: param.cc:74
string checkArgumentForExpansion(string arg)
Definition: param.cc:313
bool parseSubParamArgument(const string &arg)
Definition: param.cc:306
SimComponent * _myOwner
Pointer to the component that declared this parameter.
Definition: param.h:75
vector< string > _externalFile
External argument file.
Definition: param.h:80
bool _isBounded
Flag telling if the parameter has a bounded argument value.
Definition: param.h:66
void setBounds(double low_bnd, double up_bnd)
Sets the bounds.
Definition: param.h:128
virtual ~Param()
Definition: param.cc:67
deque< unsigned int > getUpdatingDates()
Definition: param.cc:96
void getVariableMatrix(vector< vector< double > > *mat)
Definition: param.cc:439
vector< string > _multiArgs
Multiple arguments.
Definition: param.h:89
double getBound(unsigned int i)
Definition: param.h:146
string _arg
The argument string, set by the ParamsParser upon initialization.
Definition: param.h:58
void parse_variable_matrix(vector< vector< double > > *mat)
Definition: param.cc:451
string getArg()
Definition: param.h:138
void getMatrix(TMatrix *mat)
Sets the matrix from the argument string if the parameter is set and of matrix type.
Definition: param.cc:357
double _bounds[2]
The argument value boundaries.
Definition: param.h:71
vector< string > getMultiArgs()
Definition: param.cc:122
void setType(param_t value)
Sets the parameter's type (see types.h)
Definition: param.h:120
ParamUpdaterBase * _myUpdater
Pointer to an ParamUpdater object.
Definition: param.h:77
deque< string > getTemporalArgs()
Definition: param.cc:109
bool _hasExternalFile
Definition: param.h:81
void setName(string value)
Sets the parameter's name.
Definition: param.h:116
bool parseTemporalArgument(const string &arg)
Definition: param.cc:279
ParamUpdaterBase * getUpdater()
Definition: param.h:148
void setUpdater(ParamUpdaterBase *updater)
Sets the pointer to the updater object.
Definition: param.h:132
bool parseArgument(string &arg)
Definition: param.cc:198
string _name
The name of the parameter as read in the init file.
Definition: param.h:56
void show_up()
Print state to stdout.
Definition: param.cc:518
bool hasExternalFile()
Definition: param.h:145
bool isSet()
Definition: param.h:140
void setIsSet(bool value)
Sets the _isSet flag.
Definition: param.h:122
void setIsBounded(bool value)
Sets the _isBounded flag.
Definition: param.h:124
bool _isTemporal
Flag telling if this parameter has temporal arguments.
Definition: param.h:86
void setAtGeneration(unsigned int generation)
Definition: param.h:134
void setIsRequired(bool value)
Sets the isRequired flag.
Definition: param.h:126
string _input_arg
The input argument string, kept untouched as a backup for logging.
Definition: param.h:60
void setOwner(SimComponent *owner)
Sets the pointer to owner.
Definition: param.h:130
Interface to all basic components of a simulation (traits, life cycle events, pop,...
Definition: simcomponent.h:45
A class to handle matrix in params, coerces matrix into a vector of same total size.
Definition: tmatrix.h:49
param_t
Param's types.
Definition: types.h:77
@ MAT
Definition: types.h:78