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

#include <DataTrackerFunctor.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
 Returns true if the DDGNode needs to be updated. More...
 
virtual void setDirtyOutputs ()
 Indicate the outputs needs to be updated. This method must be called after changing the value of this node. More...
 
void cleanDirty ()
 Set dirty flag to false. More...
 
virtual void notifyEndEdit ()
 Notify links that the DGNode has been modified. More...
 
void updateIfDirty () const
 Utility method to call update if necessary. This method should be called before reading of writing the value of this node. More...
 

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 ()
 the dirtyOutputs flags of all the inputs will be set to false More...
 

Constructor details

◆ DataTrackerFunctor()

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

Function details

◆ setDirtyValue()

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.

◆ update()

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

This method is needed by DDGNode.

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