63#include "vtkCommonCoreModule.h"
69class vtkSubjectHelper;
85 void*
operator new(
size_t tSize);
86 void operator delete(
void* p);
203 template <
class U,
class T>
205 unsigned long event, U observer,
void (T::*callback)(),
float priority = 0.0f)
207 vtkClassMemberCallback<T>* callable =
new vtkClassMemberCallback<T>(observer, callback);
210 return this->AddTemplatedObserver(event, callable,
priority);
212 template <
class U,
class T>
216 vtkClassMemberCallback<T>* callable =
new vtkClassMemberCallback<T>(observer, callback);
219 return this->AddTemplatedObserver(event, callable,
priority);
228 template <
class U,
class T>
232 vtkClassMemberCallback<T>* callable =
new vtkClassMemberCallback<T>(observer, callback);
235 return this->AddTemplatedObserver(event, callable,
priority);
288 class vtkClassMemberCallbackBase
295 virtual bool operator()(
vtkObject*,
unsigned long,
void*) = 0;
296 virtual ~vtkClassMemberCallbackBase() =
default;
306 class vtkClassMemberHandlerPointer
313 if ((this->VoidPointer =
dynamic_cast<T*
>(o)) ==
nullptr)
316 this->VoidPointer = o;
318 this->WeakPointer = o;
319 this->UseWeakPointer =
true;
321 void operator=(
void* o)
323 this->VoidPointer = o;
324 this->WeakPointer =
nullptr;
325 this->UseWeakPointer =
false;
329 if (this->UseWeakPointer && !this->WeakPointer.GetPointer())
333 return static_cast<T*
>(this->VoidPointer);
348 class vtkClassMemberCallback :
public vtkClassMemberCallbackBase
350 vtkClassMemberHandlerPointer<T> Handler;
351 void (T::*Method1)();
352 void (T::*Method2)(
vtkObject*,
unsigned long,
void*);
353 bool (T::*Method3)(
vtkObject*,
unsigned long,
void*);
356 vtkClassMemberCallback(T* handler,
void (T::*method)())
358 this->Handler = handler;
359 this->Method1 = method;
360 this->Method2 =
nullptr;
361 this->Method3 =
nullptr;
364 vtkClassMemberCallback(T* handler,
void (T::*method)(
vtkObject*,
unsigned long,
void*))
366 this->Handler = handler;
367 this->Method1 =
nullptr;
368 this->Method2 = method;
369 this->Method3 =
nullptr;
372 vtkClassMemberCallback(T* handler,
bool (T::*method)(
vtkObject*,
unsigned long,
void*))
374 this->Handler = handler;
375 this->Method1 =
nullptr;
376 this->Method2 =
nullptr;
377 this->Method3 = method;
379 ~vtkClassMemberCallback()
override =
default;
382 bool operator()(
vtkObject* caller,
unsigned long event,
void* calldata)
override
384 T* handler = this->Handler.GetPointer();
389 (handler->*this->Method1)();
391 else if (this->Method2)
393 (handler->*this->Method2)(caller, event, calldata);
395 else if (this->Method3)
397 return (handler->*this->Method3)(caller, event, calldata);
409 unsigned long AddTemplatedObserver(
410 unsigned long event, vtkClassMemberCallbackBase* callable,
float priority);
412 friend class vtkObjectCommandInternal;
superclass for callback/observer methods
a simple class to control print indentation
abstract base class for most VTK objects
void operator=(const vtkObjectBase &)
abstract base class for most VTK objects
vtkBaseTypeMacro(vtkObject, vtkObjectBase)
void InternalReleaseFocus()
These methods allow a command to exclusively grab all events.
virtual void DebugOn()
Turn debugging output on.
vtkTypeBool HasObserver(unsigned long event)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void RemoveObservers(const char *event)
vtkSubjectHelper * SubjectHelper
unsigned long AddObserver(unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
Allow user to set the AbortFlagOn() with the return value of the callback method.
vtkTypeBool HasObserver(const char *event, vtkCommand *)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
virtual void DebugOff()
Turn debugging output off.
unsigned long AddObserver(unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
void InternalGrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
These methods allow a command to exclusively grab all events.
static void SetGlobalWarningDisplay(int val)
This is a global flag that controls whether any debug, warning or error messages are displayed.
void RemoveObserver(vtkCommand *)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
void RemoveObservers(unsigned long event, vtkCommand *)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
int InvokeEvent(unsigned long event)
void UnRegisterInternal(vtkObjectBase *, vtkTypeBool check) override
void RemoveAllObservers()
void RegisterInternal(vtkObjectBase *, vtkTypeBool check) override
static void GlobalWarningDisplayOff()
This is a global flag that controls whether any debug, warning or error messages are displayed.
int InvokeEvent(const char *event, void *callData)
This method invokes an event and return whether the event was aborted or not.
virtual void Modified()
Update the modification time for this object.
vtkTypeBool HasObserver(unsigned long event, vtkCommand *)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
int InvokeEvent(unsigned long event, void *callData)
This method invokes an event and return whether the event was aborted or not.
static int GetGlobalWarningDisplay()
This is a global flag that controls whether any debug, warning or error messages are displayed.
unsigned long AddObserver(unsigned long event, vtkCommand *, float priority=0.0f)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
void RemoveObservers(const char *event, vtkCommand *)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
unsigned long AddObserver(const char *event, vtkCommand *, float priority=0.0f)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
void SetDebug(bool debugFlag)
Set the value of the debug flag.
vtkTypeBool HasObserver(const char *event)
static void BreakOnError()
This method is called when vtkErrorMacro executes.
static void GlobalWarningDisplayOn()
This is a global flag that controls whether any debug, warning or error messages are displayed.
bool GetDebug()
Get the value of the debug flag.
virtual vtkMTimeType GetMTime()
Return this object's modified time.
void RemoveObservers(unsigned long event)
int InvokeEvent(const char *event)
void RemoveObserver(unsigned long tag)
unsigned long AddObserver(unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
vtkCommand * GetCommand(unsigned long tag)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
record modification and/or execution time
Non-templated superclass for vtkWeakPointer.
vtkTypeUInt32 vtkMTimeType