[vtk-developers] Class Event Observers

Goodwin Lawlor goodwin.lawlor at ucd.ie
Fri Aug 12 09:01:50 EDT 2005


I'm resending this since it didn't seem to get through the first time:

Hi David,

David Cole wrote:

> Given this is your use case... it sounds like you only need this 
> behavior for a handful of classes. If you do end up with a class scope 
> implementation that works for your use case, maybe it should be 
> limited to just the classes you need it for. (With the ability add 
> more easily...?)


This is one example, another example is where vtk objects are firing 
virtual events into the tcl event loop. In a large app you may have many 
more than just a handfull of classes that would benefit from class 
observers.

>
> Class scope still seems too broad for a proper solution. Don't you 
> need to bind to specific instances? If I make two (or three, or more) 
> render widgets, do I want the same bindings for all of them?


Sure, but for one event you could have the class observer doing the 
default things and then add more instance observers to the same event 
doing instance specific things.

>
> A class observer would observe, what, *all* instances of the given 
> class? What if it's only appropriate for some of the instances? How 
> would you differentiate? And how would you even get to all the 
> instances of a given class...?
>
>
I have a feeling that the cost/benefit ratio of implementing this in vtk 
means it isn't worth it; it's best left to the application layer.

IMHO, its better discussed and canned rather then coded, discussed and 
canned.

Thanks,

Goodwin



More information about the vtk-developers mailing list