15#ifndef __vtkEventBroker_h
16#define __vtkEventBroker_h
33class vtkCallbackCommand;
53 void PrintSelf(ostream& os, vtkIndent indent)
override;
76 unsigned long eid,
void *clientData,
void *callData);
101 void RemoveObservations (vtkObject *subject,
unsigned long event, vtkObject *observer, vtkCallbackCommand *notify);
110 unsigned long event = 0,
111 vtkObject *observer =
nullptr,
112 vtkCallbackCommand *notify =
nullptr,
113 unsigned int maxReturnedObservations = 0);
116 unsigned long event = 0,
117 vtkObject *observer =
nullptr,
118 vtkCallbackCommand *notify =
nullptr);
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);
159 vtkGetObjectMacro (TimerLog, vtkTimerLog);
192 this->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;
253 vtkGetObjectMacro(RequestModifiedCallback, vtkCallbackCommand);
289 void (*ScriptHandler) (
const char* script,
void* clientData);
308 void DetachObservations();
322 static unsigned int Count;
Utility class to make sure qSlicerModuleManager is initialized before it is used.
~vtkEventBrokerInitialize()
vtkEventBrokerInitialize()
vtkEventBrokerInitialize Self
Class that manages adding and deleting of observers with events.
static void classFinalize()
void RemoveObservations(vtkObject *subject, vtkObject *observer)
void RemoveObservations(vtkObject *subject, unsigned long event, vtkObject *observer)
static void Callback(vtkObject *caller, unsigned long eid, void *clientData, void *callData)
const char * GetEventModeAsString()
bool GetObservationExist(vtkObject *subject, unsigned long event=0, vtkObject *observer=nullptr, vtkCallbackCommand *notify=nullptr)
Returns true if such an observation exists (arguments are same as for GetObservations)
void RemoveObservations(vtkObject *observer)
vtkObservation * DequeueObservation()
void SetEventModeToSynchronous()
int GenerateGraphFile(const char *graphFile)
virtual void SetRequestModifiedCallback(vtkCallbackCommand *callback)
void * ScriptHandlerClientData
void SetEventModeToAsynchronous()
void InvokeObservation(vtkObservation *observation, unsigned long eid, void *callData)
void QueueObservation(vtkObservation *observation, unsigned long eid, void *callData)
Event queue processing.
virtual void SetTimerLog(vtkTimerLog *timerLog)
Timer log class for calculating elapsed time for event invocations.
virtual bool RequestModified(vtkObject *object)
static vtkEventBroker * GetInstance()
Return the singleton instance with no reference counting.
void SetEventMode(int eventMode)
void LogEvent(vtkObservation *observation)
void DetachObservation(vtkObservation *observation)
void RemoveObservation(vtkObservation *observation)
Remove observation from the broker and event queue.
vtkObservation * GetNthQueuedObservation(int n)
void RemoveObservations(ObservationVector observations)
ObservationVector GetObservations(vtkObject *subject, unsigned long event=0, vtkObject *observer=nullptr, vtkCallbackCommand *notify=nullptr, unsigned int maxReturnedObservations=0)
std::map< vtkObject *, ObservationVector > ObjectToObservationVectorMap
int GetNumberOfObservations()
Accessors for Observations.
void ProcessEvent(vtkObservation *observation, vtkObject *caller, unsigned long eid, void *callData)
Process any event that comes from either subject or observer.
void SetScriptHandler(void(*scriptHandler)(const char *script, void *clientData), void *clientData)
Sets the method pointer to be used for processing script observations.
vtkObservation * AddObservation(vtkObject *subject, unsigned long event, vtkObject *observer, vtkCallbackCommand *notify, float priority=0.0f)
vtkCollection * GetObservationsForObserver(vtkObject *observer)
ObservationVector GetSubjectObservations(vtkObject *subject)
Fast retrieve of all observations of a given subject.
vtkEventBroker(const vtkEventBroker &)
static void classInitialize()
Singleton management functions.
void RemoveObservationsForSubjectByTag(vtkObject *subject, unsigned long tag)
vtkObservation * GetNthObservation(int n)
ObjectToObservationVectorMap SubjectMap
maps to manage quick lookup by object
void PrintSelf(ostream &os, vtkIndent indent) override
void AttachObservation(vtkObservation *observation)
vtkCollection * GetObservationsForCallback(vtkCallbackCommand *callback)
void OpenLogFile()
Open and close the log file.
ObservationVector GetObservationsForSubjectByTag(vtkObject *subject, unsigned long tag)
vtkCollection * GetObservationsForSubject(vtkObject *subject)
std::set< vtkObservation * > ObservationVector
vtkCallbackCommand * RequestModifiedCallback
void operator=(const vtkEventBroker &)
vtkObservation * AddObservation(vtkObject *subject, const char *event, const char *script)
std::deque< vtkObservation * > EventQueue
The event queue of triggered but not-yet-invoked observations.
int GetNumberOfQueuedObservations()
ObjectToObservationVectorMap ObserverMap
void RemoveObservations(vtkObject *subject, unsigned long event, vtkObject *observer, vtkCallbackCommand *notify)
static vtkEventBroker * New()
~vtkEventBroker() override
Stores information about the relationship between a Subject and an Observer.
static vtkEventBrokerInitialize vtkEventBrokerInitializer