Xrb::EventQueue Class Reference

Controls chronological queueing and processing of asynchronous events. More...

#include <xrb_eventqueue.hpp>

Inheritance diagram for Xrb::EventQueue:

Inheritance graph
[legend]

List of all members.

Classes

class  EventBinding
struct  OrderEventBindingsByEventTime

Public Member Functions

 EventQueue ()
 Constructor.
virtual ~EventQueue ()
 Destructor.
void EnqueueEvent (EventHandler *event_handler, Event const *event)
 Enqueues an event for the given EventHandler.
void DeleteEventsBelongingToHandler (EventHandler *event_handler)
 Deletes events which belong to the given EventHandler.
void ScheduleMatchingEventsForDeletion (bool(*EventMatchingFunction)(Event const *))
 Deletes all queued events that return true when passed to the given event matching function.
template<typename ParameterType >
void ScheduleMatchingEventsForDeletion (bool(*EventMatchingFunction)(Event const *, ParameterType), ParameterType parameter)
 Deletes all queued events that return true when passed to the given event matching function.
template<typename Parameter1Type , typename Parameter2Type >
void ScheduleMatchingEventsForDeletion (bool(*EventMatchingFunction)(Event const *, Parameter1Type, Parameter2Type), Parameter1Type parameter1, Parameter2Type parameter2)
 Deletes all queued events that return true when passed to the given event matching function.

Protected Member Functions

virtual void HandleFrame ()
 Processes all events in the event queue with time less than or equal to the current frame time.


Detailed Description

Controls chronological queueing and processing of asynchronous events.

Many EventHandler instances are "owned" by a single EventQueue. The EventQueue receives orders to enqueue events for a particular EventHandler. All events from all EventHandlers are enqueued chronologically in a single queue. The events are then dequeued (also in chronologicaly order) when the current time (as passed to the EventQueue) is greater or equal to the event's scheduled processing time.

When an EventHandler is deleted, all events that are enqueued for it are taken out of the queue and deleted.

Definition at line 39 of file xrb_eventqueue.hpp.


Constructor & Destructor Documentation

Xrb::EventQueue::~EventQueue (  )  [virtual]

Destructor.

Deletes all remaining enqueued events.

Definition at line 30 of file xrb_eventqueue.cpp.

References Xrb::Delete().


Member Function Documentation

void Xrb::EventQueue::EnqueueEvent ( EventHandler event_handler,
Event const *  event 
)

Enqueues an event for the given EventHandler.

The time at which it will be processed is given the time specified during the Event's construction.

Note:
You shouldn't have to call this directly. Use Xrb::EventHandler::EnqueueEvent instead.

Definition at line 50 of file xrb_eventqueue.cpp.

References Xrb::EventHandler::MostRecentEventTime().

Referenced by Xrb::EventHandler::EnqueueEvent().

void Xrb::EventQueue::DeleteEventsBelongingToHandler ( EventHandler event_handler  ) 

Deletes events which belong to the given EventHandler.

Note:
You shouldn't have to call this directly. It will be called automatically by EventHandler's destructor.

Definition at line 71 of file xrb_eventqueue.cpp.

Referenced by Xrb::EventHandler::~EventHandler().

void Xrb::EventQueue::ScheduleMatchingEventsForDeletion ( bool(*)(Event const *)  EventMatchingFunction  ) 

Deletes all queued events that return true when passed to the given event matching function.

This is used to remove situation-specific sets of events.

Parameters:
EventMatchingFunction A pointer to the matching function to use.

Definition at line 87 of file xrb_eventqueue.cpp.

template<typename ParameterType >
void Xrb::EventQueue::ScheduleMatchingEventsForDeletion ( bool(*)(Event const *, ParameterType)  EventMatchingFunction,
ParameterType  parameter 
) [inline]

Deletes all queued events that return true when passed to the given event matching function.

This is used to remove situation-specific sets of events.

The template parameter specifies the type of the single extra parameter of the event matching function (besides the Event itself).

Parameters:
EventMatchingFunction A pointer to the matching function to use.
parameter The parameter to pass to the matching function.

Definition at line 183 of file xrb_eventqueue.hpp.

template<typename Parameter1Type , typename Parameter2Type >
void Xrb::EventQueue::ScheduleMatchingEventsForDeletion ( bool(*)(Event const *, Parameter1Type, Parameter2Type)  EventMatchingFunction,
Parameter1Type  parameter1,
Parameter2Type  parameter2 
) [inline]

Deletes all queued events that return true when passed to the given event matching function.

This is used to remove situation-specific sets of events.

The template parameter specifies the type of the two extra parameters of the event matching function (besides the Event itself).

Parameters:
EventMatchingFunction A pointer to the matching function to use.
parameter1 The first parameter (of type Parameter1Type) to pass to the matching function.
parameter2 The first parameter (of type Parameter2Type) to pass to the matching function.

Definition at line 204 of file xrb_eventqueue.hpp.


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

Hosted by SourceForge.net Logo -- Generated on Fri Aug 21 21:46:39 2009 for XuqRijBuh by doxygen 1.5.8