IEventQueue Class Reference

Event queue interface. More...

#include <IEventQueue.h>

Inherits IInterface.

Inherited by CEventQueue.

Collaboration diagram for IEventQueue:
Collaboration graph
[legend]

List of all members.

Classes

class  CTimerEvent

manipulators



virtual void adoptBuffer (IEventQueueBuffer *)=0
 Set the buffer.
virtual bool getEvent (CEvent &event, double timeout=-1.0)=0
 Remove event from queue.
virtual bool dispatchEvent (const CEvent &event)=0
 Dispatch an event.
virtual void addEvent (const CEvent &event)=0
 Add event to queue.
virtual CEventQueueTimernewTimer (double duration, void *target)=0
 Create a recurring timer.
virtual CEventQueueTimernewOneShotTimer (double duration, void *target)=0
 Create a one-shot timer.
virtual void deleteTimer (CEventQueueTimer *)=0
 Destroy a timer.
virtual void adoptHandler (CEvent::Type type, void *target, IEventJob *handler)=0
 Register an event handler for an event type.
virtual void removeHandler (CEvent::Type type, void *target)=0
 Unregister an event handler for an event type.
virtual void removeHandlers (void *target)=0
 Unregister all event handlers for an event target.
virtual CEvent::Type registerType (const char *name)=0
 Creates a new event type.
virtual CEvent::Type registerTypeOnce (CEvent::Type &type, const char *name)=0
 Creates a new event type.
static void setInstance (IEventQueue *)
 Set the singleton instance.

accessors



virtual bool isEmpty () const =0
 Test if queue is empty.
virtual IEventJobgetHandler (CEvent::Type type, void *target) const =0
 Get an event handler.
virtual const char * getTypeName (CEvent::Type type)=0
 Get name for event.
static void * getSystemTarget ()
 Get the system event type target.
static IEventQueuegetInstance ()
 Get the singleton instance.

Detailed Description

Event queue interface.

An event queue provides a queue of CEvents. Clients can block waiting on any event becoming available at the head of the queue and can place new events at the end of the queue. Clients can also add and remove timers which generate events periodically.

Definition at line 37 of file IEventQueue.h.


Member Function Documentation

virtual void IEventQueue::addEvent ( const CEvent event  )  [pure virtual]

Add event to queue.

Adds event to the end of the queue.

Implemented in CEventQueue.

virtual void IEventQueue::adoptBuffer ( IEventQueueBuffer  )  [pure virtual]

Set the buffer.

Replace the current event queue buffer. Any queued events are discarded. The queue takes ownership of the buffer.

Implemented in CEventQueue.

virtual void IEventQueue::adoptHandler ( CEvent::Type  type,
void *  target,
IEventJob handler 
) [pure virtual]

Register an event handler for an event type.

Registers an event handler for type and target. The handler is adopted. Any existing handler for the type,target pair is deleted. dispatchEvent() will invoke handler for any event for target of type type. If no such handler exists it will use the handler for target and type kUnknown if it exists.

Implemented in CEventQueue.

virtual void IEventQueue::deleteTimer ( CEventQueueTimer  )  [pure virtual]

Destroy a timer.

Destroys a previously created timer. The timer is removed from the queue and will not generate event, even if the timer has expired.

Implemented in CEventQueue.

virtual bool IEventQueue::dispatchEvent ( const CEvent event  )  [pure virtual]

Dispatch an event.

Looks up the dispatcher for the event's target and invokes it. Returns true iff a dispatcher exists for the target.

Implemented in CEventQueue.

virtual bool IEventQueue::getEvent ( CEvent event,
double  timeout = -1.0 
) [pure virtual]

Remove event from queue.

Returns the next event on the queue into event. If no event is available then blocks for up to timeout seconds, or forever if timeout is negative. Returns true iff an event was available.

Implemented in CEventQueue.

virtual IEventJob* IEventQueue::getHandler ( CEvent::Type  type,
void *  target 
) const [pure virtual]

Get an event handler.

Finds and returns the event handler for the type, target pair if it exists, otherwise it returns NULL.

Implemented in CEventQueue.

IEventQueue * IEventQueue::getInstance (  )  [static]

Get the singleton instance.

Returns the singleton instance of the event queue

Definition at line 32 of file IEventQueue.cpp.

void * IEventQueue::getSystemTarget (  )  [static]

Get the system event type target.

Returns the target to use for dispatching CEvent::kSystem events.

Definition at line 25 of file IEventQueue.cpp.

Referenced by CXWindowsEventQueueBuffer::getEvent(), COSXEventQueueBuffer::getEvent(), CMSWindowsEventQueueBuffer::getEvent(), and CMSWindowsServerTaskBarReceiver::runMenu().

virtual const char* IEventQueue::getTypeName ( CEvent::Type  type  )  [pure virtual]

Get name for event.

Returns the name for the event type. This is primarily for debugging.

Implemented in CEventQueue.

virtual bool IEventQueue::isEmpty (  )  const [pure virtual]

Test if queue is empty.

Returns true iff the queue has no events in it, including timer events.

Implemented in CEventQueue.

virtual CEventQueueTimer* IEventQueue::newOneShotTimer ( double  duration,
void *  target 
) [pure virtual]

Create a one-shot timer.

Creates and returns a one-shot timer. An event is returned when the timer expires and the timer is removed from further handling. When a timer event is returned the data points to a CTimerEvent. The c_count member of the CTimerEvent is always 1. The client must pass the returned timer to deleteTimer() (whether or not the timer has expired) to release the timer. The returned timer event uses the given target. If target is NULL it uses the returned timer as the target.

Implemented in CEventQueue.

virtual CEventQueueTimer* IEventQueue::newTimer ( double  duration,
void *  target 
) [pure virtual]

Create a recurring timer.

Creates and returns a timer. An event is returned after duration seconds and the timer is reset to countdown again. When a timer event is returned the data points to a CTimerEvent. The client must pass the returned timer to deleteTimer() (whether or not the timer has expired) to release the timer. The returned timer event uses the given target. If target is NULL it uses the returned timer as the target.

Events for a single timer don't accumulate in the queue, even if the client reading events can't keep up. Instead, the m_count member of the CTimerEvent indicates how many events for the timer would have been put on the queue since the last event for the timer was removed (or since the timer was added).

Implemented in CEventQueue.

virtual CEvent::Type IEventQueue::registerType ( const char *  name  )  [pure virtual]

Creates a new event type.

Returns a unique event type id.

Implemented in CEventQueue.

virtual CEvent::Type IEventQueue::registerTypeOnce ( CEvent::Type &  type,
const char *  name 
) [pure virtual]

Creates a new event type.

If type contains kUnknown then it is set to a unique event type id otherwise it is left alone. The final value of type is returned.

Implemented in CEventQueue.

virtual void IEventQueue::removeHandler ( CEvent::Type  type,
void *  target 
) [pure virtual]

Unregister an event handler for an event type.

Unregisters an event handler for the type, target pair and deletes it.

Implemented in CEventQueue.

virtual void IEventQueue::removeHandlers ( void *  target  )  [pure virtual]

Unregister all event handlers for an event target.

Unregisters all event handlers for the target and deletes them.

Implemented in CEventQueue.

void IEventQueue::setInstance ( IEventQueue instance  )  [static, protected]

Set the singleton instance.

Sets the singleton instance of the event queue

Definition at line 39 of file IEventQueue.cpp.


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

Generated on 12 Nov 2010 for synergy-plus by  doxygen 1.6.1