[IGSTK-Users] igstkObserverObjectMacro and igstkObserverMacro
Luis Ibanez
luis.ibanez at kitware.com
Mon Apr 16 11:26:25 EDT 2007
Hi Torleif,
The rationale is that classes that derive from the igstk::Object
are associated with macros that have the "Object" word. That is,
the "Object" word refers to whether the payload is a derived class
from the igstk::Object class or not.
Therefore
igstObserverObjectMacro --> refers to an observer to events
carrying payloads that derive
from the igstk::Object class.
and
igstkObserverMacro --> refers to an observer to events
carrying payloads that do not derive
from the igstk::Object class.
Payloads that do not derive from the igstk::Object can be managed
by reference or by value, while the ones that derive from igstk::Object
are managed by smart pointers and pointers.
In general, we avoid raw pointers in IGSTK. There are too many things
that can go wrong with raw pointers. They are extremely unsafe. We try
to stick to references, and to smart pointers as the mechanisms for
passing data around.
Regards,
Luis
-----------------------
Torleif Sandnes wrote:
> Hi.
>
> I have a short question on the rationale behind the naming of the
> macros igstObserverObjectMacro and igstkObserverMacro:
> Why is igstkObserverObjectMacro the macro that defines an observer with
> a *pointer* to a payload, while igstkObserverMacro defines an observer
> with an actual object as payload? This seems counter- inituitive to me.
>
> IMHO, a name like igstkObserverPointerObjectMacro for the macro that
> defines an observer that has a pointer to an object, and
> igstkObserverObjectMacro for the macro that defines an observer with an
> actual object would be better.
>
> Regards,
>
> Torleif Sandnes
> Sintef Health Research Norway
> _______________________________________________
> IGSTK-Users mailing list
> IGSTK-Users at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users
>
More information about the IGSTK-Users
mailing list