Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

EventRouter Class Reference

#include <EventRouter.h>

Inheritance diagram for EventRouter:

Inheritance graph
[legend]
List of all members.

Detailed Description

This class will handle distribution of events as well as management of timers.

Classes must inherit from EventListener and/or EventTrapper in order to receive events.

Use the global erouter EventRouter to post and subscribe to events, except if you are posting from within a MotionCommand, in which case you should use MotionCommand::postEvent() so that it will automatically be sent from the Motion process to the Main process.

When multiple listeners are subscribed, the order in which an event is distributed among them looks like this:

  1. "Specific" listeners: any listener which specifies a particular source id. (It doesn't matter if they specify a type id or not.)
    • older listeners get events before younger listeners
  2. "General" listeners: those that subscribe to an entire generator
    • older listeners get events before younger listeners

...but if you're relying on that ordering, there should be a cleaner way to do whatever you're doing.

If one behaviors unsubscribes another one during a processEvent(), that behavior may still get the "current" event before the unsubscription takes place. This is not a prescribed behavior, and also should not be relied on one way or the other.

Timer events are only sent to the generator which requested them. So if EventListener A requests a timer with ID 0 at two second intervals, and EventListener B requests a timer with ID 0 at three second intervals, each will still only receive the timers they requested - no cross talk. The timer generator is unique in this regard, which is why it is built in as an integral component of the EventRouter. All other events are broadcast.

If an EventListener/EventTrapper subscribes to the same event source multiple times, it will receive multiple copies of the event. However, the first call to removeListener for a source will remove all subscriptions to that source.
Example: EventListener A subscribes to (buttonEGID,*,*), and twice to (buttonEGID,0,*).

  • If button 0 is pressed, A will get three copies of the event.
  • If button 1 is pressed, A will get one copy.
  • If removeListener(&A,buttonEGID) is called, the (buttonEGID,*,*) is removed, as well as both of (buttonEGID,0,*).
  • If removeListener(&A,buttonEGID,0) is called, both of (buttonEGID,0,*) are removed, but (buttonEGID,*,*) would be untouched.

The buffered event distribution has not been tested thoroughly, and should be considered deprecated.

See also:
EventBase::EventGeneratorID_t for a complete listing of all generators, as well as instructions on how to add new generators.

Definition at line 66 of file EventRouter.h.

Public Member Functions

 EventRouter ()
 Constructs the router, buffertime defaults to 1.
virtual ~EventRouter ()
 just calls reset and removeAllTimers()
void reset ()
 erases all listeners, trappers and timers, resets EventRouter
void setBufferTime (unsigned int t)
 sets the time to wait between buffer clears, see EventRouter::buffertime.
unsigned int getBufferTime ()
 returns the time to wait between buffer clears, see EventRouter::buffertime.
Posting/Processing Events
void postEvent (EventBase::EventGeneratorID_t egid, unsigned int sid, EventBase::EventTypeID_t etid, unsigned int dur)
 recommended to create and post an event using current buffer setting
void postEvent (EventBase::EventGeneratorID_t egid, unsigned int sid, EventBase::EventTypeID_t etid, unsigned int dur, const std::string &n, float m)
 recommended to create and post an event using current buffer setting
void postEvent (EventBase *e)
 recommended to create and post an event using current buffer setting
void processTimers ()
 determines if timers need to be posted, and posts them if so.
void processEventBuffer ()
 clears the event buffer, deletes events as it does so.
void processEvent (const EventBase &e)
 forces unbuffered - sends event *now*. Will clear the buffer first if needed to ensure proper event ordering
Listener/Trapper Recall
returns true if the specified listener/trapper would receive any events that match the specified criteria

bool isListeningAny (EventListener *el, EventBase::EventGeneratorID_t egid)
bool isListeningAny (EventListener *el, EventBase::EventGeneratorID_t egid, unsigned int sid)
bool isListeningAll (EventListener *el, EventBase::EventGeneratorID_t egid)
bool isListeningAll (EventListener *el, EventBase::EventGeneratorID_t egid, unsigned int sid)
bool isListening (EventListener *el, EventBase::EventGeneratorID_t egid, unsigned int sid, EventBase::EventTypeID_t etid)
bool isListening (EventListener *el, const EventBase &e)
bool isTrappingAny (EventTrapper *el, EventBase::EventGeneratorID_t egid)
bool isTrappingAny (EventTrapper *el, EventBase::EventGeneratorID_t egid, unsigned int sid)
bool isTrappingAll (EventTrapper *el, EventBase::EventGeneratorID_t egid)
bool isTrappingAll (EventTrapper *el, EventBase::EventGeneratorID_t egid, unsigned int sid)
bool isTrapping (EventTrapper *el, EventBase::EventGeneratorID_t egid, unsigned int sid, EventBase::EventTypeID_t etid)
bool isTrapping (EventTrapper *el, const EventBase &e)
Listener/Trapper Detection
bool hasListeners (EventBase::EventGeneratorID_t egid)
 counts both listeners and trappers, so generators can tell if it even needs to bother generating an event...
bool hasListeners (EventBase::EventGeneratorID_t egid, unsigned int sid)
 counts both listeners and trappers, so generators can tell if it even needs to bother generating an event...
bool hasListeners (EventBase::EventGeneratorID_t egid, unsigned int sid, EventBase::EventTypeID_t etid)
 counts both listeners and trappers, so generators can tell if it even needs to bother generating an event...
bool hasListeners (const EventBase &e)
 counts both listeners and trappers, so generators can tell if it even needs to bother generating an event...
Timer Management
void addTimer (EventListener *el, unsigned int sid, unsigned int delay, bool repeat=true)
 adds a timer if it doesn't exist, or resets the timer if it already exists.
void addTimer (EventListener *el, const EventBase &e, bool repeat=true)
 calls the other addTimer() with the event's source id and duration, doesn't check to see if the generator is timerEGID
void removeTimer (EventListener *el)
 clears all pending timers for listener el
void removeTimer (EventListener *el, unsigned int sid)
 clears any pending timers with source id sid for listener el
void removeAllTimers ()
 clears all timers for all listeners
Listener Management
Adds a listener for all events from a given event generator

void addListener (EventListener *el, EventBase::EventGeneratorID_t egid)
void addListener (EventListener *el, EventBase::EventGeneratorID_t egid, unsigned int sid)
 Adds a listener for all types from a specific source and generator.
void addListener (EventListener *el, EventBase::EventGeneratorID_t egid, unsigned int sid, EventBase::EventTypeID_t etid)
void addListener (EventListener *el, const EventBase &e)
 Adds a listener for a specific source id and type from a given event generator, adding a Timer event will invoke addTimer(el, e.getSourceID(), e.getDuration(), true).
void removeListener (EventListener *el)
 stops sending ALL events to the listener, including timers
void removeListener (EventListener *el, EventBase::EventGeneratorID_t egid)
 stops sending specified events from the generator to the listener.
void removeListener (EventListener *el, EventBase::EventGeneratorID_t egid, unsigned int sid)
 stops sending specified events from the generator to the listener.
void removeListener (EventListener *el, EventBase::EventGeneratorID_t egid, unsigned int sid, EventBase::EventTypeID_t etid)
void removeListener (EventListener *el, const EventBase &e)
 stops sending specified events from the generator to the listener. If a timer is passed it will invoke removeTimer(el, e.getSourceID())
Trapper Management
Adds a trapper for a specific source id and type from a given event generator

void addTrapper (EventTrapper *el, const EventBase &e)
void addTrapper (EventTrapper *el, EventBase::EventGeneratorID_t egid)
 Adds a trapper for all events from a given event generator.
void addTrapper (EventTrapper *el, EventBase::EventGeneratorID_t egid, unsigned int sid)
 Adds a trapper for all types from a specific source and generator.
void addTrapper (EventTrapper *el, EventBase::EventGeneratorID_t egid, unsigned int sid, EventBase::EventTypeID_t etid)
 Adds a trapper for a specific source id and type from a given event generator.
void addTrapper (EventTrapper *el)
 adds a trapper for ALL events
void removeTrapper (EventTrapper *el, const EventBase &e)
 stops sending specified events from the generator to the trapper.
void removeTrapper (EventTrapper *el, EventBase::EventGeneratorID_t egid)
 stops sending specified events from the generator to the trapper.
void removeTrapper (EventTrapper *el, EventBase::EventGeneratorID_t egid, unsigned int sid)
 stops sending specified events from the generator to the trapper.
void removeTrapper (EventTrapper *el, EventBase::EventGeneratorID_t egid, unsigned int sid, EventBase::EventTypeID_t etid)
 stops sending specified events from the generator to the trapper.
void removeTrapper (EventTrapper *el)
 stops sending ALL events to the trapper

Protected Types

typedef std::vector< TimerEntry
* >::iterator 
timer_it_t
 makes code more readable

Protected Member Functions

void doSendBuffer ()
 does the work of clearing the buffer (calls doSendEvent() )
void doSendEvent (const EventBase &e)
 does the work of sending an event
void chkTimers ()
 just for debugging
void dispTimers ()
 just for debugging

Protected Attributes

std::vector< TimerEntry * > timers
 the list of timer entries being maintained, kept sorted by time they go active
std::vector< EventBase * > events
 used to store buffered events
bool doSendBufferLock
 in case of recursive calls to processEventBuffer()/doSendBuffer()
unsigned int lastBufClear
 time of last event buffer clear
unsigned int buffertime
 The time between clearings of the buffer.
EventMapper trappers
 A mapping of which EventTrapper's should get a chance to trap the event.
EventMapper listeners
 A mapping of which EventListener's should receive events.

Classes

class  EventMapper
 Does the actual storage of the mapping between EventBase's and the EventListeners/EventTrappers who should receive them. More...
struct  TimerEntry
 Contains all the information needed to maintain a timer by the EventRouter. More...
class  TimerEntryPtrCmp
 Used by STL to sort the timer list in order of activation time. More...


Member Typedef Documentation

typedef std::vector<TimerEntry*>::iterator EventRouter::timer_it_t [protected]
 

makes code more readable

Definition at line 205 of file EventRouter.h.


Constructor & Destructor Documentation

EventRouter::EventRouter  ) 
 

Constructs the router, buffertime defaults to 1.

Definition at line 9 of file EventRouter.cc.

virtual EventRouter::~EventRouter  )  [inline, virtual]
 

just calls reset and removeAllTimers()

Definition at line 69 of file EventRouter.h.


Member Function Documentation

void EventRouter::addListener EventListener el,
const EventBase e
 

Adds a listener for a specific source id and type from a given event generator, adding a Timer event will invoke addTimer(el, e.getSourceID(), e.getDuration(), true).

Definition at line 154 of file EventRouter.cc.

void EventRouter::addListener EventListener el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid,
EventBase::EventTypeID_t  etid
 

Adds a listener for a specific source id and type from a given event generator

Definition at line 143 of file EventRouter.cc.

void EventRouter::addListener EventListener el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid
 

Adds a listener for all types from a specific source and generator.

Definition at line 131 of file EventRouter.cc.

void EventRouter::addListener EventListener el,
EventBase::EventGeneratorID_t  egid
 

Definition at line 120 of file EventRouter.cc.

Referenced by WalkCalibration::activate(), BatteryCheckControl::activate(), EventGeneratorBase::addSrcListener(), SensorObserverControl::doSelect(), EventLogger::doSelect(), WorldStateVelDaemon::DoStart(), WorldStateSerializerBehavior::DoStart(), WMMonitorBehavior::DoStart(), WalkToTargetNode::DoStart(), WalkNode::DoStart(), VisualTargetTrans::DoStart(), VisualTargetCloseTrans::DoStart(), TimeOutTrans::DoStart(), TextMsgTrans::DoStart(), TailWagNode::DoStart(), StepTest::DoStart(), StareAtPawBehavior2::DoStart(), StareAtBallBehavior::DoStart(), SpiderMachineBehavior::DoStart(), SoundTestBehavior::DoStart(), SoundNode::DoStart(), SimpleChaseBallBehavior::DoStart(), SegCamBehavior::DoStart(), RegionCamBehavior::DoStart(), RawCamBehavior::DoStart(), MotionStressTestBehavior::DoStart(), MotionSequenceNode< SIZE >::DoStart(), MicrophoneServer::DoStart(), MCRepeater::DoStart(), LostTargetTrans::DoStart(), LookForSoundBehavior::DoStart(), LedNode::DoStart(), KinematicSampleBehavior2::DoStart(), KinematicSampleBehavior::DoStart(), HeadPointerNode::DoStart(), HeadLevelBehavior::DoStart(), GroundPlaneBehavior::DoStart(), FollowHeadBehavior::DoStart(), FlashIPAddrBehavior::DoStart(), ExploreMachine::DoStart(), EventTrans::DoStart(), EventGeneratorBase::DoStart(), EStopControllerBehavior::DoStart(), EchoBehavior::DoStart(), DriveMeBehavior::DoStart(), DrawVisObjBoundBehavior::DoStart(), DrawSkeletonBehavior::DoStart(), Controller::DoStart(), CompletionTrans::DoStart(), CompareTrans< T >::DoStart(), ChaseBallBehavior::DoStart(), CameraBehavior::DoStart(), BatteryMonitorBehavior::DoStart(), BanditMachine::WaitNode::DoStart(), AutoGetupBehavior::DoStart(), ASCIIVisionBehavior::DoStart(), AlanBehavior::DoStart(), ValueEditControl< T >::pause(), WallTestBehavior::processEvent(), MCRepeater::processEvent(), GroundPlaneBehavior::processEvent(), FollowHeadBehavior::processEvent(), FlashIPAddrBehavior::processEvent(), AutoGetupBehavior::processEvent(), RunSequenceControl< SequenceSize >::selectedFile(), LoadPostureControl::selectedFile(), EventGeneratorBase::setAutoListen(), and WalkNode::setWalkID().

void EventRouter::addTimer EventListener el,
const EventBase e,
bool  repeat = true
[inline]
 

calls the other addTimer() with the event's source id and duration, doesn't check to see if the generator is timerEGID

Definition at line 122 of file EventRouter.h.

void EventRouter::addTimer EventListener el,
unsigned int  sid,
unsigned int  delay,
bool  repeat = true
 

adds a timer if it doesn't exist, or resets the timer if it already exists.

timers are unique by EventListener and source ID - can't have two timers for the same el and sid
a delay of 0 with repeating will cause an event to be sent at every opportunity, use sparingly
a delay of -1U will call removeTimer() if it already exists, otherwise is ignored

To add a timer, you can also call addListener() with EventBase::timerEGID and the sid and delay (in the EventBase::duration field) - this method will simply cause this function to be called internally.

Parameters:
el the EventListener to send the timer event to
sid the source ID to use on that event (if you need to send more info, send a pointer to a struct of your devising, typecasted as int)
delay the delay between the first (and future) calls
repeat set to true if you want to keep receiving this event, otherwise it will only send once

Definition at line 75 of file EventRouter.cc.

Referenced by addListener(), addTimer(), WallTestBehavior::DoStart(), NullTrans::DoStart(), DriveMeBehavior::DoStart(), ConnectionMadeTrans::DoStart(), BanditMachine::WaitNode::DoStart(), PostureEditor::processEvent(), FlashIPAddrBehavior::processEvent(), DriveMeBehavior::processEvent(), BatteryMonitorBehavior::processEvent(), SensorObserverControl::RTViewControl::refresh(), PostureEditor::refresh(), NetworkStatusControl::refresh(), TimeOutTrans::resetTimer(), FreeMemReportControl::resetTimerFreq(), WalkControllerBehavior::runCommand(), UPennWalkControllerBehavior::runCommand(), FlashIPAddrBehavior::setupSequence(), and BatteryMonitorBehavior::startWarning().

void EventRouter::addTrapper EventTrapper el  ) 
 

adds a trapper for ALL events

Note that since timers are not broadcast, they cannot be trapped. Only the EventListener which requested the timer will receive that timer.

Definition at line 285 of file EventRouter.cc.

void EventRouter::addTrapper EventTrapper el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid,
EventBase::EventTypeID_t  etid
 

Adds a trapper for a specific source id and type from a given event generator.

Note that since timers are not broadcast, they cannot be trapped. Only the EventListener which requested the timer will receive that timer.

Definition at line 275 of file EventRouter.cc.

void EventRouter::addTrapper EventTrapper el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid
 

Adds a trapper for all types from a specific source and generator.

Note that since timers are not broadcast, they cannot be trapped. Only the EventListener which requested the timer will receive that timer.

Definition at line 265 of file EventRouter.cc.

void EventRouter::addTrapper EventTrapper el,
EventBase::EventGeneratorID_t  egid
 

Adds a trapper for all events from a given event generator.

Note that since timers are not broadcast, they cannot be trapped. Only the EventListener which requested the timer will receive that timer.

Definition at line 256 of file EventRouter.cc.

void EventRouter::addTrapper EventTrapper el,
const EventBase e
 

Note that since timers are not broadcast, they cannot be trapped. Only the EventListener which requested the timer will receive that timer.

Definition at line 247 of file EventRouter.cc.

Referenced by Controller::activate(), addTrapper(), and WorldStateVelDaemon::DoStart().

void EventRouter::chkTimers  )  [inline, protected]
 

just for debugging

Definition at line 209 of file EventRouter.h.

void EventRouter::dispTimers  )  [inline, protected]
 

just for debugging

Definition at line 220 of file EventRouter.h.

Referenced by chkTimers().

void EventRouter::doSendBuffer  )  [protected]
 

does the work of clearing the buffer (calls doSendEvent() )

Definition at line 340 of file EventRouter.cc.

Referenced by processEvent(), and processEventBuffer().

void EventRouter::doSendEvent const EventBase e  )  [protected]
 

does the work of sending an event

Be aware this is an O(n^2) where n is the number of listeners for a particular event. This is because after each call to processEvent, the list of listeners could have changed so each listener much be verified before it is sent an event. New listeners won't get the current event, but neither should listeners which have just be removed

Definition at line 365 of file EventRouter.cc.

Referenced by doSendBuffer(), and processEvent().

unsigned int EventRouter::getBufferTime  )  [inline]
 

returns the time to wait between buffer clears, see EventRouter::buffertime.

Returns:
time to wait between buffer clears
See also:
buffertime

Definition at line 73 of file EventRouter.h.

bool EventRouter::hasListeners const EventBase e  )  [inline]
 

counts both listeners and trappers, so generators can tell if it even needs to bother generating an event...

Definition at line 117 of file EventRouter.h.

bool EventRouter::hasListeners EventBase::EventGeneratorID_t  egid,
unsigned int  sid,
EventBase::EventTypeID_t  etid
[inline]
 

counts both listeners and trappers, so generators can tell if it even needs to bother generating an event...

Definition at line 116 of file EventRouter.h.

bool EventRouter::hasListeners EventBase::EventGeneratorID_t  egid,
unsigned int  sid
[inline]
 

counts both listeners and trappers, so generators can tell if it even needs to bother generating an event...

Definition at line 115 of file EventRouter.h.

bool EventRouter::hasListeners EventBase::EventGeneratorID_t  egid  )  [inline]
 

counts both listeners and trappers, so generators can tell if it even needs to bother generating an event...

Definition at line 114 of file EventRouter.h.

Referenced by addListener(), addTrapper(), hasListeners(), EventGeneratorBase::hasListeners(), removeListener(), and removeTrapper().

bool EventRouter::isListening EventListener el,
const EventBase e
[inline]
 

Definition at line 96 of file EventRouter.h.

bool EventRouter::isListening EventListener el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid,
EventBase::EventTypeID_t  etid
[inline]
 

Definition at line 95 of file EventRouter.h.

bool EventRouter::isListeningAll EventListener el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid
[inline]
 

Definition at line 94 of file EventRouter.h.

bool EventRouter::isListeningAll EventListener el,
EventBase::EventGeneratorID_t  egid
[inline]
 

Definition at line 93 of file EventRouter.h.

bool EventRouter::isListeningAny EventListener el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid
[inline]
 

Definition at line 92 of file EventRouter.h.

bool EventRouter::isListeningAny EventListener el,
EventBase::EventGeneratorID_t  egid
[inline]
 

Definition at line 91 of file EventRouter.h.

bool EventRouter::isTrapping EventTrapper el,
const EventBase e
[inline]
 

Definition at line 102 of file EventRouter.h.

bool EventRouter::isTrapping EventTrapper el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid,
EventBase::EventTypeID_t  etid
[inline]
 

Definition at line 101 of file EventRouter.h.

bool EventRouter::isTrappingAll EventTrapper el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid
[inline]
 

Definition at line 100 of file EventRouter.h.

bool EventRouter::isTrappingAll EventTrapper el,
EventBase::EventGeneratorID_t  egid
[inline]
 

Definition at line 99 of file EventRouter.h.

bool EventRouter::isTrappingAny EventTrapper el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid
[inline]
 

Definition at line 98 of file EventRouter.h.

bool EventRouter::isTrappingAny EventTrapper el,
EventBase::EventGeneratorID_t  egid
[inline]
 

Definition at line 97 of file EventRouter.h.

void EventRouter::postEvent EventBase e  )  [inline]
 

recommended to create and post an event using current buffer setting

Definition at line 79 of file EventRouter.h.

void EventRouter::postEvent EventBase::EventGeneratorID_t  egid,
unsigned int  sid,
EventBase::EventTypeID_t  etid,
unsigned int  dur,
const std::string &  n,
float  m
[inline]
 

recommended to create and post an event using current buffer setting

Definition at line 78 of file EventRouter.h.

void EventRouter::postEvent EventBase::EventGeneratorID_t  egid,
unsigned int  sid,
EventBase::EventTypeID_t  etid,
unsigned int  dur
[inline]
 

recommended to create and post an event using current buffer setting

Definition at line 77 of file EventRouter.h.

Referenced by addListener(), addTrapper(), WMitem< T >::announce(), Controller::console_callback(), BallDetectionGenerator::createEvent(), NoOpEventTranslator::encodeEvent(), SoundManager::endPlay(), Transition::fire(), StateNode::postCompletionEvent(), MotionCommand::postEvent(), StateNode::postStartEvent(), StateNode::postStopEvent(), WorldStateVelDaemon::processEvent(), SegmentedColorGenerator::processEvent(), RLEGenerator::processEvent(), RegionGenerator::processEvent(), RawCameraGenerator::processEvent(), JPEGGenerator::processEvent(), InterleavedYUVGenerator::processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), SoundManager::ProcessMsg(), MotionManager::processMsg(), WorldState::read(), removeListener(), removeTrapper(), SoundManager::StopPlay(), Controller::takeLine(), WMitem_base::unwatch(), and WMitem_base::watch().

void EventRouter::processEvent const EventBase e  )  [virtual]
 

forces unbuffered - sends event *now*. Will clear the buffer first if needed to ensure proper event ordering

Implements EventListener.

Definition at line 359 of file EventRouter.cc.

Referenced by postEvent().

void EventRouter::processEventBuffer  ) 
 

clears the event buffer, deletes events as it does so.

Definition at line 336 of file EventRouter.cc.

Referenced by processTimers().

void EventRouter::processTimers  ) 
 

determines if timers need to be posted, and posts them if so.

Call this often to ensure accurate timers. Also, will clear event buffer before sending timer events in order to ensure correct ordering of event reception

Definition at line 14 of file EventRouter.cc.

void EventRouter::removeAllTimers  ) 
 

clears all timers for all listeners

Definition at line 114 of file EventRouter.cc.

Referenced by reset(), and ~EventRouter().

void EventRouter::removeListener EventListener el,
const EventBase e
 

stops sending specified events from the generator to the listener. If a timer is passed it will invoke removeTimer(el, e.getSourceID())

Definition at line 231 of file EventRouter.cc.

void EventRouter::removeListener EventListener el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid,
EventBase::EventTypeID_t  etid
 

stops sending specified events from the generator to the listener.

Definition at line 215 of file EventRouter.cc.

void EventRouter::removeListener EventListener el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid
 

stops sending specified events from the generator to the listener.

Definition at line 197 of file EventRouter.cc.

void EventRouter::removeListener EventListener el,
EventBase::EventGeneratorID_t  egid
 

stops sending specified events from the generator to the listener.

Definition at line 182 of file EventRouter.cc.

void EventRouter::removeListener EventListener el  ) 
 

stops sending ALL events to the listener, including timers

Definition at line 169 of file EventRouter.cc.

Referenced by ValueEditControl< T >::activate(), EventLogger::clearSlots(), WalkCalibration::deactivate(), SensorObserverControl::RTViewControl::deactivate(), PostureEditor::deactivate(), NetworkStatusControl::deactivate(), BatteryCheckControl::deactivate(), SensorObserverControl::doSelect(), EventLogger::doSelect(), WorldStateVelDaemon::DoStop(), WorldStateSerializerBehavior::DoStop(), WMMonitorBehavior::DoStop(), WallTestBehavior::DoStop(), WalkToTargetNode::DoStop(), WalkNode::DoStop(), WalkControllerBehavior::DoStop(), VisualTargetTrans::DoStop(), VisualTargetCloseTrans::DoStop(), UPennWalkControllerBehavior::DoStop(), TimeOutTrans::DoStop(), TextMsgTrans::DoStop(), TailWagNode::DoStop(), StewartPlatformBehavior::DoStop(), StepTest::DoStop(), StareAtPawBehavior2::DoStop(), StareAtBallBehavior::DoStop(), SpiderMachineBehavior::DoStop(), SoundTestBehavior::DoStop(), SoundNode::DoStop(), SimpleChaseBallBehavior::DoStop(), SegCamBehavior::DoStop(), RegionCamBehavior::DoStop(), RawCamBehavior::DoStop(), NullTrans::DoStop(), MotionStressTestBehavior::DoStop(), MotionSequenceNode< SIZE >::DoStop(), MicrophoneServer::DoStop(), MCRepeater::DoStop(), LookForSoundBehavior::DoStop(), LedNode::DoStop(), KinematicSampleBehavior2::DoStop(), KinematicSampleBehavior::DoStop(), HeadPointerNode::DoStop(), HeadPointControllerBehavior::DoStop(), HeadLevelBehavior::DoStop(), GroundPlaneBehavior::DoStop(), FreeMemReportControl::DoStop(), FollowHeadBehavior::DoStop(), FlashIPAddrBehavior::DoStop(), ExploreMachine::DoStop(), EventTrans::DoStop(), EventGeneratorBase::DoStop(), EStopControllerBehavior::DoStop(), EchoBehavior::DoStop(), DriveMeBehavior::DoStop(), DrawVisObjBoundBehavior::DoStop(), DrawSkeletonBehavior::DoStop(), Controller::DoStop(), ConnectionMadeTrans::DoStop(), CompletionTrans::DoStop(), CompareTrans< T >::DoStop(), ChaseBallBehavior::DoStop(), CameraBehavior::DoStop(), BehaviorBase::DoStop(), BatteryMonitorBehavior::DoStop(), BanditMachine::WaitNode::DoStop(), AutoGetupBehavior::DoStop(), ASCIIVisionBehavior::DoStop(), AlanBehavior::DoStop(), SensorObserverControl::RTViewControl::pause(), NetworkStatusControl::pause(), BatteryCheckControl::pause(), WallTestBehavior::processEvent(), RunSequenceControl< SequenceSize >::processEvent(), MCRepeater::processEvent(), LoadPostureControl::processEvent(), GroundPlaneBehavior::processEvent(), FollowHeadBehavior::processEvent(), FlashIPAddrBehavior::processEvent(), BanditMachine::WaitNode::processEvent(), AutoGetupBehavior::processEvent(), AlanBehavior::processEvent(), EventGeneratorBase::removeSrcListener(), WalkNode::setWalkID(), BehaviorBase::~BehaviorBase(), LoadPostureControl::~LoadPostureControl(), and RunSequenceControl< SequenceSize >::~RunSequenceControl().

void EventRouter::removeTimer EventListener el,
unsigned int  sid
 

clears any pending timers with source id sid for listener el

Definition at line 105 of file EventRouter.cc.

void EventRouter::removeTimer EventListener el  ) 
 

clears all pending timers for listener el

Definition at line 96 of file EventRouter.cc.

Referenced by addTimer(), PostureEditor::deactivate(), DriveMeBehavior::DoStop(), BehaviorBase::DoStop(), PostureEditor::pause(), PostureEditor::processEvent(), FlashIPAddrBehavior::processEvent(), removeListener(), FreeMemReportControl::resetTimerFreq(), WalkControllerBehavior::runCommand(), UPennWalkControllerBehavior::runCommand(), HeadPointControllerBehavior::runCommand(), FlashIPAddrBehavior::setupSequence(), and BatteryMonitorBehavior::stopWarning().

void EventRouter::removeTrapper EventTrapper el  ) 
 

stops sending ALL events to the trapper

Definition at line 331 of file EventRouter.cc.

void EventRouter::removeTrapper EventTrapper el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid,
EventBase::EventTypeID_t  etid
 

stops sending specified events from the generator to the trapper.

Definition at line 321 of file EventRouter.cc.

void EventRouter::removeTrapper EventTrapper el,
EventBase::EventGeneratorID_t  egid,
unsigned int  sid
 

stops sending specified events from the generator to the trapper.

Definition at line 309 of file EventRouter.cc.

void EventRouter::removeTrapper EventTrapper el,
EventBase::EventGeneratorID_t  egid
 

stops sending specified events from the generator to the trapper.

Definition at line 300 of file EventRouter.cc.

void EventRouter::removeTrapper EventTrapper el,
const EventBase e
 

stops sending specified events from the generator to the trapper.

Definition at line 291 of file EventRouter.cc.

Referenced by Controller::deactivate(), WorldStateVelDaemon::DoStop(), and removeTrapper().

void EventRouter::reset  )  [inline]
 

erases all listeners, trappers and timers, resets EventRouter

Definition at line 70 of file EventRouter.h.

Referenced by ~EventRouter().

void EventRouter::setBufferTime unsigned int  t  )  [inline]
 

sets the time to wait between buffer clears, see EventRouter::buffertime.

Parameters:
t time to wait between buffer clears
See also:
buffertime

Definition at line 72 of file EventRouter.h.


Member Data Documentation

unsigned int EventRouter::buffertime [protected]
 

The time between clearings of the buffer.

  • 0 will not use the buffer, events are routed upon posting

Definition at line 234 of file EventRouter.h.

Referenced by getBufferTime(), postEvent(), processTimers(), and setBufferTime().

bool EventRouter::doSendBufferLock [protected]
 

in case of recursive calls to processEventBuffer()/doSendBuffer()

Definition at line 232 of file EventRouter.h.

Referenced by doSendBuffer().

std::vector<EventBase*> EventRouter::events [protected]
 

used to store buffered events

Definition at line 231 of file EventRouter.h.

Referenced by doSendBuffer(), postEvent(), processEvent(), and processEventBuffer().

unsigned int EventRouter::lastBufClear [protected]
 

time of last event buffer clear

Definition at line 233 of file EventRouter.h.

Referenced by doSendBuffer(), and processTimers().

EventMapper EventRouter::listeners [protected]
 

A mapping of which EventListener's should receive events.

Definition at line 322 of file EventRouter.h.

Referenced by addListener(), doSendEvent(), hasListeners(), isListening(), isListeningAll(), isListeningAny(), removeListener(), and reset().

std::vector<TimerEntry*> EventRouter::timers [protected]
 

the list of timer entries being maintained, kept sorted by time they go active

Definition at line 206 of file EventRouter.h.

Referenced by addTimer(), chkTimers(), dispTimers(), hasListeners(), processTimers(), removeAllTimers(), and removeTimer().

EventMapper EventRouter::trappers [protected]
 

A mapping of which EventTrapper's should get a chance to trap the event.

Definition at line 321 of file EventRouter.h.

Referenced by addTrapper(), doSendEvent(), hasListeners(), isTrapping(), isTrappingAll(), isTrappingAny(), removeTrapper(), and reset().


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

Tekkotsu v2.4.1
Generated Tue Aug 16 16:35:00 2005 by Doxygen 1.4.4