Nemo  2.3.46
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 ( )
inline
49 {}
ComponentManager::~ComponentManager ( )
inline
50 {/*message("ComponentManager::~ComponentManager\n");*/}

Member Function Documentation

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
void ComponentManager::add_LCE ( LifeCycleEvent event)
inline

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

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

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
list< SimComponent * > _components
List of all the simulation components.
Definition: basicsimulation.h:71
void ComponentManager::add_trait ( TraitPrototype trait)
inline

Add a trait prototype to the template and component lists.

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

56 {_TTrait_Templates.push_back(trait); _components.push_back(trait);}
list< SimComponent * > _components
List of all the simulation components.
Definition: basicsimulation.h:71
list< TraitPrototype * > _TTrait_Templates
List of all trait prototypes of the simulation, a subset of _components list.
Definition: basicsimulation.h:73
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.

References _components, _LCE_Templates, and _TTrait_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 }
list< LifeCycleEvent * > _LCE_Templates
List of all the life-cycle events of the simulation, a subset of _components list.
Definition: basicsimulation.h:75
list< SimComponent * > _components
List of all the simulation components.
Definition: basicsimulation.h:71
list< TraitPrototype * > _TTrait_Templates
List of all trait prototypes of the simulation, a subset of _components list.
Definition: basicsimulation.h:73
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

References _LCE_Templates.

Referenced by SimRunner::Replicate_LOOP().

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 }
list< LifeCycleEvent * > _LCE_Templates
List of all the life-cycle events of the simulation, a subset of _components list.
Definition: basicsimulation.h:75
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

References _TTrait_Templates.

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 }
list< TraitPrototype * > _TTrait_Templates
List of all trait prototypes of the simulation, a subset of _components list.
Definition: basicsimulation.h:73

Member Data Documentation

list< SimComponent* > ComponentManager::_components
protected
list< LifeCycleEvent* > ComponentManager::_LCE_Templates
protected

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

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

list< TraitPrototype* > ComponentManager::_TTrait_Templates
protected

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

Referenced by 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.0 by  doxygen 1.8.8 --
Catalogued on GSR