Nemo  2.3.46
SimComponent Class Referenceabstract

Interface to all basic components of a simulation (traits, life cycle events, pop, etc. ). More...

#include <simcomponent.h>

+ Inheritance diagram for SimComponent:
+ Collaboration diagram for SimComponent:

Public Member Functions

 SimComponent ()
 
virtual ~SimComponent ()
 
Services interface
virtual void loadFileServices (FileServices *loader)=0
 Loads the component's FileHandler onto the FileServices. More...
 
virtual void loadStatServices (StatServices *loader)=0
 Loads the component's StatHandler onto the StatServices. More...
 
virtual void loadUpdaters (UpdaterServices *loader)
 Loads the parameters and component updater onto the updater manager. More...
 
Parameters handling
 
virtual bool setParameters ()=0
 Default interface needed to initialize the component's variables from its input parameters value. More...
 
virtual void set_paramset (ParamSet *paramset)
 Sets the ParamSet member. More...
 
virtual void set_paramset (std::string name, bool required, SimComponent *owner)
 Sets a new ParamSet and name it. More...
 
virtual void set_paramsetFromCopy (const ParamSet &PSet)
 Reset the set of parameters from a another set. More...
 
virtual ParamSetget_paramset ()
 ParamSet accessor. More...
 
virtual void add_parameter (Param *param)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd)
 Interface to add a parameter to the set. More...
 
virtual void add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd, ParamUpdaterBase *updater)
 Interface to add a parameter and its updater to the set. More...
 
virtual Paramget_parameter (std::string name)
 Param getter. More...
 
virtual double get_parameter_value (std::string name)
 Param value getter. More...
 
virtual string get_name ()
 Returnd the name of the ParamSet, i.e. More...
 

Protected Attributes

ParamSet_paramSet
 The parameters container. More...
 

Detailed Description

Interface to all basic components of a simulation (traits, life cycle events, pop, etc. ).

Implements the interface to handle the files and stats handler, the parameter updaters, and the parameters container. Contains the component's parameters and declares the interface to interact with its parameters.

Constructor & Destructor Documentation

SimComponent::SimComponent ( )
inline
52 : _paramSet(0) {}//{ cout << "calling SimComponent()" << endl;}
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
virtual SimComponent::~SimComponent ( )
inlinevirtual

References _paramSet.

54 {if(_paramSet != NULL) delete _paramSet;}
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48

Member Function Documentation

virtual void SimComponent::add_parameter ( std::string  Name,
param_t  Type,
bool  isRequired,
bool  isBounded,
double  low_bnd,
double  up_bnd 
)
inlinevirtual

Interface to add a parameter to the set.

Parameters
NameThe param string name as read in the init file
TypeThe type of the argument (DBL=double, INT=integer, BOOL=boolean, STR=string, etc., see type.h)
isRequiredTrue if the parameter is mandatory
isBoundedTrue if the parameter takes bounded values as argument
low_bndThe lower value the argument can take
up_bndThe upper value the argument can take

References ParamSet::add_param().

123  {_paramSet->add_param(Name, Type, isRequired, isBounded, low_bnd, up_bnd, 0);}
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
void add_param(Param *param)
Adds the param argument to the list.
Definition: param.h:238
virtual void SimComponent::add_parameter ( std::string  Name,
param_t  Type,
bool  isRequired,
bool  isBounded,
double  low_bnd,
double  up_bnd,
ParamUpdaterBase updater 
)
inlinevirtual

Interface to add a parameter and its updater to the set.

Parameters
NameThe param string name as read in the init file
TypeThe type of the argument (DBL=double, INT=integer, BOOL=boolean, STR=string, etc., see type.h)
isRequiredTrue if the parameter is mandatory
isBoundedTrue if the parameter takes bounded values as argument
low_bndThe lower value the argument can take
up_bndThe upper value the argument can take
updatera pointer to a ParamUpdaterBase object used to reset its value during a simulation

References ParamSet::add_param().

135  {_paramSet->add_param(Name, Type, isRequired, isBounded, low_bnd, up_bnd, updater);}
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
void add_param(Param *param)
Adds the param argument to the list.
Definition: param.h:238
virtual string SimComponent::get_name ( )
inlinevirtual

Returnd the name of the ParamSet, i.e.

the name of the component.

References ParamSet::getName().

146 {return _paramSet->getName();}
string getName()
Name accessor.
Definition: param.h:275
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
virtual Param* SimComponent::get_parameter ( std::string  name)
inlinevirtual

Param getter.

Asks the ParamSet to return a pointer to Param name.

See also
ParamSet::get_param

References ParamSet::get_param().

Referenced by LCE_Cross::execute(), LCE_Resize::execute(), TProtoBDMI::loadFileServices(), LCE_Cross::loadFileServices(), TProtoQuanti::loadFileServices(), TProtoNeutralGenes::loadFileServices(), LCE_Breed_Wolbachia::loadFileServices(), TProtoDeletMutations_bitstring::loadFileServices(), Metapop::loadFileServices(), LCE_Selection_base::loadFileServices(), LCE_Selection_base::set_local_optima(), LCE_Patch_Extinction::set_matrix_param(), LCE_Selection_base::set_param_rate_of_change(), LCE_Selection_base::set_sel_model(), LCE_Selection_base::set_std_rate_of_change(), LCE_Disperse_base::setBaseParameters(), TProtoQuanti::setContinuousMutationModel(), TProtoQuanti::setDiallelicMutationModel(), LCE_Breed_base::setFecundity(), TTProtoWithMap::setGeneticMapParameters(), LCE_Breed_base::setMatingSystem(), TProtoQuanti::setMutationParameters(), TTProtoWithMap::setNumLociPerChromosome(), LCE_QuantiInit::setParameters(), BinaryDataSaver::setParameters(), TProtoBDMI::setParameters(), LCE_Patch_Extinction::setParameters(), LCE_Cross::setParameters(), TProtoQuanti::setParameters(), LCE_Breed_Disperse::setParameters(), TProtoNeutralGenes::setParameters(), LCE_Breed_Wolbachia::setParameters(), TProtoDeletMutations_bitstring::setParameters(), LCE_Breed_Selection::setParameters(), LCE_Breed_Selection_Disperse::setParameters(), LCE_Selection_base::setParameters(), LCE_Init_BDMI::setParameters(), TTProtoWithMap::setRecombinationMapRandom(), LCE_Selection_base::setSelectionMatrix(), TProtoDeletMutations_bitstring::setSelectionParameters(), LCE_Breed_base::setSexRatio(), and LCE_Resize::updateParameters().

139 {return _paramSet->get_param(name);}
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
Param * get_param(string name)
Look for a param "name" in its parameters list.
Definition: param.cc:597
virtual double SimComponent::get_parameter_value ( std::string  name)
inlinevirtual

Param value getter.

Asks the ParamSet to return the value of Param name.

See also
ParamSet::getValue

References ParamSet::getValue().

Referenced by LifeCycleEvent::get_rank(), Metapop::loadFileServices(), LCE_Selection_base::set_param_rate_of_change(), LCE_Selection_base::set_sel_model(), LCE_Selection_base::set_std_rate_of_change(), LCE_Disperse_base::setBasicLatticeMatrix(), TProtoQuanti::setContinuousMutationModel(), TProtoQuanti::setDiallelicMutationModel(), LCE_Breed_base::setFecundity(), TTProtoWithMap::setGeneticMapParameters(), LCE_Disperse_base::setLatticeMatrix(), LCE_Disperse_base::setLatticeTorrusMatrix(), LCE_Breed_base::setMatingSystem(), TProtoQuanti::setMutationParameters(), BinaryDataSaver::setParameters(), TProtoBDMI::setParameters(), TProtoWolbachia::setParameters(), LCE_Disperse_ConstDisp::setParameters(), LCE_Patch_Extinction::setParameters(), LCE_Cross::setParameters(), TProtoQuanti::setParameters(), LCE_Breed_Disperse::setParameters(), TProtoNeutralGenes::setParameters(), LCE_Breed_Wolbachia::setParameters(), TProtoDeletMutations_bitstring::setParameters(), LCE_Resize::setParameters(), LCE_Breed_Selection_Disperse::setParameters(), LCE_Disperse_base::setReducedDispMatrix(), LCE_Selection_base::setSelectionMatrix(), TProtoDeletMutations_bitstring::setSelectionParameters(), and LCE_Disperse_base::setSteppingStone1DMatrix().

143 {return _paramSet->getValue(name);}
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
double getValue(string name)
Accessor the parameters value.
Definition: param.h:287
virtual ParamSet* SimComponent::get_paramset ( )
inlinevirtual

ParamSet accessor.

References _paramSet.

Referenced by LCE_Resize::execute(), BinaryDataLoader::extractPop(), Metapop::loadPopFromTraitFile(), and LCE_StatServiceNotifier::loadStatServices().

108 {return _paramSet;}
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
virtual void SimComponent::loadUpdaters ( UpdaterServices loader)
inlinevirtual

Loads the parameters and component updater onto the updater manager.

Parameters
loaderthe updater manager

Reimplemented in LCE_ParamUpdaterNotifier.

References UpdaterServices::attach(), and ParamSet::getUpdaters().

Referenced by UpdaterServices::load().

68  {
69  list<ParamUpdaterBase*> updaters = _paramSet->getUpdaters();
70  //remove duplicates:
71  updaters.unique();
72  for (list<ParamUpdaterBase*>::iterator u = updaters.begin(); u != updaters.end(); u++) {
73  loader->attach( (*u) );
74  }
75  }
list< ParamUpdaterBase * > getUpdaters()
Collects the parameter updaters from the set of parameters.
Definition: param.cc:564
virtual void attach(Handler *H)
Attach the updater to the stack.
Definition: updaterservices.cc:89
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
virtual void SimComponent::set_paramset ( ParamSet paramset)
inlinevirtual
virtual void SimComponent::set_paramset ( std::string  name,
bool  required,
SimComponent owner 
)
inlinevirtual

Sets a new ParamSet and name it.

Parameters
namethe name of the parameters container
requiredtag whether the component is required to run a simulation
ownera reference to the owner of the ParamSet (should be this).

Reimplemented in LifeCycleEvent.

References _paramSet, ParamSet::setIsRequired(), ParamSet::setName(), and ParamSet::setOwner().

93  {
94  if(_paramSet != NULL) delete _paramSet;
95  _paramSet = new ParamSet();
96  _paramSet->setName(name);
97  _paramSet->setIsRequired(required);
98  _paramSet->setOwner(owner);
99  }
void setName(string value)
Sets the container's name.
Definition: param.h:267
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:269
void setOwner(SimComponent *owner)
Sets the pointer to the SimComponents that owns this set.
Definition: param.h:271
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
Parameters container, implemented in each SimComponent.
Definition: param.h:203
virtual void SimComponent::set_paramsetFromCopy ( const ParamSet PSet)
inlinevirtual

Reset the set of parameters from a another set.

Parameters
PSetthe parameter set to copy parameters from

References _paramSet.

Referenced by Metapop::loadPopFromTraitFile().

103  {
104  if(_paramSet != NULL) delete _paramSet;
105  _paramSet = new ParamSet(PSet);
106  }
ParamSet * _paramSet
The parameters container.
Definition: simcomponent.h:48
Parameters container, implemented in each SimComponent.
Definition: param.h:203

Member Data Documentation


The documentation for this class was generated from the following file:

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR