[vtk-developers] Class Event Observers

David Cole david.cole at kitware.com
Thu Aug 11 12:11:45 EDT 2005


I second the call for a sample use case posting...

It's gotta be good, too; I'm already biased against singletons in 
libraries... Singletons are much more manageable in the final 
application (the library client, not the library) in my opinion.


David


Brad King wrote:

> 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
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>




More information about the vtk-developers mailing list