Update two dependent itk::DataObject


I created two itk::DataObject that are dependent and I would like to update both of them when any of the two is modified. I wonder if there is an easy way to do that (i.e. send a notification, from a DataObject, to another one that needs to be updated, or something similar)?
I think the UpdateTime might help me there since I can compare the last time they both have been updated but not sure it’s the best idea.


AddObserver method comes to mind, but I don’t know whether there is a Modified event.

As described, I would overload both the itk::Object::GetMTime methods to return the maximum MTime between the two objects.

Thank you guys for the answers.
@dzenanz correct me if I’m wrong but I think the Modified event is triggered by the Update method called on a itk::ProcessObject so every time my itk::DataObjkect is modified, the Modified event is triggered wright?

@blowekamp that would indeed give me the maximum MTime between the two objects but in this case, I need something that checks frequently the MTime value to make sure both objects are synchronized which means an Observer would be a better solution to avoid repeated check. I don’t see how I can use it to synchronize both objects?