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);
238 void SetScriptHandler (
void (*scriptHandler) (
const char* script,
void *clientData),
void *clientData )
238 void SetScriptHandler (
void (*scriptHandler) (
const char* script,
void *clientData),
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
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
friend class vtkObservation
vtkObservation can call these methods
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.
void(* ScriptHandler)(const char *script, void *clientData)
int GetNumberOfQueuedObservations()
ObjectToObservationVectorMap ObserverMap
void RemoveObservations(vtkObject *subject, unsigned long event, vtkObject *observer, vtkCallbackCommand *notify)
friend class vtkEventBrokerInitialize
static vtkEventBroker * New()
~vtkEventBroker() override
Stores information about the relationship between a Subject and an Observer.
static vtkEventBrokerInitialize vtkEventBrokerInitializer