Nemo  2.2.0
Public Member Functions | Private Attributes
ParamUpdater< SC > Class Template Reference

Implementation of the ParamUpdaterBase interface. More...

#include <param.h>

+ Inheritance diagram for ParamUpdater< SC >:
+ Collaboration diagram for ParamUpdater< SC >:

List of all members.

Public Member Functions

 ParamUpdater (bool(SC::*updateFuncPtr)(void))
 ParamUpdater (const ParamUpdater< SC > &PU)
virtual ~ParamUpdater ()
virtual void init ()
 Sets the pointer to the SimComponent.
virtual bool update (unsigned int generation)
 Calls the SimComponent's updating function using its pointer.
void setFuncPtr (bool(SC::*updateFuncPtr)(void))
 Sets the pointer to the updating function.
virtual SC * getComponent ()
 Accessor to the SimCimponent.

Private Attributes

bool(SC::* _myUpdaterFunction )(void)
SC * _myComponent

Detailed Description

template<class SC>
class ParamUpdater< SC >

Implementation of the ParamUpdaterBase interface.

Stores the pointers to the SimComponent and its updating function. The template argument allows to pass SimComponent class type necessary to call the updating function. The updating procedure is as follow: the parameters are first updated with their generational values (if the generation matches) and the component's is then updated using its updating function. The updating process is implemented in the UpdaterServices class. Several parameters may want to use the same updating function and thus this class allows to run that function only once, after updating all the parameters that use it.

Definition at line 323 of file param.h.


Constructor & Destructor Documentation

template<class SC>
ParamUpdater< SC >::ParamUpdater ( bool(SC::*)(void)  updateFuncPtr) [inline]

Definition at line 330 of file param.h.

  {
    _myUpdaterFunction = updateFuncPtr;
  }
template<class SC>
ParamUpdater< SC >::ParamUpdater ( const ParamUpdater< SC > &  PU) [inline]
template<class SC>
virtual ParamUpdater< SC >::~ParamUpdater ( ) [inline, virtual]

Definition at line 342 of file param.h.

  {
    for(PIT pit = _params.begin(); pit != _params.end(); pit++)
      if((*pit)->getUpdater() == this) (*pit)->setUpdater(0);
  }

Member Function Documentation

template<class SC>
virtual SC* ParamUpdater< SC >::getComponent ( ) [inline, virtual]

Accessor to the SimCimponent.

Implements ParamUpdaterBase.

Definition at line 367 of file param.h.

{return _myComponent;}
template<class SC>
virtual void ParamUpdater< SC >::init ( ) [inline, virtual]

Sets the pointer to the SimComponent.

It is deduced from the parameters' owner.

Implements ParamUpdaterBase.

Definition at line 349 of file param.h.

  {
    _myComponent = dynamic_cast<SC*> ( (*_params.begin())->getOwner() );
    
    for(PIT pit = ++_params.begin(); pit != _params.end(); pit++)
      assert(_myComponent == (*pit)->getOwner());
  }
template<class SC>
void ParamUpdater< SC >::setFuncPtr ( bool(SC::*)(void)  updateFuncPtr) [inline]

Sets the pointer to the updating function.

Definition at line 362 of file param.h.

  {
    _myUpdaterFunction = updateFuncPtr;
  }
template<class SC>
virtual bool ParamUpdater< SC >::update ( unsigned int  generation) [inline, virtual]

Calls the SimComponent's updating function using its pointer.

Implements ParamUpdaterBase.

Definition at line 357 of file param.h.

  {        
    return ((( dynamic_cast<SC*> (_myComponent))->*_myUpdaterFunction) ());
  }

Member Data Documentation

template<class SC>
SC* ParamUpdater< SC >::_myComponent [private]

Definition at line 326 of file param.h.

Referenced by ParamUpdater< SC >::ParamUpdater().

template<class SC>
bool(SC::* ParamUpdater< SC >::_myUpdaterFunction)(void) [private]

Definition at line 325 of file param.h.

Referenced by ParamUpdater< SC >::ParamUpdater().


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

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