Nemo  2.3.46
ParamUpdater< SC > Class Template Reference

Implementation of the ParamUpdaterBase interface. More...

#include <param.h>

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

Public Member Functions

 ParamUpdater (bool(SC::*updateFuncPtr)(void))
 
 ParamUpdater (const ParamUpdater< SC > &PU)
 
virtual ~ParamUpdater ()
 
virtual void init ()
 Sets the pointer to the SimComponent. More...
 
virtual bool update (unsigned int generation)
 Calls the SimComponent's updating function using its pointer. More...
 
void setFuncPtr (bool(SC::*updateFuncPtr)(void))
 Sets the pointer to the updating function. More...
 
virtual SC * getComponent ()
 Accessor to the SimCimponent. More...
 
- Public Member Functions inherited from ParamUpdaterBase
 ParamUpdaterBase ()
 
 ParamUpdaterBase (const ParamUpdaterBase &PU)
 
virtual ~ParamUpdaterBase ()
 
virtual void update ()
 
virtual void addParam (Param *param)
 Adds a parameter to the stack. More...
 
virtual void reset ()
 Clears the parameters stack. More...
 
list< Param * > getParams ()
 Returns the list of parameters. More...
 
- Public Member Functions inherited from Handler
virtual ~Handler ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from ParamUpdaterBase
typedef list< Param * >::iterator PIT
 
- Protected Attributes inherited from ParamUpdaterBase
list< Param * > _params
 List of the parameters affected by this updater. More...
 

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.

Constructor & Destructor Documentation

template<class SC>
ParamUpdater< SC >::ParamUpdater ( bool(SC::*)(void)  updateFuncPtr)
inline
356  {
357  _myUpdaterFunction = updateFuncPtr;
358  }
bool(SC::* _myUpdaterFunction)(void)
Definition: param.h:350
template<class SC>
ParamUpdater< SC >::ParamUpdater ( const ParamUpdater< SC > &  PU)
inline

References ParamUpdater< SC >::_myComponent, ParamUpdater< SC >::_myUpdaterFunction, and ParamUpdaterBase::_params.

361  {
362  _params.assign(PU._params.begin(), PU._params.end());
365  }
SC * _myComponent
Definition: param.h:351
list< Param * > _params
List of the parameters affected by this updater.
Definition: param.h:304
bool(SC::* _myUpdaterFunction)(void)
Definition: param.h:350
template<class SC>
virtual ParamUpdater< SC >::~ParamUpdater ( )
inlinevirtual
368  {
369  for(PIT pit = _params.begin(); pit != _params.end(); pit++)
370  if((*pit)->getUpdater() == this) (*pit)->setUpdater(0);
371  }
list< Param * > _params
List of the parameters affected by this updater.
Definition: param.h:304
list< Param * >::iterator PIT
Definition: param.h:308

Member Function Documentation

template<class SC>
virtual SC* ParamUpdater< SC >::getComponent ( )
inlinevirtual

Accessor to the SimCimponent.

Implements ParamUpdaterBase.

392 {return _myComponent;}
SC * _myComponent
Definition: param.h:351
template<class SC>
virtual void ParamUpdater< SC >::init ( )
inlinevirtual

Sets the pointer to the SimComponent.

It is deduced from the parameters' owner.

Implements ParamUpdaterBase.

375  {
376  _myComponent = dynamic_cast<SC*> ( (*_params.begin())->getOwner() );
377 
378  for(PIT pit = ++_params.begin(); pit != _params.end(); pit++)
379  assert(_myComponent == (*pit)->getOwner());
380  }
SC * _myComponent
Definition: param.h:351
list< Param * > _params
List of the parameters affected by this updater.
Definition: param.h:304
list< Param * >::iterator PIT
Definition: param.h:308
template<class SC>
void ParamUpdater< SC >::setFuncPtr ( bool(SC::*)(void)  updateFuncPtr)
inline

Sets the pointer to the updating function.

388  {
389  _myUpdaterFunction = updateFuncPtr;
390  }
bool(SC::* _myUpdaterFunction)(void)
Definition: param.h:350
template<class SC>
virtual bool ParamUpdater< SC >::update ( unsigned int  generation)
inlinevirtual

Calls the SimComponent's updating function using its pointer.

Implements ParamUpdaterBase.

383  {
384  return ((( dynamic_cast<SC*> (_myComponent))->*_myUpdaterFunction) ());
385  }
SC * _myComponent
Definition: param.h:351
bool(SC::* _myUpdaterFunction)(void)
Definition: param.h:350

Member Data Documentation

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

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

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR