Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
#include <EventTranslator.h>
Inheritance diagram for EventTranslator:
The SharedQueue which the processes should set up and then pass to this object is defined by TranslatorSharedQueue_t - it allows 100 entries totalling 3KB of space. You can modify the type to change the capacity, but if you're making that many events that between Main's calls to translateEvents() you might want to rethink a few things...
EventTranslator only handles LocomotionEvent, VisionObjectEvent, and TextMsgEvent subtypes for the moment. Anything else is only handled as an EventBase class. (so extra fields aren't going to be stored) It's easy to add more types if you need to send them from other processes (that's the whole point of this class!)
Reason for doing it this way: Avoids OPENR message lag time (4-8ms in our testing), also avoids problems with RTTI stored in classes from different processes.
Definition at line 21 of file EventTranslator.h.
Public Types | |
typedef SharedQueue< 3 *1024, 100 > | Queue_t |
Use this type to set up the shared queue between processes. | |
enum | TypeID_t { EventBase_ID, LocomotionEvent_ID, VisionObjectEvent_ID, TextMsgEvent_ID } |
an ID is inserted before the event data in the queue so we can tell which subclass it is More... | |
Public Member Functions | |
EventTranslator () | |
constructor | |
void | setQueue (Queue_t *q) |
sets the SharedQueue which should be used | |
virtual bool | trapEvent (const EventBase &event) |
called by the event router when something in this process sends an event | |
void | translateEvents () |
called whenever Main gets some processor time to check for events from other processes | |
Static Public Member Functions | |
void | enqueue (const EventBase &event, Queue_t *q) |
called by trapEvent to do all the work, needed so MotionCommands can enqueue directly | |
Static Protected Member Functions | |
void | sendEvent (const void *buf, unsigned int size) |
called by translateEvents for each event to be sent | |
Protected Attributes | |
Queue_t * | queue |
pointer to queue of events to be sent | |
Private Member Functions | |
EventTranslator (const EventTranslator &) | |
don't call | |
EventTranslator | operator= (const EventTranslator &) |
don't call |
|
Use this type to set up the shared queue between processes.
Definition at line 27 of file EventTranslator.h. Referenced by MMCombo::DoInit(), enqueue(), MMCombo::GotEventTranslatorQueue(), MotionCommand::setQueue(), and setQueue(). |
|
an ID is inserted before the event data in the queue so we can tell which subclass it is (quickly, could look at the creator code which is stored, but that's a text string) Definition at line 31 of file EventTranslator.h. Referenced by enqueue(), and sendEvent(). |
|
constructor
Definition at line 24 of file EventTranslator.h. |
|
don't call
|
|
called by trapEvent to do all the work, needed so MotionCommands can enqueue directly
Definition at line 16 of file EventTranslator.cc. Referenced by MotionCommand::postEvent(), and trapEvent(). |
|
don't call
|
|
called by translateEvents for each event to be sent
Definition at line 51 of file EventTranslator.cc. Referenced by translateEvents(). |
|
sets the SharedQueue which should be used
Definition at line 34 of file EventTranslator.h. Referenced by MMCombo::DoInit(), SoundPlay::GotEventTranslatorQueue(), and MMCombo::GotEventTranslatorQueue(). |
|
called whenever Main gets some processor time to check for events from other processes
Definition at line 42 of file EventTranslator.cc. Referenced by MMCombo::GotImage(), MMCombo::GotPowerEvent(), and MMCombo::GotSensorFrame(). |
|
called by the event router when something in this process sends an event
Implements EventTrapper. Definition at line 10 of file EventTranslator.cc. |
|
pointer to queue of events to be sent
Definition at line 50 of file EventTranslator.h. Referenced by EventTranslator(), setQueue(), translateEvents(), and trapEvent(). |
Tekkotsu v2.0 |
Generated Wed Jan 21 03:23:10 2004 by Doxygen 1.3.4 |