|
| vtkBaseTypeMacro (vtkObject, vtkObjectBase) |
|
virtual void | DebugOn () |
|
virtual void | DebugOff () |
|
bool | GetDebug () |
|
void | SetDebug (bool debugFlag) |
|
virtual void | Modified () |
|
virtual vtkMTimeType | GetMTime () |
|
void | PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE |
|
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
|
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
|
vtkCommand * | GetCommand (unsigned long tag) |
|
void | RemoveObserver (vtkCommand *) |
|
void | RemoveObservers (unsigned long event, vtkCommand *) |
|
void | RemoveObservers (const char *event, vtkCommand *) |
|
int | HasObserver (unsigned long event, vtkCommand *) |
|
int | HasObserver (const char *event, vtkCommand *) |
|
void | RemoveObserver (unsigned long tag) |
|
void | RemoveObservers (unsigned long event) |
|
void | RemoveObservers (const char *event) |
|
void | RemoveAllObservers () |
|
int | HasObserver (unsigned long event) |
|
int | HasObserver (const char *event) |
|
template<class U , class T > |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
|
template<class U , class T > |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
|
template<class U , class T > |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
|
int | InvokeEvent (unsigned long event, void *callData) |
|
int | InvokeEvent (const char *event, void *callData) |
|
int | InvokeEvent (unsigned long event) |
|
int | InvokeEvent (const char *event) |
|
const char * | GetClassName () const |
|
virtual vtkTypeBool | IsA (const char *name) |
|
virtual void | Delete () |
|
virtual void | FastDelete () |
|
void | InitializeObjectBase () |
|
void | Print (ostream &os) |
|
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
|
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
|
virtual void | Register (vtkObjectBase *o) |
|
virtual void | UnRegister (vtkObjectBase *o) |
|
int | GetReferenceCount () |
|
void | SetReferenceCount (int) |
|
void | PrintRevisions (ostream &) |
|
abstract base class for most VTK objects
vtkObject is the base class for most objects in the visualization toolkit. vtkObject provides methods for tracking modification time, debugging, printing, and event callbacks. Most objects created within the VTK framework should be a subclass of vtkObject or one of its children. The few exceptions tend to be very small helper classes that usually never get instantiated or situations where multiple inheritance gets in the way. vtkObject also performs reference counting: objects that are reference counted exist as long as another object uses them. Once the last reference to a reference counted object is removed, the object will spontaneously destruct.
- Warning
- Note: in VTK objects should always be created with the New() method and deleted with the Delete() method. VTK objects cannot be allocated off the stack (i.e., automatic objects) because the constructor is a protected method.
- See also
- vtkCommand vtkTimeStamp
template<class U , class T >
unsigned long vtkObject::AddObserver |
( |
unsigned long |
event, |
|
|
U |
observer, |
|
|
void(T::*)() |
callback, |
|
|
float |
priority = 0.0f |
|
) |
| |
|
inline |
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:
void foo(void);\n
abstract base class for most VTK objects
Definition: vtkObject.h:54
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 its dead pointer will be used the next time the event occurs. Typical usage of these functions is as follows:
SomeClassOfMine* observer = SomeClassOfMine::New();\n
to_observe->AddObserver(event, observer, \&SomeClassOfMine::SomeMethod);
Note that this does not affect the reference count of a vtkObjectBase-derived 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.