SOFA API  1c8b807d
Open source framework for multi-physics simuation
sofa::core::DataTracker Struct Reference

#include <DataTracker.h>

Detailed Description

Tracking Data mechanism to be able to check when selected Data changed since their last clean.

The Data must be added to tracking system by calling "trackData". Then it can be checked if it changed with "hasChanged" since its last "clean".

Use datatrackers to check if your data have changed! Do not use BaseData's "isDirty()" method, as it has a completely different purpose: BaseData::isDirty() checks whether or not the data is up-to-date with its parent values while DataTracker::hasChanged(myData) checks whether the data has been modified since it has last been checked

Protected Attributes

DataTrackers m_dataTrackers
 

Public Member Functions

void trackData (const objectmodel::BaseData &data)
 
bool hasChanged (const objectmodel::BaseData &data) const
 
bool hasChanged () const
 Did one of the tracked data change since the last call to clean()? More...
 
void clean (const objectmodel::BaseData &data)
 
void clean ()
 comparison point is cleaned for all tracked Data More...
 
const std::map< const objectmodel::BaseData *, int > & getMapTrackedData ()
 Provide the map of tracked Data. More...
 

Attribute details

◆ m_dataTrackers

DataTrackers sofa::core::DataTracker::m_dataTrackers
protected

Function details

◆ clean() [1/2]

void sofa::core::DataTracker::clean ( )

comparison point is cleaned for all tracked Data

◆ clean() [2/2]

void sofa::core::DataTracker::clean ( const objectmodel::BaseData data)

comparison point is cleaned for the specified tracked Data

Warning
data must be a tracked Data
See also
trackData

◆ getMapTrackedData()

const std::map<const objectmodel::BaseData*,int>& sofa::core::DataTracker::getMapTrackedData ( )
inline

Provide the map of tracked Data.

◆ hasChanged() [1/2]

bool sofa::core::DataTracker::hasChanged ( ) const

Did one of the tracked data change since the last call to clean()?

◆ hasChanged() [2/2]

bool sofa::core::DataTracker::hasChanged ( const objectmodel::BaseData data) const

Did the data change since its last access?

Warning
data must be a tracked Data
See also
trackData

◆ trackData()

void sofa::core::DataTracker::trackData ( const objectmodel::BaseData data)

select a Data to track to be able to check if it was dirtied since the previous clean.

See also
isTrackedDataDirty