150#include "vtkCommonCoreModule.h"
152#include "vtkSetGet.h"
157VTK_ABI_NAMESPACE_BEGIN
158class vtkSubjectHelper;
174 void*
operator new(
size_t tSize);
175 void operator delete(
void* p);
198 void SetDebug(
bool debugFlag);
204 static
void BreakOnError();
212 virtual
void Modified();
295 template <
class U,
class T>
297 unsigned long event, U observer,
void (T::*callback)(), float priority = 0.0f)
299 vtkClassMemberCallback<T>* callable =
new vtkClassMemberCallback<T>(observer, callback);
302 return this->AddTemplatedObserver(event, callable, priority);
304 template <
class U,
class T>
306 void (T::*callback)(
vtkObject*, unsigned long, void*), float priority = 0.0f)
308 vtkClassMemberCallback<T>* callable =
new vtkClassMemberCallback<T>(observer, callback);
311 return this->AddTemplatedObserver(event, callable, priority);
320 template <
class U,
class T>
322 bool (T::*callback)(
vtkObject*, unsigned long, void*), float priority = 0.0f)
324 vtkClassMemberCallback<T>* callable =
new vtkClassMemberCallback<T>(observer, callback);
327 return this->AddTemplatedObserver(event, callable, priority);
398 class vtkClassMemberCallbackBase
405 virtual bool operator()(
vtkObject*,
unsigned long,
void*) = 0;
406 virtual ~vtkClassMemberCallbackBase() =
default;
416 class vtkClassMemberHandlerPointer
423 if ((this->VoidPointer =
dynamic_cast<T*
>(o)) ==
nullptr)
426 this->VoidPointer = o;
428 this->WeakPointer = o;
429 this->UseWeakPointer =
true;
431 void operator=(
void* o)
433 this->VoidPointer = o;
434 this->WeakPointer =
nullptr;
435 this->UseWeakPointer =
false;
439 if (this->UseWeakPointer && !this->WeakPointer.GetPointer())
443 return static_cast<T*
>(this->VoidPointer);
458 class vtkClassMemberCallback :
public vtkClassMemberCallbackBase
460 vtkClassMemberHandlerPointer<T> Handler;
461 void (T::*Method1)();
462 void (T::*Method2)(
vtkObject*, unsigned long, void*);
463 bool (T::*Method3)(
vtkObject*, unsigned long, void*);
466 vtkClassMemberCallback(T* handler,
void (T::*method)())
468 this->Handler = handler;
469 this->Method1 = method;
470 this->Method2 =
nullptr;
471 this->Method3 =
nullptr;
474 vtkClassMemberCallback(T* handler,
void (T::*method)(
vtkObject*, unsigned long, void*))
476 this->Handler = handler;
477 this->Method1 =
nullptr;
478 this->Method2 = method;
479 this->Method3 =
nullptr;
482 vtkClassMemberCallback(T* handler,
bool (T::*method)(
vtkObject*, unsigned long, void*))
484 this->Handler = handler;
485 this->Method1 =
nullptr;
486 this->Method2 =
nullptr;
487 this->Method3 = method;
489 ~vtkClassMemberCallback()
override =
default;
492 bool operator()(
vtkObject* caller,
unsigned long event,
void* calldata)
override
494 T* handler = this->Handler.GetPointer();
499 (handler->*this->Method1)();
501 else if (this->Method2)
503 (handler->*this->Method2)(caller, event, calldata);
505 else if (this->Method3)
507 return (handler->*this->Method3)(caller, event, calldata);
527 unsigned long AddTemplatedObserver(
528 unsigned long event, vtkClassMemberCallbackBase* callable,
float priority);
530 friend class vtkObjectCommandInternal;
superclass for callback/observer methods
a simple class to control print indentation
abstract base class for most VTK objects
virtual void ObjectFinalize()
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 RemoveObservers(const char *event)
vtkSubjectHelper * SubjectHelper
std::string GetObjectDescription() const override
The object description printed in messages and PrintSelf output.
static void SetGlobalWarningDisplay(vtkTypeBool val)
This is a global flag that controls whether any debug, warning or error messages are displayed.
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.
vtkTypeBool InvokeEvent(unsigned long event)
void InternalGrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
These methods allow a command to exclusively grab all events.
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.
virtual std::string GetObjectName() const
Set/get the name of this object for reporting purposes.
void UnRegisterInternal(vtkObjectBase *, vtkTypeBool check) override
void RemoveAllObservers()
void RegisterInternal(vtkObjectBase *, vtkTypeBool check) override
vtkTypeBool InvokeEvent(const char *event)
static void GlobalWarningDisplayOff()
This is a global flag that controls whether any debug, warning or error messages are displayed.
vtkTypeBool HasObserver(unsigned long event, vtkCommand *)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
vtkTypeBool InvokeEvent(unsigned long event, void *callData)
This method invokes an event and return whether the event was aborted or not.
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.
vtkTypeBool HasObserver(const char *event)
void RemoveObservers(unsigned long event)
virtual void SetObjectName(const std::string &objectName)
Set/get the name of this object for reporting purposes.
void RemoveObserver(unsigned long tag)
static vtkTypeBool GetGlobalWarningDisplay()
This is a global flag that controls whether any debug, warning or error messages are displayed.
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.
vtkTypeBool InvokeEvent(const char *event, void *callData)
This method invokes an event and return whether the event was aborted or not.
record modification and/or execution time
Non-templated superclass for vtkWeakPointer.
vtkTypeUInt32 vtkMTimeType
#define VTK_MARSHALGETTER(property)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_MARSHALEXCLUDE(reason)