| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csEventQueue Class Reference

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

`#include <csutil/cseventq.h>`

Inheritance diagram for csEventQueue:

[legend]
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< iEvent > | CreateBroadcastEvent (const csEventID &name)
| Create an event with the broadcast flag set.
virtual csPtr< iEvent > | CreateEvent (const csEventID &name)
| Create an event, from the pool if there are any free events available.
virtual csPtr< iEvent > | CreateEvent ()
| Grab an event from the pool or make a new one if it's empty.
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 *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.
## Public Attributes
csEventID | FinalProcess
csEventID | Frame
csEventID | PostProcess
csEventID | PreProcess
csEventID | ProcessEvent
## Friends
class | csEventOutlet
class | csEventQueueTest
class | csEventTree
class | csPoolEvent
## Classes
class | FinalProcessFrameEventDispatcher
struct | iTypedFrameEventDispatcher
| As a transitional measure, the csevPreProcess, csevProcess, csevPostProcess and csevFinalProcess events are actually sub-events dispatched by a csevFrame handler. More...
class | PostProcessFrameEventDispatcher
class | PreProcessFrameEventDispatcher
class | ProcessFrameEventDispatcher

## 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.

References CS_HANDLER_INVALID.

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.

References CS_HANDLER_INVALID.

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:

- csutil/cseventq.h