CrystalSpace

Public API Reference

csEventQueue Class Reference

This class represents a general event queue. More...

#include <csutil/cseventq.h>

Inheritance diagram for csEventQueue:

List of all members.

Public Member Functions

virtual void Clear ()
 Clear event queue.
uint32 CountPool ()
 Get a count of events in the pool, for testing only.
virtual csPtr< iEventCreateBroadcastEvent (const csEventID &name)
 Create an event with the broadcast flag set.
virtual csPtr< iEventCreateEvent (const csEventID &name)
 Create an event, from the pool if there are any free events available.
virtual csPtr< iEventCreateEvent ()
 Grab an event from the pool or make a new one if it's empty.
virtual csPtr< iEventOutletCreateEventOutlet (iEventPlug *)
 Register an event plug and return a new outlet.
 csEventQueue (iObjectRegistry *, size_t iLength=DEF_EVENT_QUEUE_LENGTH)
 Initialize the event queue.
virtual void Dispatch (iEvent &)
 Dispatch a single event from the queue; normally called by Process ().
virtual csPtr< iEventGet ()
 Get next event from queue or a null references if no event.
virtual iEventCordGetEventCord (const csEventID &)
 Get the event cord for a given category and subcategory.
virtual iEventOutletGetEventOutlet ()
 Get a public event outlet for posting just an event.
virtual bool IsEmpty ()
 Query if queue is empty (@@ Not thread safe!).
virtual void Post (iEvent *)
 Place an event into queue.
virtual void Process ()
 Process the event queue. Calls Dispatch () once for each contained event.
virtual csHandlerID RegisterListener (iEventHandler *handler, const csEventID events[])
 Shorthand for RegisterListener() followed by Subscribe().
virtual csHandlerID RegisterListener (iEventHandler *handler, const csEventID &event)
 Shorthand for RegisterListener() followed by Subscribe().
virtual csHandlerID RegisterListener (iEventHandler *)
 Make the event scheduler subsystem aware of an event handler.
virtual void RemoveAllListeners ()
 Remove all listeners from the queue.
virtual void RemoveListener (iEventHandler *)
 Remove a given listener from the event queue.
virtual bool Subscribe (iEventHandler *, const csEventID[])
 Subscribe a listener to a set of event subtrees.
virtual bool Subscribe (iEventHandler *, const csEventID &)
 Subscribe a listener to an event subtree.
virtual void Unsubscribe (iEventHandler *, const csEventID[])
 Unsubscribe a listener from a set of event subtrees.
virtual void Unsubscribe (iEventHandler *, const csEventID &)
 Unsubscribe a listener from an event subtree.
virtual ~csEventQueue ()
 Destroy an event queue object.

Friends

class csEventOutlet
class csEventTree
class csPoolEvent

Detailed Description

This class represents a general event queue.

See the documentation of iEventQueue for a detailed description of each method. One instance of this class is usually shared via iObjectRegistry. Event queues are thread-safe.

Definition at line 67 of file cseventq.h.


Constructor & Destructor Documentation

csEventQueue::csEventQueue ( iObjectRegistry ,
size_t  iLength = DEF_EVENT_QUEUE_LENGTH 
)

Initialize the event queue.

virtual csEventQueue::~csEventQueue (  )  [virtual]

Destroy an event queue object.


Member Function Documentation

virtual void csEventQueue::Clear (  )  [virtual]

Clear event queue.

Implements iEventQueue.

uint32 csEventQueue::CountPool (  ) 

Get a count of events in the pool, for testing only.

virtual csPtr<iEvent> csEventQueue::CreateBroadcastEvent ( const csEventID name  )  [virtual]

Create an event with the broadcast flag set.

Draw from the pool if any are available, else create a new event in the pool and use it.

Implements iEventQueue.

virtual csPtr<iEvent> csEventQueue::CreateEvent ( const csEventID name  )  [virtual]

Create an event, from the pool if there are any free events available.

Else create a new event in the pool and use it.

Implements iEventQueue.

virtual csPtr<iEvent> csEventQueue::CreateEvent (  )  [virtual]

Grab an event from the pool or make a new one if it's empty.

virtual csPtr<iEventOutlet> csEventQueue::CreateEventOutlet ( iEventPlug  )  [virtual]

Register an event plug and return a new outlet.

Implements iEventQueue.

virtual void csEventQueue::Dispatch ( iEvent  )  [virtual]

Dispatch a single event from the queue; normally called by Process ().

Implements iEventQueue.

virtual csPtr<iEvent> csEventQueue::Get (  )  [virtual]

Get next event from queue or a null references if no event.

Implements iEventQueue.

virtual iEventCord* csEventQueue::GetEventCord ( const csEventID  )  [virtual]

Get the event cord for a given category and subcategory.

Implements iEventQueue.

virtual iEventOutlet* csEventQueue::GetEventOutlet (  )  [virtual]

Get a public event outlet for posting just an event.

Implements iEventQueue.

virtual bool csEventQueue::IsEmpty (  )  [inline, virtual]

Query if queue is empty (@@ Not thread safe!).

Implements iEventQueue.

Definition at line 227 of file cseventq.h.

virtual void csEventQueue::Post ( iEvent  )  [virtual]

Place an event into queue.

Implements iEventQueue.

virtual void csEventQueue::Process (  )  [virtual]

Process the event queue. Calls Dispatch () once for each contained event.

Implements iEventQueue.

virtual csHandlerID csEventQueue::RegisterListener ( iEventHandler handler,
const csEventID  events[] 
) [inline, virtual]

Shorthand for RegisterListener() followed by Subscribe().

Implements iEventQueue.

Definition at line 151 of file cseventq.h.

virtual csHandlerID csEventQueue::RegisterListener ( iEventHandler handler,
const csEventID event 
) [inline, virtual]

Shorthand for RegisterListener() followed by Subscribe().

Implements iEventQueue.

Definition at line 137 of file cseventq.h.

virtual csHandlerID csEventQueue::RegisterListener ( iEventHandler  )  [virtual]

Make the event scheduler subsystem aware of an event handler.

Implements iEventQueue.

virtual void csEventQueue::RemoveAllListeners (  )  [virtual]

Remove all listeners from the queue.

Unregister all listeners.

Remarks:
This function is used to clear all listeners from the event queue stack. You should only call this function at the end of your program after the event queue processing has terminated.
If you make use of csInitializer::DestroyApplication(), this is done for you by that call.
()

Implements iEventQueue.

virtual void csEventQueue::RemoveListener ( iEventHandler  )  [virtual]

Remove a given listener from the event queue.

Removes all subscriptions. It is VERY important that this be called before deleting the event handler!

Implements iEventQueue.

virtual bool csEventQueue::Subscribe ( iEventHandler ,
const   csEventID[] 
) [virtual]

Subscribe a listener to a set of event subtrees.

The event subtrees should be disjoint, i.e., no event name should be a prefix of another.

See also:
csEventTree::Subscribe

Implements iEventQueue.

virtual bool csEventQueue::Subscribe ( iEventHandler ,
const csEventID  
) [virtual]

Subscribe a listener to an event subtree.

Thinly wraps csEventTree::Subscribe

See also:
csEventTree::Subscribe

Implements iEventQueue.

virtual void csEventQueue::Unsubscribe ( iEventHandler ,
const   csEventID[] 
) [virtual]

Unsubscribe a listener from a set of event subtrees.

See also:
csEventTree::Unsubscribe

Implements iEventQueue.

virtual void csEventQueue::Unsubscribe ( iEventHandler ,
const csEventID  
) [virtual]

Unsubscribe a listener from an event subtree.

Thinly wraps csEventTree::Unsubscribe

See also:
csEventTree::Unsubscribe

Implements iEventQueue.


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

Generated for Crystal Space 2.1 by doxygen 1.6.1