[vtk-developers] Class Event Observers

Brad King brad.king at kitware.com
Thu Aug 11 11:38:00 EDT 2005


Goodwin Lawlor wrote:
> I'd appreciate any thoughts people may have on a proposal for 
> class/global event observers.

Can you post a sample use case for this please?

Also, whatever decision results from this discussion please do not try 
to add this before the upcoming VTK 5.0 release.  I don't want to get 
the interface wrong the first time and then have to support it because 
it was in a release.

> One way I thought of implementing this is to add a static member pointer 
> to each class, pointing to the first class observer. Something like:
> 
> static vtkObserver *GlobalStart;

This is a singleton, so you will have to implement careful management of 
it.  Somehow all the observers must be destroyed on exit, but if they 
are not destroyed early enough their destructors may have already been 
unloaded!  Look at vtkFilteringInformationKeyManager and 
vtkDebugLeaksManager for example approaches to do this.

-Brad



More information about the vtk-developers mailing list