54 #include "vtkSetGet.h"
58 class vtkSubjectHelper;
72 void*
operator new(
size_t tSize );
73 void operator delete(
void* p );
77 virtual void DebugOn();
80 virtual void DebugOff();
86 void SetDebug(
bool debugFlag);
90 static void BreakOnError();
96 virtual void Modified();
99 virtual unsigned long GetMTime();
110 static void SetGlobalWarningDisplay(
int val);
114 static int GetGlobalWarningDisplay();
128 unsigned long AddObserver(
unsigned long event,
vtkCommand *,
130 unsigned long AddObserver(
const char *event,
vtkCommand *,
134 void RemoveObservers(
unsigned long event,
vtkCommand *);
135 void RemoveObservers(
const char *event,
vtkCommand *);
136 int HasObserver(
unsigned long event,
vtkCommand *);
137 int HasObserver(
const char *event,
vtkCommand *);
139 void RemoveObserver(
unsigned long tag);
140 void RemoveObservers(
unsigned long event);
141 void RemoveObservers(
const char *event);
142 void RemoveAllObservers();
143 int HasObserver(
unsigned long event);
144 int HasObserver(
const char *event);
167 template <
class U,
class T>
169 U observer,
void (T::*callback)(),
float priority=0.0f)
171 vtkClassMemberCallback<T> *callable =
172 new vtkClassMemberCallback<T>(observer, callback);
175 return this->AddTemplatedObserver(event, callable,
priority);
177 template <
class U,
class T>
179 U observer,
void (T::*callback)(
vtkObject*,
unsigned long,
void*),
182 vtkClassMemberCallback<T> *callable =
183 new vtkClassMemberCallback<T>(observer, callback);
186 return this->AddTemplatedObserver(event, callable,
priority);
193 template <
class U,
class T>
195 U observer,
bool (T::*callback)(
vtkObject*,
unsigned long,
void*),
198 vtkClassMemberCallback<T> *callable =
199 new vtkClassMemberCallback<T>(observer, callback);
202 return this->AddTemplatedObserver(event, callable,
priority);
212 int InvokeEvent(
unsigned long event,
void *callData);
213 int InvokeEvent(
const char *event,
void *callData);
241 void InternalReleaseFocus();
255 class vtkClassMemberCallbackBase
261 virtual bool operator()(
vtkObject*,
unsigned long,
void*) = 0;
262 virtual ~vtkClassMemberCallbackBase(){}
270 class vtkClassMemberHandlerPointer
277 if ((this->VoidPointer = dynamic_cast<T*>(o)) == 0)
280 this->VoidPointer = o;
282 this->WeakPointer = o;
283 this->UseWeakPointer =
true;
285 void operator=(
void *o)
287 this->VoidPointer = o;
288 this->WeakPointer = 0;
289 this->UseWeakPointer =
false;
293 if (this->UseWeakPointer && !this->WeakPointer.GetPointer())
297 return static_cast<T*
>(this->VoidPointer);
309 class vtkClassMemberCallback :
public vtkClassMemberCallbackBase
311 vtkClassMemberHandlerPointer<T> Handler;
312 void (T::*Method1)();
313 void (T::*Method2)(
vtkObject*,
unsigned long,
void*);
314 bool (T::*Method3)(
vtkObject*,
unsigned long,
void*);
318 vtkClassMemberCallback(T* handler,
void (T::*method)())
320 this->Handler = handler;
321 this->Method1 = method;
322 this->Method2 = NULL;
323 this->Method3 = NULL;
326 vtkClassMemberCallback(
327 T* handler,
void (T::*method)(
vtkObject*,
unsigned long,
void*))
329 this->Handler = handler;
330 this->Method1 = NULL;
331 this->Method2 = method;
332 this->Method3 = NULL;
335 vtkClassMemberCallback(
336 T* handler,
bool (T::*method)(
vtkObject*,
unsigned long,
void*))
338 this->Handler = handler;
339 this->Method1 = NULL;
340 this->Method2 = NULL;
341 this->Method3 = method;
343 virtual ~vtkClassMemberCallback() { }
346 virtual bool operator()(
347 vtkObject* caller,
unsigned long event,
void* calldata)
349 T *handler = this->Handler.GetPointer();
354 (handler->*this->Method1)();
356 else if (this->Method2)
358 (handler->*this->Method2)(caller, event, calldata);
360 else if (this->Method3)
362 return (handler->*this->Method3)(caller, event, calldata);
371 unsigned long AddTemplatedObserver(
372 unsigned long event, vtkClassMemberCallbackBase* callable,
float priority);
374 friend class vtkObjectCommandInternal;
unsigned long AddObserver(unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
static vtkObjectBase * New()
abstract base class for most VTK objects
#define VTKCOMMONCORE_EXPORT
record modification and/or execution time
int InvokeEvent(unsigned long event)
virtual void PrintSelf(ostream &os, vtkIndent indent)
virtual void RegisterInternal(vtkObjectBase *, int check)
static void GlobalWarningDisplayOff()
unsigned long AddObserver(unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
superclass for callback/observer methods
static void SetGlobalWarningDisplay(int val)
a simple class to control print indentation
Non-templated superclass for vtkWeakPointer.
abstract base class for most VTK objects
int InvokeEvent(const char *event)
virtual void UnRegisterInternal(vtkObjectBase *, int check)
unsigned long AddObserver(unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
void operator=(const vtkObjectBase &)
vtkSubjectHelper * SubjectHelper
static void GlobalWarningDisplayOn()