eVaf
eVaf::Common::Internal::EventQueue Class Reference

iEventQueue interface implementation More...

#include <Common/eventqueue.h>

Public Member Functions

virtual void broadcastEvent (Event *event)
 Sends the event to all the subscribers. More...
 
virtual bool event (QEvent *e)
 Qt event handler. More...
 
 EventQueue ()
 
virtual uint queryEvent (QString const &name) const
 Queries for an existing event. More...
 
virtual uint registerEvent (QString const &name)
 Registers an event. More...
 
virtual uint subscribeEvent (uint id, QObject *obj)
 Subscribes to an event. More...
 
virtual void unregisterEvent (uint id)
 Unregisters an event. More...
 
virtual void unsubscribeEvent (uint id, QObject *obj)
 Unsubscribes from an event. More...
 
virtual ~EventQueue ()
 
- Public Member Functions inherited from eVaf::Common::iEventQueue
 iEventQueue ()
 Interface constructor. More...
 
virtual ~iEventQueue ()
 Empty virtual destructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from eVaf::Common::iEventQueue
static iEventQueueinstance ()
 Returns the instance of the iEventQueue interface. More...
 

Detailed Description

iEventQueue interface implementation

Definition at line 38 of file eventqueue.h.

Constructor & Destructor Documentation

eVaf::Common::Internal::EventQueue::EventQueue ( )
virtual eVaf::Common::Internal::EventQueue::~EventQueue ( )
virtual

Member Function Documentation

virtual void eVaf::Common::Internal::EventQueue::broadcastEvent ( Event event)
virtual

Sends the event to all the subscribers.

Parameters
eventThe 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.

Implements eVaf::Common::iEventQueue.

virtual bool eVaf::Common::Internal::EventQueue::event ( QEvent e)
virtual

Qt event handler.

virtual uint eVaf::Common::Internal::EventQueue::queryEvent ( QString const &  name) const
virtual

Queries for an existing event.

Parameters
nameName of the event
Returns
The ID of the event or 0 if not found

This function returns the ID of the event or zero if no such event is found.

Implements eVaf::Common::iEventQueue.

virtual uint eVaf::Common::Internal::EventQueue::registerEvent ( QString const &  name)
virtual

Registers an event.

Parameters
nameName of the event
Returns
Unique ID 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.

Implements eVaf::Common::iEventQueue.

virtual uint eVaf::Common::Internal::EventQueue::subscribeEvent ( uint  id,
QObject obj 
)
virtual

Subscribes to an event.

Parameters
idThe ID of the event (can be zero)
objThe subscriber object
Returns
The ID of the event; or zero if failed to subscribe

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.

int myEventId = iEventQueue::instance()->subscribeEvent(iEventQueue::instance()->queryEvent("my-event"), this);

Implements eVaf::Common::iEventQueue.

virtual void eVaf::Common::Internal::EventQueue::unregisterEvent ( uint  id)
virtual

Unregisters an event.

Parameters
idThe ID of the event

This function removes an event. It also unsubscribes all the subscribers from this event.

Implements eVaf::Common::iEventQueue.

virtual void eVaf::Common::Internal::EventQueue::unsubscribeEvent ( uint  id,
QObject obj 
)
virtual

Unsubscribes from an event.

Parameters
idThe ID of the event (can be zero)
objThe 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.

Implements eVaf::Common::iEventQueue.


The documentation for this class was generated from the following file: