[Insight-users] two questions about observer.

Luis Ibanez luis.ibanez at kitware.com
Tue, 06 Apr 2004 16:08:30 -0400


Hi Zhao,

1) Yes, you can add the same
   Command/Observer to several filters.

2) When the Command is invoked, the
   Execute() method receives two parameters,
   the first one is a pointer to the object
   that triggered the action (the object that
   invoked the event).

   GetClass name will not help you here, you
   probably want to do something more explicit,
   such as comparing pointers.

You may write more robust code by using several
different Observers instead of trying to overwork
a single observer.

Following the example of Biological systems, your
code will be more robust when formed by conglomerates
of simple and small pieces instead of a few very
complex systems. Debugging is also easier with multiple
Observers since it is possible to identify the culprits
of misbehavior.



Regards,



   Luis



--------------
Zhao wrote:

> Hi all,
> 	I got two questions about observer and processor.
> 
> 	First, may I add one observer to several processors?
> 	Second, how can I know in an observer which processor is calling him? I user "caller->GetClassName", but the compiler told me "'GetClassNameA' : is not a member of 'ProcessObject'". Thanks
> 
> 
> Zhao
> "{"n왨x%HȠ۬z"J+m?f?X)ߣ(!rs==