Nemo  2.2.0
Public Member Functions | Protected Attributes
ComponentManager Class Reference

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

#include <basicsimulation.h>

+ Inheritance diagram for ComponentManager:

List of all members.

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.
void add_component (SimComponent *cmpt)
 Push a component at the back of the component list.
void add_trait (TraitPrototype *trait)
 Add a trait prototype to the template and component lists.
void add_LCE (LifeCycleEvent *event)
 Add a life cycle event to the template and component lists.
TraitPrototypeget_trait (string name)
 Search for component with "name" in the trait prototype list.
LifeCycleEventget_LCE (string name)
 Search for component with "name" in the life cycle events list.

Protected Attributes

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

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.

Definition at line 46 of file basicsimulation.h.


Constructor & Destructor Documentation

ComponentManager::ComponentManager ( ) [inline]

Definition at line 49 of file basicsimulation.h.

{}
ComponentManager::~ComponentManager ( ) [inline]

Definition at line 50 of file basicsimulation.h.

{}

Member Function Documentation

void ComponentManager::add_component ( SimComponent cmpt) [inline]

Push a component at the back of the component list.

Definition at line 54 of file basicsimulation.h.

{_components.push_back(cmpt);}
void ComponentManager::add_LCE ( LifeCycleEvent event) [inline]

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

Definition at line 58 of file basicsimulation.h.

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

{_LCE_Templates.push_back(event);_components.push_back(event);}
void ComponentManager::add_trait ( TraitPrototype trait) [inline]

Add a trait prototype to the template and component lists.

Definition at line 56 of file basicsimulation.h.

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

{_TTrait_Templates.push_back(trait); _components.push_back(trait);}
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.

Definition at line 40 of file basicsimulation.cc.

References _components, _LCE_Templates, and _TTrait_Templates.

{
  _components.clear();
  
  list< TraitPrototype* >::iterator TT_it = _TTrait_Templates.begin();
  
  while(TT_it != _TTrait_Templates.end()) {
    _components.push_back( (*TT_it) );
    TT_it++;
  }
  
  list< LifeCycleEvent* >::iterator LCE_it = _LCE_Templates.begin();
  
  while(LCE_it != _LCE_Templates.end()) {
    _components.push_back( (*LCE_it) );
    LCE_it++;
  }
}
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

Definition at line 77 of file basicsimulation.cc.

References _LCE_Templates.

{
  list< LifeCycleEvent* >::iterator LCE = _LCE_Templates.begin();
  
  while(LCE != _LCE_Templates.end()) {
    
    if( (*LCE)->get_event_name().compare(name) == 0 ) return (*LCE);
    
    LCE++;
  }
  
  return NULL;
}
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

Definition at line 61 of file basicsimulation.cc.

References _TTrait_Templates.

{
  list< TraitPrototype* >::iterator TT = _TTrait_Templates.begin();
  
  while(TT != _TTrait_Templates.end()) {
        
        if( (*TT)->get_paramset()->getName().compare(name) == 0 ) return (*TT);
        
        TT++;
  }
  
  return NULL;
}

Member Data Documentation

List of all the simulation components.

Definition at line 71 of file basicsimulation.h.

Referenced by SimRunner::attach_pop(), ParamManager::build_allParams(), and build_component_list().

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

Definition at line 75 of file basicsimulation.h.

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

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

Definition at line 73 of file basicsimulation.h.

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


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

Generated for Nemo v2.2.0 by  doxygen 1.7.5.1 -- Nemo is hosted by  SourceForge.net Logo