class rcEventQueue

Event queue where the run control internal events are stored until they are processed

Public Methods

static int AddEvent( rcEvent *theEvent, bool bPriorityEvent = false )
Puts an event on to one of the event queues
static int Deregister( char *pcObjectName )
Deregisters the named object pcObjectName
static void dump( ostream &os = cout )
Writes info about the event queues to ostream &os
static void dumpRegisteredObjects( ostream &os = cout )
Writes info about the registered objects to ostream &os
static int ProcessNextEvent()
Retrieves the next event from the event queue and processes it
static int Register( char *pcObjectName, rcFsm *fsm )
Registers the state machine fsm as the named object pcObjectName

Private Fields

static bool bDebugEvents
If true prints debug information
static mapActiveObjects_t mapActiveObjects
Map for finding the state machine rcFsm of an object given its name
static rcEventQueue_t theQueue
The queue of events with different source and destination
static rcEventQueue_t theSelfQueue
The queue of events with source the same object as destination

Private Methods

static mapActiveObjects_t::iterator findObject( const char *pcName )
Given a name, find the object in the internal map of rcFsm

Documentation

Event queue where the run control internal events are stored until they are processed.
rcEventQueue is a very simple first in - first out event queue, implemented as an STL deque. This would allow to also add high priority events at the beginning of the queue, a feature that is currently in use only for timer objects.
The event queue works in the following way: Named objects register with the queue using its member function Register, which adds a pointer to the state machine rcFsm of the object. An event is added to the queue using the member AddEvent (called from the send() member of the class rcEvent). ProcessNextEvent is called continously by the main run control steering routine rcMain::rcMainLoop. An event is processed by calling the member TakeEvent of the rcFsm of the destination object.

Note that there are two queues: a queue for events which an object sends to itself (source == destination) and events where the destination is a different object that the source. The static public members for these two queues are theSelfQueue and theQueue. Events to the objects itself have priority over other events. This is achieved in rcMain::rcMainLoop by calling theSelfQueue::ProcessNextEvent() before calling theQueue::ProcessNextEvent.

See also: rcFsm, rcEvent, smTimer

First version: Mar 12, 98 by CW

Last modifications: Feb 3, 2000, by CW

static int Register( char *pcObjectName, rcFsm *fsm )
Registers the state machine fsm as the named object pcObjectName
Returns:
rcSuccess if object has been added, rcFailure if it hasn't because it was already in the list.

static int Deregister( char *pcObjectName )
Deregisters the named object pcObjectName
Returns:
rcSuccess if object has been remove, rcFailure if it hasn't because it was not registers.

static int ProcessNextEvent()
Retrieves the next event from the event queue and processes it. An event is processed by calling TakeEvent on the destination object.
Returns:
rcSuccess if an event has been processed, rcNoEventProcessed otherwise.

static int AddEvent( rcEvent *theEvent, bool bPriorityEvent = false )
Puts an event on to one of the event queues. The queue is either theSelfQueue (for events with source equal destination) or theQueue (for events with source not equal destination).
Returns:
rcSuccess (events can always be added to a deque).
Parameters:
theEvent - Pointer to the event
bPriorityEvent - If true add the event to the front of the queue, otherwise to the back. The default priority is adding it to the back.

static void dump( ostream &os = cout )
Writes info about the event queues to ostream &os

static void dumpRegisteredObjects( ostream &os = cout )
Writes info about the registered objects to ostream &os

static mapActiveObjects_t::iterator findObject( const char *pcName )
Given a name, find the object in the internal map of rcFsm
Returns:
iterator to the object or mapActiveObjects.end() if object does not exist in the map.

static rcEventQueue_t theQueue
The queue of events with different source and destination

static rcEventQueue_t theSelfQueue
The queue of events with source the same object as destination

static mapActiveObjects_t mapActiveObjects
Map for finding the state machine rcFsm of an object given its name

static bool bDebugEvents
If true prints debug information


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de