|
| ALBA_ID_DEC (EVENT_DISPATCH) |
|
| albaTypeMacro (albaAgentEventQueue, albaAgent) |
|
bool | PushEvent (albaEventBase &event) |
|
virtual bool | PushEvent (albaEventBase *event) |
|
bool | PushEvent (albaID event_id, void *sender, void *data=NULL) |
|
albaEventBase * | PeekEvent () |
|
albaEventBase * | PeekLastEvent () |
|
int | GetQueueSize () |
|
bool | IsQueueEmpty () |
|
virtual bool | DispatchEvents () |
|
void | SetDequeueMode (int mode) |
|
int | GetDequeueMode () |
|
void | SetDequeueModeToMultipleEvent () |
|
void | SetDequeueModeToSingleEvent () |
|
void | SetDispatchMode (int mode) |
|
int | GetDispatchMode () |
|
void | SetDispatchModeToSelfProcess () |
|
void | SetDispatchModeToBroadcast () |
|
void | SetPushMode (int mode) |
|
int | GetPushMode () |
|
void | SetPushModeToDispatchEvent () |
|
void | SetPushModeToPolling () |
|
| albaAbstractTypeMacro (albaAgent, albaReferenceCounted) |
|
| ALBA_ID_DEC (AGENT_INITIALIZE) |
|
void | AddObserver (albaObserver *listener, albaID channel=MCH_UP) |
|
void | RemoveObserver (albaObserver *listener) |
|
void | RemoveAllObservers () |
|
virtual void | OnEvent (albaEventBase *event) |
|
bool | HasObservers (albaID channel) |
|
void | GetObservers (albaID channel, std::vector< albaObserver * > &olist) |
|
int | Initialize () |
|
void | Shutdown () |
|
int | IsInitialized () |
|
virtual void | SetName (const char *name) |
|
const char * | GetName () |
|
| albaReferenceCounted () |
|
virtual | ~albaReferenceCounted () |
|
| albaAbstractTypeMacro (albaReferenceCounted, albaObject) |
|
virtual void | Delete () |
|
void | Register (void *obj) |
|
virtual void | UnRegister (void *obj) |
|
int | GetReferenceCount () |
|
void | SetReferenceCount (int) |
|
| albaObject () |
|
virtual | ~albaObject () |
|
virtual void | Delete () |
|
virtual const char * | GetTypeName () const |
|
virtual bool | IsA (const char *type_name) const |
|
virtual bool | IsA (const albaTypeID &type_id) const |
|
virtual albaObject * | NewObjectInstance () const =0 |
|
virtual const albaTypeID & | GetTypeId () const |
|
virtual void | Print (std::ostream &os, const int indent=0) const |
|
| albaObject (const albaObject &c) |
|
| albaObserver () |
|
virtual | ~albaObserver () |
|
virtual void | OnEvent (albaEventBase *e)=0 |
|
| albaEventBroadcaster (void *owner=NULL) |
|
virtual | ~albaEventBroadcaster () |
|
| albaEventBroadcaster (const albaEventBroadcaster &c) |
|
void | AddObserver (albaObserver *obj) |
|
void | AddObserver (albaObserver &obj) |
|
albaObserverCallback * | AddObserverCallback (void(*f)(void *sender, albaID eid, void *clientdata, void *calldata)) |
|
bool | RemoveObserver (albaObserver *obj) |
|
void | RemoveAllObservers () |
|
bool | IsObserver (albaObserver *obj) |
|
bool | HasObservers () |
|
void | GetObservers (std::vector< albaObserver * > &olist) |
|
void | InvokeEvent (albaEventBase &e) |
|
void | InvokeEvent (albaEventBase *e) |
|
void | InvokeEvent (void *sender, albaID id=ID_NO_EVENT, void *data=NULL) |
|
void | SetChannel (albaID ch) |
|
albaID | GetChannel () |
|
virtual void | SetListener (albaObserver *o) |
|
| albaEventSender () |
|
virtual void | SetListener (albaObserver *o) |
|
virtual albaObserver * | GetListener () |
|
virtual bool | HasListener () |
|
virtual void | InvokeEvent (albaEventBase &e) |
|
virtual void | InvokeEvent (albaEventBase *e) |
|
virtual void | InvokeEvent (void *sender, albaID id=ID_NO_EVENT, void *data=NULL) |
|
Base class for managing event queueing and synchronized dispatching.
This class is thought to manage events queueing and synchronized dispatching in a multithreaded events oriented architecture. An EventQueue is a albaAgent (i.e. able to listen to events coming from other objects and passed as arguments of the OnEvent() function), but it can also process events in its queue. Events in the queue are also processed by OnEvent(), while to queue events you can use the PushEvent() function. Queued events are dispatched when the DispatchEvents() function is called. Dispatching an event means either to pass the dequeued events to the OnEvent() function (SelfProcessMode) or to rise a broadcast event having as "callData" the event itself (BroadcastMode). The default OnEvent() function forwards the event to the queue listener, but subclasses can override this virtual method. The EventQueue class is also the base class for managing the synchronization. To do this, when the first event is queued (i.e. the queue was previously empty), the albaAgentEventQueue creates a new event with ID "albaAgentEventQueue::EVENT_DISPATCH", (it's a request for dispatching) and sends it to its Listener (if present). This event should be managed by a dispatcher object, usually another queue or better a threaded agent (
- See also
- mflThreadedAgent and albaEventHandler). If a albaAgentEventQueue::EVENT_DISPATCH is found, while dispatching events in the queue, it's not processed by OnEvent and neither broadcasted, but the DispatchEvents() function of the sender object is called. Dispatching of events in a separate thread can be performed by calling PushEvent() when an incoming event is found to be a albaAgentEventQueue::EVENT_DISPATCH during the OnEvent() (see albaDeviceManager).
When dispatching events (i.e. when DispatchEvents() is called), if the EventQueue finds a request for dispatching in the queue it calls the DispatchEvents() function of the sender (i.e. triggers the dispatching of events in that queue). As already stated, each dispatched event is either self processed by means of the OnEvent() function or broadcasted rising a broadcasting event on the original queue on the original channel. Whether self process or broadcast depends on SelfProcessMode flag (default is broadcasting).
This class is the base for managing events coming from multiple sources and to perform synchronizations (i.e. a basic form of data fusion). More complex data fusions can be performed redefining the DispacthEvents function.
- See also
- albaAgent albaAgentThreaded albaAgentEventHandler
Definition at line 60 of file albaAgentEventQueue.h.