![]() |
Public API Reference |
![]() |
This class represents a general event queue. More...
#include <csutil/cseventq.h>
Public Member Functions | |
virtual void | Clear () |
Clear event queue. | |
uint32 | CountPool () |
Get a count of events in the pool, for testing only. | |
virtual csPtr< iEvent > | CreateBroadcastEvent (const csEventID &name) |
Create an event with the broadcast flag set. | |
virtual csPtr< iEvent > | CreateEvent () |
Grab an event from the pool or make a new one if it's empty. | |
virtual csPtr< iEvent > | CreateEvent (const csEventID &name) |
Create an event, from the pool if there are any free events available. | |
virtual csPtr< iEventOutlet > | CreateEventOutlet (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< iEvent > | Get () |
Get next event from queue or a null references if no event. | |
virtual iEventCord * | GetEventCord (const csEventID &) |
Get the event cord for a given category and subcategory. | |
virtual iEventOutlet * | GetEventOutlet () |
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 *) |
Make the event scheduler subsystem aware of an event handler. | |
virtual csHandlerID | RegisterListener (iEventHandler *handler, const csEventID &event) |
Shorthand for RegisterListener() followed by Subscribe() | |
virtual csHandlerID | RegisterListener (iEventHandler *handler, const csEventID events[]) |
Shorthand for RegisterListener() followed by Subscribe() | |
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 an event subtree. | |
virtual bool | Subscribe (iEventHandler *, const csEventID[]) |
Subscribe a listener to a set of event subtrees. | |
virtual void | Unsubscribe (iEventHandler *, const csEventID &) |
Unsubscribe a listener from an event subtree. | |
virtual void | Unsubscribe (iEventHandler *, const csEventID[]) |
Unsubscribe a listener from a set of event subtrees. | |
virtual | ~csEventQueue () |
Destroy an event queue object. | |
Friends | |
class | csEventOutlet |
class | csEventTree |
class | csPoolEvent |
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.
csEventQueue::csEventQueue | ( | iObjectRegistry * | , |
size_t | iLength = DEF_EVENT_QUEUE_LENGTH |
||
) |
Initialize the event queue.
virtual csEventQueue::~csEventQueue | ( | ) | [virtual] |
Destroy an event queue object.
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 | ( | ) | [virtual] |
Grab an event from the pool or make a new one if it's empty.
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<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 * | ) | [virtual] |
Make the event scheduler subsystem aware of an event handler.
Implements iEventQueue.
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 * | handler, |
const csEventID | events[] | ||
) | [inline, virtual] |
Shorthand for RegisterListener() followed by Subscribe()
Implements iEventQueue.
Definition at line 151 of file cseventq.h.
virtual void csEventQueue::RemoveAllListeners | ( | ) | [virtual] |
Remove all listeners from the queue.
Unregister all listeners.
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 an event subtree.
Thinly wraps csEventTree::Subscribe
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.
Implements iEventQueue.
virtual void csEventQueue::Unsubscribe | ( | iEventHandler * | , |
const csEventID & | |||
) | [virtual] |
Unsubscribe a listener from an event subtree.
Thinly wraps csEventTree::Unsubscribe
Implements iEventQueue.
virtual void csEventQueue::Unsubscribe | ( | iEventHandler * | , |
const csEventID | [] | ||
) | [virtual] |
Unsubscribe a listener from a set of event subtrees.
Implements iEventQueue.