[vtk-developers] [Paraview-developers] Moving vtkMemberFunctionCommand to VTK

David Gobbi david.gobbi at gmail.com
Wed Oct 6 11:11:50 EDT 2010


I thought that I'd shoot this out for other people to proofread, so
that I don't have to do any follow-up commits to vtkObject.h just for
spelling mistakes and whatnot.  Thanks.

  // Description:
  // Overloads to AddObserver that allow developers to add class member
  // functions as callbacks for events.  The callback function can
  // be one of these two types:
  // \code
  // void foo(void)
  // void foo(vtkObject*, unsigned long, void*)
  // \endcode
  // If the callback is a member of a vtkObjectBase-derived object,
  // then the callback will automatically be disabled if the object
  // destructs (but the observer will not automatically be removed).
  // If the callback is a member of any other type of object, then
  // the observer must be removed before the object destructs or else
  // the observer will be left with a dangling pointer to a dead object.
  // Typical usage of these functions is as follows:
  // \code
  // vtkHandlerClass * observer = vtkHandlerClass::New();
  // to_observe->AddObserver(
  //   event, observer, &vtkHandlerClass::CallbackMethod);
  // \endcode
  // Note that this does not affect the reference count of a
  // vtkObjectBase-derived \c observer, which can be safely deleted
  // with the observer still in place. For non-vtkObjectBase observers,
  // the observer should never be deleted before it is removed.
  // Return value is a tag that can be used to remove the observer.



More information about the vtk-developers mailing list