15 #ifndef __vtkEventBroker_h 16 #define __vtkEventBroker_h 22 #include <vtkObject.h> 33 class vtkCallbackCommand;
53 void PrintSelf(ostream& os, vtkIndent indent)
override;
75 static void Callback(vtkObject *caller,
76 unsigned long eid,
void *clientData,
void *callData);
82 vtkObservation *AddObservation (vtkObject *subject,
unsigned long event, vtkObject *observer, vtkCallbackCommand *notify,
float priority=0.0f);
87 vtkObservation *AddObservation (vtkObject *subject,
const char *event,
const char *script);
98 void RemoveObservations (vtkObject *observer);
99 void RemoveObservations (vtkObject *subject, vtkObject *observer);
100 void RemoveObservations (vtkObject *subject,
unsigned long event, vtkObject *observer);
101 void RemoveObservations (vtkObject *subject,
unsigned long event, vtkObject *observer, vtkCallbackCommand *notify);
102 void RemoveObservationsForSubjectByTag (vtkObject *subject,
unsigned long tag);
110 unsigned long event = 0,
111 vtkObject *observer =
nullptr,
112 vtkCallbackCommand *notify =
nullptr,
113 unsigned int maxReturnedObservations = 0);
115 bool GetObservationExist (vtkObject *subject,
116 unsigned long event = 0,
117 vtkObject *observer =
nullptr,
118 vtkCallbackCommand *notify =
nullptr);
119 ObservationVector GetObservationsForSubjectByTag (vtkObject *subject,
unsigned long tag);
125 vtkCollection *GetObservationsForSubject (vtkObject *subject);
126 vtkCollection *GetObservationsForObserver (vtkObject *observer);
127 vtkCollection *GetObservationsForCallback (vtkCallbackCommand* callback);
131 int GetNumberOfObservations();
136 void ProcessEvent (
vtkObservation *observation, vtkObject *caller,
unsigned long eid,
void *callData);
141 vtkBooleanMacro (EventLogging,
int);
142 vtkSetMacro (EventLogging,
int);
143 vtkGetMacro (EventLogging,
int);
148 vtkSetMacro (EventNestingLevel,
int);
149 vtkGetMacro (EventNestingLevel,
int);
153 vtkSetStringMacro (LogFileName);
154 vtkGetStringMacro (LogFileName);
158 virtual void SetTimerLog(vtkTimerLog* timerLog);
159 vtkGetObjectMacro (TimerLog, vtkTimerLog);
164 void CloseLogFile ();
174 int GenerateGraphFile (
const char *graphFile );
186 vtkGetMacro(EventMode,
int);
192 this->ProcessEventQueue();
216 void QueueObservation (
vtkObservation *observation,
unsigned long eid,
218 int GetNumberOfQueuedObservations ();
221 void InvokeObservation (
vtkObservation *observation,
unsigned long eid,
223 void ProcessEventQueue ();
232 vtkBooleanMacro (CompressCallData,
int);
233 vtkGetMacro (CompressCallData,
int);
234 vtkSetMacro (CompressCallData,
int);
238 void SetScriptHandler (
void (*scriptHandler) (
const char* script,
void *clientData),
void *clientData )
240 this->ScriptHandler = scriptHandler;
241 this->ScriptHandlerClientData = clientData;
248 virtual bool RequestModified(vtkObject*
object);
252 virtual void SetRequestModifiedCallback(vtkCallbackCommand* callback);
253 vtkGetObjectMacro(RequestModifiedCallback, vtkCallbackCommand);
263 static void classInitialize();
264 static void classFinalize();
289 void (*ScriptHandler) (
const char* script,
void* clientData);
308 void DetachObservations();
322 static unsigned int Count;
void SetScriptHandler(void(*scriptHandler)(const char *script, void *clientData), void *clientData)
Sets the method pointer to be used for processing script observations
ObjectToObservationVectorMap SubjectMap
maps to manage quick lookup by object
static vtkEventBrokerInitialize vtkEventBrokerInitializer
Stores information about the relationship between a Subject and an Observer.
Class that manages adding and deleting of observers with events.
vtkCallbackCommand * RequestModifiedCallback
std::map< vtkObject *, ObservationVector > ObjectToObservationVectorMap
void * ScriptHandlerClientData
void SetEventModeToAsynchronous()
ObjectToObservationVectorMap ObserverMap
std::set< vtkObservation *> ObservationVector
vtkEventBrokerInitialize Self
const char * GetEventModeAsString()
std::deque< vtkObservation *> EventQueue
The event queue of triggered but not-yet-invoked observations.
void SetEventModeToSynchronous()
Utility class to make sure qSlicerModuleManager is initialized before it is used. ...
void SetEventMode(int eventMode)