SimComponent Class Reference

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

#include <simcomponent.h>

Inheritance diagram for SimComponent:

Inheritance graph
[legend]
Collaboration diagram for SimComponent:

Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Protected Attributes

ParamSet_paramSet
 The parameters container.


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.

Definition at line 45 of file simcomponent.h.


Constructor & Destructor Documentation

SimComponent::SimComponent (  )  [inline]

Definition at line 52 of file simcomponent.h.

00052 : _paramSet(0) {}//{ cout << "calling SimComponent()" << endl;}

virtual SimComponent::~SimComponent (  )  [inline, virtual]

Definition at line 54 of file simcomponent.h.

00054 {if(_paramSet != NULL) delete _paramSet;}


Member Function Documentation

virtual void SimComponent::add_parameter ( std::string  Name,
param_t  Type,
bool  isRequired,
bool  isBounded,
double  low_bnd,
double  up_bnd,
ParamUpdaterBase updater 
) [inline, virtual]

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

Parameters:
Name The param string name as read in the init file
Type The type of the argument (DBL=double, INT=integer, BOOL=boolean, STR=string, etc., see type.h)
isRequired True if the parameter is mandatory
isBounded True if the parameter takes bounded values as argument
low_bnd The lower value the argument can take
up_bnd The upper value the argument can take
updater a pointer to a ParamUpdaterBase object used to reset its value during a simulation

Definition at line 133 of file simcomponent.h.

00135   {_paramSet->add_param(Name, Type, isRequired, isBounded, low_bnd, up_bnd, updater);}

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

Interface to add a parameter to the set.

Parameters:
Name The param string name as read in the init file
Type The type of the argument (DBL=double, INT=integer, BOOL=boolean, STR=string, etc., see type.h)
isRequired True if the parameter is mandatory
isBounded True if the parameter takes bounded values as argument
low_bnd The lower value the argument can take
up_bnd The upper value the argument can take

Definition at line 121 of file simcomponent.h.

00123   {_paramSet->add_param(Name, Type, isRequired, isBounded, low_bnd, up_bnd, 0);}

virtual void SimComponent::add_parameter ( Param param  )  [inline, virtual]

virtual string SimComponent::get_name (  )  [inline, virtual]

Returnd the name of the ParamSet, i.e.

the name of the component.

Definition at line 146 of file simcomponent.h.

00146 {return _paramSet->getName();}

virtual Param* SimComponent::get_parameter ( std::string  name  )  [inline, virtual]

virtual double SimComponent::get_parameter_value ( std::string  name  )  [inline, virtual]

virtual ParamSet* SimComponent::get_paramset (  )  [inline, virtual]

virtual void SimComponent::loadFileServices ( FileServices loader  )  [pure virtual]

virtual void SimComponent::loadStatServices ( StatServices loader  )  [pure virtual]

virtual void SimComponent::loadUpdaters ( UpdaterServices loader  )  [inline, virtual]

Loads the parameters and component updater onto the updater manager.

Parameters:
loader the updater manager

Reimplemented in LCE_ParamUpdaterNotifier.

Definition at line 68 of file simcomponent.h.

Referenced by UpdaterServices::load().

00068                                                          {
00069     list<ParamUpdaterBase*> updaters = _paramSet->getUpdaters();
00070     //remove duplicates:
00071     updaters.unique();
00072     for (list<ParamUpdaterBase*>::iterator u = updaters.begin(); u != updaters.end(); u++) {
00073       loader->attach( (*u) );
00074     }
00075   }

virtual void SimComponent::set_paramset ( std::string  name,
bool  required,
SimComponent owner 
) [inline, virtual]

Sets a new ParamSet and name it.

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

Reimplemented in LifeCycleEvent.

Definition at line 93 of file simcomponent.h.

00093                                                                                   {
00094     if(_paramSet != NULL) delete _paramSet;
00095     _paramSet = new ParamSet(); 
00096     _paramSet->setName(name);
00097     _paramSet->setIsRequired(required);
00098     _paramSet->setOwner(owner);
00099   }

virtual void SimComponent::set_paramset ( ParamSet paramset  )  [inline, virtual]

virtual void SimComponent::set_paramsetFromCopy ( const ParamSet PSet  )  [inline, virtual]

Reset the set of parameters from a another set.

Parameters:
PSet the parameter set to copy parameters from

Definition at line 103 of file simcomponent.h.

Referenced by Metapop::loadPopFromTraitFile().

00103                                                            {
00104     if(_paramSet != NULL) delete _paramSet;
00105     _paramSet = new ParamSet(PSet); 
00106   }

virtual bool SimComponent::setParameters (  )  [pure virtual]


Member Data Documentation


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

Generated for Nemo v2.1.2 by  doxygen 1.5.8 -- Nemo is hosted by  SourceForge.net Logo