eVaf
|
The eVaf event queue interface. More...
#include <Common/ieventqueue.h>
Public Member Functions | |
virtual void | broadcastEvent (Event *event)=0 |
Sends the event to all the subscribers. More... | |
iEventQueue () | |
Interface constructor. More... | |
virtual uint | queryEvent (QString const &name) const =0 |
Queries for an existing event. More... | |
virtual uint | registerEvent (QString const &name)=0 |
Registers an event. More... | |
virtual uint | subscribeEvent (uint id, QObject *obj)=0 |
Subscribes to an event. More... | |
virtual void | unregisterEvent (uint id)=0 |
Unregisters an event. More... | |
virtual void | unsubscribeEvent (uint id, QObject *obj)=0 |
Unsubscribes from an event. More... | |
virtual | ~iEventQueue () |
Empty virtual destructor. More... | |
Static Public Member Functions | |
static iEventQueue * | instance () |
Returns the instance of the iEventQueue interface. More... | |
The eVaf event queue interface.
This interface is used to work with eVaf events. Functions in this interface register new events, subscribe to existing events and broadcast events to the rest of the application. Events are implemented using the Qt event loop.
Definition at line 41 of file ieventqueue.h.
|
inline |
Interface constructor.
Definition at line 48 of file ieventqueue.h.
|
inlinevirtual |
Empty virtual destructor.
Definition at line 51 of file ieventqueue.h.
|
pure virtual |
Sends the event to all the subscribers.
event | The event object |
This function sends the event to all the subscribers. The event object is destroyed when the event loop is finished for this event.
The event object shall be allocated in the heap.
Implemented in eVaf::Common::Internal::EventQueue.
|
static |
Returns the instance of the iEventQueue interface.
|
pure virtual |
Queries for an existing event.
name | Name of the event |
This function returns the ID of the event or zero if no such event is found.
Implemented in eVaf::Common::Internal::EventQueue.
|
pure virtual |
Registers an event.
name | Name of the event |
This function registers an event and returns a unique ID for the event. The event ID value is always greater than zero.
If an event with the given name already exists, then returns the event ID for the existing event.
Implemented in eVaf::Common::Internal::EventQueue.
|
pure virtual |
Subscribes to an event.
id | The ID of the event (can be zero) |
obj | The subscriber object |
This function subscribes to an event identified by the ID value. Every object that wants to receive specific events, needs to subscribe to them.
The id parameter can be zero and the following example code is correct even when the event called "my-event" does not exist. The value of myEventId will be set to zero if the event does not exist.
Implemented in eVaf::Common::Internal::EventQueue.
|
pure virtual |
Unregisters an event.
id | The ID of the event |
This function removes an event. It also unsubscribes all the subscribers from this event.
Implemented in eVaf::Common::Internal::EventQueue.
|
pure virtual |
Unsubscribes from an event.
id | The ID of the event (can be zero) |
obj | The subscriber object |
This function removes the subscriber object from the list of subscribers for the given event identified by the event ID value. After this function call the subscriber does no more receive these events.
Implemented in eVaf::Common::Internal::EventQueue.