SOFA API  3944ba52
Open source framework for multi-physics simuation
sofa::core::DataTrackerFunctor< FunctorType > Class Template Reference

#include <DataTracker.h>

Inheritance diagram for sofa::core::DataTrackerFunctor< FunctorType >:

Detailed Description

template<typename FunctorType>
class sofa::core::DataTrackerFunctor< FunctorType >

A DDGNode that will call a given Functor as soon as one of its input changes (a pointer to this DataTrackerFunctor is passed as parameter in the functor)

Public Member Functions

 DataTrackerFunctor (FunctorType &functor)
 
void setDirtyValue () override
 
void update () override
 This method is needed by DDGNode. More...
 
- Public Member Functions inherited from sofa::core::objectmodel::DDGNode
 DDGNode ()
 Constructor. More...
 
virtual ~DDGNode ()
 Destructor. Automatically remove remaining links. More...
 
void addInput (DDGNode *n)
 Add a new input to this node. More...
 
void delInput (DDGNode *n)
 Remove an input from this node. More...
 
void addOutput (DDGNode *n)
 Add a new output to this node. More...
 
void delOutput (DDGNode *n)
 Remove an output from this node. More...
 
const DDGLinkContainergetInputs ()
 Get the list of inputs for this DDGNode. More...
 
const DDGLinkContainergetOutputs ()
 Get the list of outputs for this DDGNode. More...
 
bool isDirty (const core::ExecParams *) const
 Returns true if the DDGNode needs to be updated. More...
 
bool isDirty () const
 
virtual void setDirtyValue (const core::ExecParams *) final
 Indicate the value needs to be updated. More...
 
virtual void setDirtyOutputs (const core::ExecParams *) final
 Indicate the outputs needs to be updated. This method must be called after changing the value of this node. More...
 
virtual void setDirtyOutputs ()
 
void cleanDirty (const core::ExecParams *)
 Set dirty flag to false. More...
 
void cleanDirty ()
 
virtual void notifyEndEdit (const core::ExecParams *) final
 Notify links that the DGNode has been modified. More...
 
virtual void notifyEndEdit ()
 
void updateIfDirty (const core::ExecParams *) const
 Utility method to call update if necessary. This method should be called before reading of writing the value of this node. More...
 
void updateIfDirty () const
 

Additional Inherited Members

- Protected Attributes inherited from sofa::core::objectmodel::DDGNode
DDGLinkContainer inputs
 
DDGLinkContainer outputs
 
- Protected Member Functions inherited from sofa::core::objectmodel::DDGNode
virtual void doAddInput (DDGNode *n)
 
virtual void doDelInput (DDGNode *n)
 
virtual void doAddOutput (DDGNode *n)
 
virtual void doDelOutput (DDGNode *n)
 
void cleanDirtyOutputsOfInputs (const core::ExecParams *)
 the dirtyOutputs flags of all the inputs will be set to false More...
 
void cleanDirtyOutputsOfInputs ()
 

Constructor details

template<typename FunctorType >
sofa::core::DataTrackerFunctor< FunctorType >::DataTrackerFunctor ( FunctorType &  functor)
inline

Function details

template<typename FunctorType >
void sofa::core::DataTrackerFunctor< FunctorType >::setDirtyValue ( )
inlineoverridevirtual

The trick is here, this function is called as soon as the input data changes and can then trigger the callback

Reimplemented from sofa::core::objectmodel::DDGNode.

template<typename FunctorType >
void sofa::core::DataTrackerFunctor< FunctorType >::update ( )
inlineoverridevirtual

This method is needed by DDGNode.

Implements sofa::core::objectmodel::DDGNode.