Nemo  2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
ComponentManager Class Reference

Class to manage the simulation components and prototypes. More...

#include <basicsimulation.h>

+ Inheritance diagram for ComponentManager:
+ Collaboration diagram for ComponentManager:

Public Member Functions

 ComponentManager ()
 
 ~ComponentManager ()
 
void build_component_list ()
 Clears and builds the list of all components from the lists of trait prototype templates and life cycle event templates. More...
 
void add_component (SimComponent *cmpt)
 Push a component at the back of the component list. More...
 
void add_trait (TraitPrototype *trait)
 Add a trait prototype to the template and component lists. More...
 
void add_LCE (LifeCycleEvent *event)
 Add a life cycle event to the template and component lists. More...
 
TraitPrototypeget_trait (string name)
 Search for component with "name" in the trait prototype list. More...
 
LifeCycleEventget_LCE (string name)
 Search for component with "name" in the life cycle events list. More...
 

Protected Attributes

list< SimComponent * > _components
 List of all the simulation components. More...
 
list< TraitPrototype * > _TTrait_Templates
 List of all trait prototypes of the simulation, a subset of _components list. More...
 
list< LifeCycleEvent * > _LCE_Templates
 List of all the life-cycle events of the simulation, a subset of _components list. More...
 

Detailed Description

Class to manage the simulation components and prototypes.

This class stores and provides accessors to the simulation components. It also stores the trait prototype and life cycle event template instances.

Constructor & Destructor Documentation

◆ ComponentManager()

ComponentManager::ComponentManager ( )
inline
49{}

◆ ~ComponentManager()

ComponentManager::~ComponentManager ( )
inline
50{/*message("ComponentManager::~ComponentManager\n");*/}

Member Function Documentation

◆ add_component()

void ComponentManager::add_component ( SimComponent cmpt)
inline

Push a component at the back of the component list.

54{_components.push_back(cmpt);}
list< SimComponent * > _components
List of all the simulation components.
Definition: basicsimulation.h:71

References _components.

◆ add_LCE()

void ComponentManager::add_LCE ( LifeCycleEvent event)
inline

Add a life cycle event to the template and component lists.

58{_LCE_Templates.push_back(event);_components.push_back(event);}
list< LifeCycleEvent * > _LCE_Templates
List of all the life-cycle events of the simulation, a subset of _components list.
Definition: basicsimulation.h:75

References _components, and _LCE_Templates.

Referenced by SIMenv::loadDefaultComponents(), and SimBuilder::SimBuilder().

+ Here is the caller graph for this function:

◆ add_trait()

void ComponentManager::add_trait ( TraitPrototype trait)
inline

Add a trait prototype to the template and component lists.

56{_TTrait_Templates.push_back(trait); _components.push_back(trait);}
list< TraitPrototype * > _TTrait_Templates
List of all trait prototypes of the simulation, a subset of _components list.
Definition: basicsimulation.h:73

References _components, and _TTrait_Templates.

Referenced by SIMenv::loadDefaultComponents(), and SimBuilder::SimBuilder().

+ Here is the caller graph for this function:

◆ build_component_list()

void ComponentManager::build_component_list ( )

Clears and builds the list of all components from the lists of trait prototype templates and life cycle event templates.

41{
42 _components.clear();
43
44 list< TraitPrototype* >::iterator TT_it = _TTrait_Templates.begin();
45
46 while(TT_it != _TTrait_Templates.end()) {
47 _components.push_back( (*TT_it) );
48 TT_it++;
49 }
50
51 list< LifeCycleEvent* >::iterator LCE_it = _LCE_Templates.begin();
52
53 while(LCE_it != _LCE_Templates.end()) {
54 _components.push_back( (*LCE_it) );
55 LCE_it++;
56 }
57}

References _components, _LCE_Templates, and _TTrait_Templates.

◆ get_LCE()

LifeCycleEvent * ComponentManager::get_LCE ( string  name)

Search for component with "name" in the life cycle events list.

Returns
NULL if component with "name" not found, a pointer to that component otherwise
78{
79 list< LifeCycleEvent* >::iterator LCE = _LCE_Templates.begin();
80
81 while(LCE != _LCE_Templates.end()) {
82
83 if( (*LCE)->get_event_name().compare(name) == 0 ) return (*LCE);
84
85 LCE++;
86 }
87
88 return NULL;
89}

References _LCE_Templates.

Referenced by SimRunner::Replicate_LOOP().

+ Here is the caller graph for this function:

◆ get_trait()

TraitPrototype * ComponentManager::get_trait ( string  name)

Search for component with "name" in the trait prototype list.

Returns
NULL if component with "name" not found, a pointer to that component otherwise
62{
63 list< TraitPrototype* >::iterator TT = _TTrait_Templates.begin();
64
65 while(TT != _TTrait_Templates.end()) {
66
67 if( (*TT)->get_paramset()->getName().compare(name) == 0 ) return (*TT);
68
69 TT++;
70 }
71
72 return NULL;
73}

References _TTrait_Templates.

Member Data Documentation

◆ _components

list< SimComponent* > ComponentManager::_components
protected

◆ _LCE_Templates

list< LifeCycleEvent* > ComponentManager::_LCE_Templates
protected

List of all the life-cycle events of the simulation, a subset of _components list.

Referenced by add_LCE(), build_component_list(), SimBuilder::build_LifeCycle(), get_LCE(), SimBuilder::SimBuilder(), and SimBuilder::~SimBuilder().

◆ _TTrait_Templates

list< TraitPrototype* > ComponentManager::_TTrait_Templates
protected

List of all trait prototypes of the simulation, a subset of _components list.

Referenced by add_trait(), build_component_list(), SimBuilder::build_currentTraits(), get_trait(), SimBuilder::SimBuilder(), and SimBuilder::~SimBuilder().


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

Generated for Nemo v2.3.56 by  doxygen 1.9.0 -- Nemo is hosted on  Download Nemo

Locations of visitors to this page
Catalogued on GSR