| Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
EventBase Class Reference#include <EventBase.h>
Inheritance diagram for EventBase: ![]() Detailed DescriptionForms the basis of communication between modules/behaviors in the framework.Events are defined by a 3-tuple:
Each of these is represented by an ID, the EventGeneratorID_t (EGID) and EventTypeID_t (ETID) are defined here in EventBase. Source IDs (SID) are defined separately by each generator, so the documentation in each entry of EventGeneratorID_t describes how to interpret the source field. So for example, the button event which results from initially pressing the head button on an ERS-7 robot would be: While the button is held down, additional statusETID events are used to report varying pressure values (if the button is pressure sensitive), and an event with deactivateETID is sent when the button is released. Alternatively, an SID value from a vision detector (say visObjEGID) refers to seeing a particular object, a completely different domain, values of which may overlap with other generators' source IDs. Thus, interpreting the source field requires knowing the generator as well. When the generator doesn't have groups of activity with a 'begin' or 'end', it will use statusETID for all of its events. (in other words, not all generators necessarily have to use activate or deactivate) For example, sensor updates are continuously occuring, so you will only ever see The duration field is also generator specific - some may refer to the time since the last activation event (e.g. button events) where as others refer to time since last status (e.g. sensors updates) If you want to make a new generator, all you have to do is add a new entry to the ID list (EventGeneratorID_t) and then put its name in the EventGeneratorNames[] array. Alternatively, there is an 'unlicensed spectrum' available under unknownEGID. You can send out events from that generator just like any other, but it should only be used for quick tests and hacking around... The generator ID number is only that -- an ID number. Events can be posted to the EventRouter anywhere, anytime, and do not require anything of the sender. However, there is an EventGeneratorBase which can simplify some aspects of behaviors whose sole purpose is processing information and generating events. If more information needs to be sent along with the event, the cleanest solution is to create a subclass of EventBase to hold the additional information. For example, you can see the existing subclasses in the inheritance diagram above. If you want to use a quick hack however, you could just pass a pointer to data as the SID if you don't need that field for something else, or use a DataEvent.
Definition at line 74 of file EventBase.h.
Member Enumeration DocumentationLists all possible event generator ids. An event generator is a abstract source of events, used for listening to and parsing certain classes of events IF YOU ADD AN EVENT GENERATOR, DON'T FORGET TO NAME IT (EventBase::EventGeneratorNames, actual names are in EventBase.cc)
Definition at line 80 of file EventBase.h. an event type id is used to denote whether it's the first in a sequence (button down), in a sequence (button still down), or last (button up)
Definition at line 121 of file EventBase.h. values to pass to setSaveFormat()
Definition at line 249 of file EventBase.h.
Constructor & Destructor Documentation
constructor
Definition at line 51 of file EventBase.cc. Referenced by clone().
Member Function Documentation
allows a copy to be made of an event, supporting polymorphism Must be overridden by all subclasses to allow this to happen I would like to switch this over to the cloneable interface once the compiler gets updated out of the 3.3 branch... see Cloneable::clone() for a discussion of the issue and implementation notes. Reimplemented in DataEvent< T >, FilterBankEvent, LocomotionEvent, LookoutPointAtEvent, LookoutSketchEvent, LookoutIREvent, LookoutScanEvent, PitchEvent, SegmentedColorFilterBankEvent, TextMsgEvent, TimerEvent, and VisionObjectEvent. Definition at line 150 of file EventBase.h.
compares event duration and ensures same event generator, source, and type - useful for event masks
Definition at line 199 of file EventBase.h.
compares event duration and ensures same event generator, source, and type - useful for event masks
Definition at line 200 of file EventBase.h.
calls setName() with a string version of sourceID, decimal notation
Definition at line 245 of file EventBase.cc. Referenced by EventBase(), loadXML(), resetName(), setGeneratorID(), and setSourceID().
should return the minimum size needed if using binary format (i.e. not XML)
Reimplemented from XMLLoadSave. Reimplemented in LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, and VisionObjectEvent. Definition at line 117 of file EventBase.cc. Referenced by EventTranslator::encodeEvent(), VisionObjectEvent::getBinSize(), TimerEvent::getBinSize(), TextMsgEvent::getBinSize(), PitchEvent::getBinSize(), LookoutPointAtEvent::getBinSize(), and LocomotionEvent::getBinSize().
All subclasses should override this and return a unique ID for their class. All IDs corresponding to all-capital letters are reserved for future framework expansion. (Thus, user subclasses should contain at least one lower-case letter.) This code can be used when serializing to allow quick identification of the class type by the receiver. Reimplemented in LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, TextMsgEvent, TimerEvent, and VisionObjectEvent. Definition at line 213 of file EventBase.h. Referenced by EventTranslator::encodeEvent().
generates a description of the event with variable verbosity
Reimplemented in LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, and VisionObjectEvent. Definition at line 104 of file EventBase.cc. Referenced by VisionObjectEvent::getDescription(), TimerEvent::getDescription(), TextMsgEvent::getDescription(), PitchEvent::getDescription(), LookoutPointAtEvent::getDescription(), LocomotionEvent::getDescription(), SpiderMachineBehavior::processEvent(), EventLogger::processEvent(), and EventLogger::processStateMachineEvent().
gets the time since the beginning of this sequence (the timestamp of the activate event)
Definition at line 172 of file EventBase.h. Referenced by EventRouter::addTimer(), and getDescription().
gets the generator ID for this event
Definition at line 163 of file EventBase.h. Referenced by EventRouter::addListener(), EventRouter::addTrapper(), getDescription(), EventRouter::EventMapper::getMapping(), EventRouter::hasListeners(), EventRouter::isListening(), EventRouter::isTrapping(), TimeOutTrans::processEvent(), SpiderMachineBehavior::processEvent(), SensorObserverControl::processEvent(), SegmentedColorGenerator::processEvent(), SegCamBehavior::processEvent(), RLEGenerator::processEvent(), RegionGenerator::processEvent(), RawCameraGenerator::processEvent(), PostureEditor::processEvent(), PNGGenerator::processEvent(), PitchDetector::processEvent(), MotionSequenceNode< SIZE >::processEvent(), MicrophoneServer::processEvent(), LostTargetTrans::processEvent(), JPEGGenerator::processEvent(), InterleavedYUVGenerator::processEvent(), FreeMemReportControl::processEvent(), FlashIPAddrBehavior::processEvent(), FilterBankGenerator::processEvent(), EventGeneratorBase::processEvent(), CDTGenerator::processEvent(), CameraStreamBehavior::processEvent(), BatteryMonitorBehavior::processEvent(), BallDetectionGenerator::processEvent(), AutoGetupBehavior::processEvent(), EventLogger::processStateMachineEvent(), EventRouter::removeListener(), EventRouter::removeTrapper(), EventRouter::EventMapper::verifyMapping(), RawCamBehavior::writeColor(), and RawCamBehavior::writeSingleChannel().
gets "strength" of event - by default 1 for activate and status events, 0 for deactivate events
Definition at line 157 of file EventBase.h. Referenced by getDescription().
gets the name of the event - useful for debugging output, see also getDescription()
Definition at line 154 of file EventBase.h. Referenced by IPCEventTranslator::encodeEvent(), getDescription(), EventRouter::PostingStatus::process(), SpiderMachineBehavior::processEvent(), SensorObserverControl::processEvent(), RegionGenerator::processEvent(), PostureEditor::processEvent(), FlashIPAddrBehavior::processEvent(), BatteryMonitorBehavior::processEvent(), BallDetectionGenerator::processEvent(), and EventLogger::processStateMachineEvent().
gets the source ID for this event
Definition at line 166 of file EventBase.h. Referenced by EventRouter::addListener(), EventRouter::addTimer(), EventRouter::addTrapper(), getDescription(), EventRouter::EventMapper::getMapping(), EventRouter::hasListeners(), EventRouter::isListening(), EventRouter::isTrapping(), WorldStateVelDaemon::processEvent(), WMMonitorBehavior::processEvent(), ValueEditControl< T >::processEvent(), SpiderMachineBehavior::processEvent(), SegmentedColorGenerator::processEvent(), RLEGenerator::processEvent(), RegionGenerator::processEvent(), RawCameraGenerator::processEvent(), PostureEditor::processEvent(), PNGGenerator::processEvent(), LostTargetTrans::processEvent(), JPEGGenerator::processEvent(), InterleavedYUVGenerator::processEvent(), FreeMemReportControl::processEvent(), FlashIPAddrBehavior::processEvent(), FilterBankGenerator::processEvent(), CompletionTrans::processEvent(), CDTGenerator::processEvent(), BatteryMonitorBehavior::processEvent(), BatteryCheckControl::processEvent(), BallDetectionGenerator::processEvent(), EventLogger::processStateMachineEvent(), EventRouter::removeListener(), EventRouter::removeTrapper(), Controller::trapEvent(), and EventRouter::EventMapper::verifyMapping().
time event was created
Definition at line 160 of file EventBase.h. Referenced by getDescription(), WorldStateVelDaemon::processEvent(), WorldStateSerializerBehavior::processEvent(), WalkCalibration::processEvent(), SpiderMachineBehavior::processEvent(), EventLogger::processStateMachineEvent(), WorldStateVelDaemon::trapEvent(), RawCamBehavior::writeColor(), RegionCamBehavior::writeRegions(), SegCamBehavior::writeRLE(), SegCamBehavior::writeSeg(), and RawCamBehavior::writeSingleChannel().
gets the type ID
Definition at line 169 of file EventBase.h. Referenced by EventRouter::addListener(), EventRouter::addTrapper(), getDescription(), EventRouter::EventMapper::getMapping(), EventRouter::hasListeners(), EventRouter::isListening(), EventRouter::isTrapping(), WorldStateVelDaemon::processEvent(), WalkToTargetNode::processEvent(), VisualTargetTrans::processEvent(), SpiderMachineBehavior::processEvent(), RawCameraGenerator::processEvent(), PostureEditor::processEvent(), FlashIPAddrBehavior::processEvent(), EStopControllerBehavior::processEvent(), Controller::processEvent(), CDTGenerator::processEvent(), EventLogger::processStateMachineEvent(), EventRouter::removeListener(), EventRouter::removeTrapper(), setName(), Controller::trapEvent(), and EventRouter::EventMapper::verifyMapping().
gets the name of the event - useful for debugging output, see also getDescription()
Definition at line 202 of file EventBase.h.
load from binary format
Reimplemented in LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, and VisionObjectEvent. Definition at line 134 of file EventBase.cc. Referenced by VisionObjectEvent::loadBinaryBuffer(), TimerEvent::loadBinaryBuffer(), TextMsgEvent::loadBinaryBuffer(), PitchEvent::loadBinaryBuffer(), LookoutPointAtEvent::loadBinaryBuffer(), LocomotionEvent::loadBinaryBuffer(), and loadBuffer().
no longer need to override this -- will automatically call either loadXML() or loadBinaryBuffer() based on saveFormat tries to be smart so if the load based on the current saveFormat fails, retries with the alternative format Reimplemented from XMLLoadSave. Definition at line 223 of file EventBase.h. Referenced by EventTranslator::decodeEvent().
automatically calls either XMLLoadSave::loadFile or LoadSave::loadFile based on saveFormat tries to be smart so if the load based on the current saveFormat fails, retries with the alternative format Reimplemented from XMLLoadSave. Definition at line 234 of file EventBase.h.
automatically calls either XMLLoadSave::loadFileStream or LoadSave::loadFileStream based on saveFormat
Reimplemented from XMLLoadSave. Definition at line 244 of file EventBase.h.
load from XML format
Implements XMLLoadSave. Reimplemented in LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, and VisionObjectEvent. Definition at line 166 of file EventBase.cc. Referenced by VisionObjectEvent::loadXML(), TimerEvent::loadXML(), TextMsgEvent::loadXML(), PitchEvent::loadXML(), LookoutPointAtEvent::loadXML(), and LocomotionEvent::loadXML().
compares event duration and ensures same event generator, source, and type - useful for event masks
Definition at line 197 of file EventBase.h.
converts the first 4 characters of str to an unsigned int, should ensure consistent byte ordering across platforms The numeric value may differ between platforms, but it will be consistent with the IDs on that platform, which is the real key since we aren't doing math, just equality Definition at line 262 of file EventBase.h. Referenced by VisionObjectEvent::getClassTypeID(), TimerEvent::getClassTypeID(), TextMsgEvent::getClassTypeID(), LookoutIREvent::getClassTypeID(), LookoutPointAtEvent::getClassTypeID(), LocomotionEvent::getClassTypeID(), and getClassTypeID().
gets the name of the event - useful for debugging output, see also getDescription()
Definition at line 188 of file EventBase.h.
resets name to generated form, overwriting any previous name
Definition at line 175 of file EventBase.h.
tests to see if events have the same generator and source IDs
Definition at line 195 of file EventBase.h. Referenced by Controller::trapEvent().
save to binary format
Reimplemented in LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, and VisionObjectEvent. Definition at line 152 of file EventBase.cc. Referenced by VisionObjectEvent::saveBinaryBuffer(), TimerEvent::saveBinaryBuffer(), TextMsgEvent::saveBinaryBuffer(), PitchEvent::saveBinaryBuffer(), LookoutPointAtEvent::saveBinaryBuffer(), LocomotionEvent::saveBinaryBuffer(), and saveBuffer().
no longer need to override this -- will automatically call either saveXML() or saveBinaryBuffer() based on saveFormat
Reimplemented from XMLLoadSave. Definition at line 230 of file EventBase.h. Referenced by EventTranslator::encodeEvent().
automatically calls either XMLLoadSave::saveFile or LoadSave::saveFile based on saveFormat
Reimplemented from XMLLoadSave. Definition at line 241 of file EventBase.h.
automatically calls either XMLLoadSave::loadFileStream or LoadSave::loadFileStream based on saveFormat
Reimplemented from XMLLoadSave. Definition at line 246 of file EventBase.h.
save to XML format
Implements XMLLoadSave. Reimplemented in LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, and VisionObjectEvent. Definition at line 221 of file EventBase.cc. Referenced by EventLogger::processEvent(), VisionObjectEvent::saveXML(), TimerEvent::saveXML(), TextMsgEvent::saveXML(), PitchEvent::saveXML(), LookoutPointAtEvent::saveXML(), and LocomotionEvent::saveXML().
sets the time since the beginning of this sequence (the timestamp of the activate event)
Definition at line 173 of file EventBase.h.
sets the generator ID for this event
Definition at line 164 of file EventBase.h.
sets "strength" of event - you may want to override the default values (see getMagnitude())
Definition at line 158 of file EventBase.h. Referenced by EventBase().
sets name to a given string, prevents overwriting by generated names
Definition at line 84 of file EventBase.cc. Referenced by BallDetectionGenerator::createEvent(), EventBase(), genName(), and loadXML().
set saveFormat
Definition at line 253 of file EventBase.h. Referenced by EventTranslator::decodeEvent(), and EventTranslator::encodeEvent().
sets the type ID
Definition at line 170 of file EventBase.h. Referenced by RegionGenerator::processEvent(), PNGGenerator::processEvent(), and JPEGGenerator::processEvent().
compares event duration and ensures same event generator, source, and type - useful for event masks
Definition at line 198 of file EventBase.h.
Member Data Documentation
the time since this sequence started (like, how long the button has been pressed); not all generators will set this; Typically, this would be 0 for activate, (activate.timestamp-get_time()) for status and deactivate
Definition at line 279 of file EventBase.h. Referenced by equalOrLongerThan(), equalOrShorterThan(), getBinSize(), getDuration(), loadBinaryBuffer(), loadXML(), longerThan(), saveBinaryBuffer(), saveXML(), setDuration(), and shorterThan().
Holds string versions of each of the generator's names, handy for debugging so you can output the events as readable strings (you'll find this in EventBase.cc since it can't go in the header or we get multiply-defined errors during linking).
Definition at line 118 of file EventBase.h. Referenced by EventRouter::addListener(), EventRouter::addTrapper(), EventLogger::EventLogger(), loadXML(), EventRouter::removeListener(), EventRouter::removeTrapper(), saveXML(), setName(), and Controller::takeLine().
holds abbreviated string versions of EventTypeID_t
Definition at line 132 of file EventBase.h. Referenced by loadXML(), saveXML(), setName(), setTypeID(), and Controller::takeLine().
Initial value: {
"activate",
"status",
"deactivate"
}
Definition at line 129 of file EventBase.h. Referenced by loadXML(), and Controller::takeLine().
generator ID, see EventGeneratorID_t
Definition at line 273 of file EventBase.h. Referenced by getGeneratorID(), loadBinaryBuffer(), loadXML(), operator==(), sameGenSource(), saveBinaryBuffer(), saveXML(), setGeneratorID(), and setName().
the current "strength" of the event/stimuli... MAKE SURE this gets set to ZERO IF event is DEACTIVATE
Definition at line 265 of file EventBase.h. Referenced by getBinSize(), getMagnitude(), loadBinaryBuffer(), loadXML(), saveBinaryBuffer(), saveXML(), and setMagnitude().
tracks whether the current name (stim_id) was generated by genName() (true) or setName() (false)
Definition at line 270 of file EventBase.h. Referenced by genName(), getBinSize(), isCustomName(), loadBinaryBuffer(), resetName(), saveBinaryBuffer(), saveXML(), and setName().
controls the format used during the next call to saveBuffer() (packed binary or XML)
Definition at line 268 of file EventBase.h. Referenced by VisionObjectEvent::getBinSize(), TimerEvent::getBinSize(), TextMsgEvent::getBinSize(), PitchEvent::getBinSize(), LookoutIREvent::getBinSize(), LookoutPointAtEvent::getBinSize(), LocomotionEvent::getBinSize(), getBinSize(), getSaveFormat(), loadBuffer(), loadFile(), loadFileStream(), saveBuffer(), saveFile(), saveFileStream(), and setSaveFormat().
the source ID for this event Source IDs are defined by the generator that made it. This should give authors flexibility to design their modules without having to worry about ID space collision
Definition at line 275 of file EventBase.h. Referenced by genName(), getBinSize(), getSourceID(), loadBinaryBuffer(), loadXML(), operator==(), sameGenSource(), saveBinaryBuffer(), saveXML(), and setSourceID().
the name of the event, use the same name consistently or else will be seen as different stimuli
Definition at line 264 of file EventBase.h. Referenced by getBinSize(), getName(), loadBinaryBuffer(), resetName(), saveBinaryBuffer(), saveXML(), setName(), and setTypeID().
the time the event was created - set automatically by constructor
Definition at line 266 of file EventBase.h. Referenced by getBinSize(), getTimeStamp(), loadBinaryBuffer(), loadXML(), operator<(), saveBinaryBuffer(), saveXML(), and setTimeStamp().
type ID, see EventTypeID_t
Definition at line 274 of file EventBase.h. Referenced by getTypeID(), loadBinaryBuffer(), loadXML(), operator==(), saveBinaryBuffer(), saveXML(), and setTypeID().
The documentation for this class was generated from the following files: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tekkotsu v3.0 |
Generated Wed Oct 4 00:05:00 2006 by Doxygen 1.4.7 |