[IGSTK-Developers] Observer/Observable pattern

Ziv Yaniv zivy at isis.imac.georgetown.edu
Fri Feb 23 12:24:10 EST 2007


Hi All,

The following question is with regard to ITK, but it spills over to
IGSTK, so I'm sending it to this development list as I'm not on the ITK
developers one.

I would like to understand the reasoning behind the design of the
ITK observer/observable pattern implementation. According to the
documentation of the AddObserver() method in itk::Object I cannot
have the same Observer attached to several objects, as observable
objects are responsible for the observer's memory. This is
reflected in the use of a raw pointer to a itk::Command object in
the itk::Object::AddObserver() method.

In the spirit of ITK I expected the AddObserver method to receive
a SmartPointer which also allows a single observer
attached to multiple objects, as the memory would be released
when the last observable deleted its observers.

Am I missing something? Should this go into a bug/feature request on
the ITK side?

             regards
                 Ziv



More information about the IGSTK-Developers mailing list