Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
EventBase Class ReferenceForms the basis of communication between modules/behaviors in the framework. More...
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 Typedef Documentation
type used for class ids in the type registry (see getTypeRegistry()) Definition at line 144 of file EventBase.h. type used for the type registry Definition at line 147 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 130 of file EventBase.h. values to pass to setSaveFormat()
Definition at line 279 of file EventBase.h. Constructor & Destructor Documentation
constructor
Definition at line 90 of file EventBase.cc. Referenced by clone().
destructor Definition at line 159 of file EventBase.h. 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, TID >, FilterBankEvent, GrasperEvent, LocomotionEvent, LookoutPointAtEvent, LookoutSketchEvent, LookoutIREvent, LookoutScanEvent, MoCapEvent, PilotEvent, PitchEvent, SegmentedColorFilterBankEvent, TextMsgEvent, TimerEvent, VisionObjectEvent, and DataEvent< T >. Definition at line 168 of file EventBase.h. Referenced by Transition::fire().
compares event duration and ensures same event generator, source, and type - useful for event masks Definition at line 229 of file EventBase.h.
compares event duration and ensures same event generator, source, and type - useful for event masks Definition at line 230 of file EventBase.h.
calls setName() with a string version of sourceID, decimal notation Definition at line 311 of file EventBase.cc. Referenced by EventBase(), loadBinaryBuffer(), loadXML(), resetName(), setGeneratorID(), setHostID(), and setSourceID().
should return the minimum size needed if using binary format (i.e. not XML) Reimplemented from XMLLoadSave. Reimplemented in DataEvent< T, TID >, KoduEventBase, KoduGiveEvent, KoduSayEvent, LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, VisionObjectEvent, and DataEvent< T >. Definition at line 164 of file EventBase.cc.
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 DataEvent< T, TID >, FilterBankEvent, LocomotionEvent, LookoutPointAtEvent, LookoutSketchEvent, LookoutIREvent, LookoutScanEvent, PitchEvent, SegmentedColorFilterBankEvent, TextMsgEvent, TimerEvent, VisionObjectEvent, and DataEvent< T >. Definition at line 243 of file EventBase.h.
generates a description of the event with variable verbosity
Reimplemented in KoduEventBase, KoduGiveEvent, KoduSayEvent, LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, and VisionObjectEvent. Definition at line 151 of file EventBase.cc. Referenced by Grasper::GrasperFailed::doStart(), EventLogger::processEvent(), BehaviorBase::processEvent(), DualCoding::Lookout::processPointAtEvent(), DualCoding::Lookout::processSearchEvent(), and EventLogger::processStateMachineEvent().
gets the time since the beginning of this sequence (the timestamp of the activate event)
Definition at line 202 of file EventBase.h. Referenced by EventRouter::addTimer(), getDescription(), and Controller::trapEvent().
gets the generator ID for this event
Definition at line 189 of file EventBase.h. Referenced by EventRouter::addListener(), EventRouter::addRemoteListener(), EventRouter::addTrapper(), WalkController::doEvent(), TimeOutTrans::doEvent(), TextMsgTrans::doEvent(), SignalTrans< T >::doEvent(), SegmentedColorGenerator::doEvent(), SegCam::doEvent(), RLEGenerator::doEvent(), RegionGenerator::doEvent(), RawCameraGenerator::doEvent(), RawCam::doEvent(), PNGGenerator::doEvent(), PitchDetector::doEvent(), PilotTrans::doEvent(), MotionSequenceNode< SIZE >::doEvent(), MCNodeBase::doEvent(), DualCoding::MapBuilder::doEvent(), LostTargetTrans::doEvent(), DualCoding::Lookout::doEvent(), LookAtMarkers::Search::doEvent(), LookAtMarkers::TrackMarker::doEvent(), LogNode::doEvent(), KoduInterpreter::NotificationMonitor::doEvent(), KoduInterpreter::ReceiveActionRunner::ReceiveActionStart::doEvent(), KoduInterpreter::GiveActionRunner::GiveActionStart::doEvent(), JPEGGenerator::doEvent(), InterleavedYUVGenerator::doEvent(), GrasperNode::doEvent(), GamepadController::doEvent(), FreeMemReportControl::doEvent(), FlashIPAddrBehavior::doEvent(), FilterBankGenerator::doEvent(), FFPlanNode::doEvent(), FFPlanner::doEvent(), DynamicMotionSequenceNode::doEvent(), DeadReckoningBehavior< ParticleT >::doEvent(), CompletionTrans::doEvent(), CDTGenerator::doEvent(), CameraStreamBehavior::doEvent(), CameraBehavior::doEvent(), BufferedImageGenerator::doEvent(), BehaviorBase::doEvent(), BatteryMonitorBehavior::doEvent(), BallDetectionGenerator::doEvent(), ArmController::doEvent(), getDescription(), EventRouter::EventMapper::getMapping(), EventRouter::hasListeners(), EventRouter::isListening(), EventRouter::isTrapping(), EventRouter::SameID::operator()(), TorqueCalibrate::TakeMeasurementControl::processEvent(), SensorObserverControl::processEvent(), RemoteRouter::processEvent(), PostureEditor::processEvent(), KoduDiscover::processEvent(), EventProxy::processEvent(), EventGeneratorBase::processEvent(), DualCoding::Lookout::processPointAtEvent(), DualCoding::Lookout::processScanEvent(), DualCoding::Lookout::processSearchEvent(), EventLogger::processStateMachineEvent(), DualCoding::Lookout::processTrackEvent(), EventRouter::removeListener(), EventRouter::removeRemoteListener(), EventRouter::removeTimer(), EventRouter::removeTrapper(), EventRouter::EventMapper::verifyMapping(), RawCam::writeColor(), and RawCam::writeSingleChannel().
ID of the host that generated this event (-1U for localhost). Definition at line 199 of file EventBase.h. Referenced by KoduInterpreter::KoduEventListener::doEvent(), and EventProxy::processEvent().
gets "strength" of event - by default 1 for activate and status events, 0 for deactivate events Definition at line 183 of file EventBase.h. Referenced by getDescription(), and Controller::trapEvent().
gets the name of the event - useful for debugging output, see also getDescription() Definition at line 180 of file EventBase.h. Referenced by RegionGenerator::doEvent(), FlashIPAddrBehavior::doEvent(), EchoBehavior::doEvent(), BatteryMonitorBehavior::doEvent(), BallDetectionGenerator::doEvent(), Transition::fire(), getDescription(), EventRouter::PostingStatus::process(), SensorObserverControl::processEvent(), PostureEditor::processEvent(), DualCoding::Lookout::processScanEvent(), EventLogger::processStateMachineEvent(), and EventRouter::processTimers().
return saveFormat Definition at line 284 of file EventBase.h.
gets the source ID for this event
Definition at line 192 of file EventBase.h. Referenced by EventRouter::addListener(), EventRouter::addRemoteListener(), EventRouter::addTimer(), EventRouter::addTrapper(), WalkController::doEvent(), MotionSequenceNode< SIZE >::doEvent(), DualCoding::MapBuilder::doEvent(), LookAtMarkers::Search::doEvent(), LookAtMarkers::TrackMarker::doEvent(), KoduInterpreter::NotificationMonitor::doEvent(), FreeMemReportControl::doEvent(), FlashIPAddrBehavior::doEvent(), EventTrans::doEvent(), DynamicMotionSequenceNode::doEvent(), CompletionTrans::doEvent(), BufferedImageGenerator::doEvent(), BatteryMonitorBehavior::doEvent(), getDescription(), EventRouter::EventMapper::getMapping(), EventRouter::hasListeners(), EventRouter::isListening(), EventRouter::isTrapping(), EventRouter::SameID::operator()(), RemoteRouter::processEvent(), PostureEditor::processEvent(), EventProxy::processEvent(), DualCoding::Lookout::processPointAtEvent(), DualCoding::Lookout::processScanEvent(), DualCoding::Lookout::processSearchEvent(), EventLogger::processStateMachineEvent(), DualCoding::Lookout::processTrackEvent(), EventRouter::removeListener(), EventRouter::removeRemoteListener(), EventRouter::removeTimer(), EventRouter::removeTrapper(), Controller::trapEvent(), and EventRouter::EventMapper::verifyMapping().
time event was created Definition at line 186 of file EventBase.h. Referenced by WorldStateSerializerBehavior::doEvent(), LogNode::doEvent(), DeadReckoningBehavior< ParticleT >::doEvent(), MoCapLogger::dump(), Transition::fire(), getDescription(), WalkCalibration::processEvent(), EventLogger::processStateMachineEvent(), RawCam::writeColor(), DepthCam::writeDepth(), RegionCam::writeRegions(), SegCam::writeRLE(), SegCam::writeSeg(), and RawCam::writeSingleChannel().
gets the type ID
Definition at line 195 of file EventBase.h. Referenced by EventRouter::addListener(), EventRouter::addRemoteListener(), EventRouter::addTrapper(), VisualTargetTrans::doEvent(), RLEGenerator::doEvent(), RawCameraGenerator::doEvent(), FlashIPAddrBehavior::doEvent(), EventTrans::doEvent(), EStopController::doEvent(), Controller::doEvent(), CDTGenerator::doEvent(), BufferedImageGenerator::doEvent(), getDescription(), EventRouter::EventMapper::getMapping(), EventRouter::hasListeners(), EventRouter::isListening(), EventRouter::isTrapping(), PostureEditor::processEvent(), EventLogger::processStateMachineEvent(), EventRouter::removeListener(), EventRouter::removeRemoteListener(), EventRouter::removeTrapper(), setName(), Controller::trapEvent(), and EventRouter::EventMapper::verifyMapping().
returns a FamilyFactory with which you can look up classTypeID_t's to make new instances from serialized data Definition at line 85 of file EventBase.cc. Referenced by EventTranslator::decodeEvent(), and DataEvent< T >::registerDataType().
returns true if not using the generated name Definition at line 206 of file EventBase.h.
gets the name of the event - useful for debugging output, see also getDescription() Definition at line 232 of file EventBase.h.
load from binary format Reimplemented in DataEvent< T, TID >, KoduEventBase, KoduGiveEvent, KoduSayEvent, LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, VisionObjectEvent, and DataEvent< T >. Definition at line 182 of file EventBase.cc. Referenced by RemoteRouter::forwardEvent(), VisionObjectEvent::loadBinaryBuffer(), TimerEvent::loadBinaryBuffer(), TextMsgEvent::loadBinaryBuffer(), PitchEvent::loadBinaryBuffer(), LookoutPointAtEvent::loadBinaryBuffer(), LocomotionEvent::loadBinaryBuffer(), KoduEventBase::loadBinaryBuffer(), DataEvent< T, TID >::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 253 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 264 of file EventBase.h.
automatically calls either XMLLoadSave::loadFileStream or LoadSave::loadFileStream based on saveFormat Reimplemented from XMLLoadSave. Definition at line 274 of file EventBase.h.
load from XML format Implements XMLLoadSave. Reimplemented in DataEvent< T, TID >, LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, VisionObjectEvent, and DataEvent< T >. Definition at line 218 of file EventBase.cc.
compares event duration and ensures same event generator, source, and type - useful for event masks Definition at line 227 of file EventBase.h.
converts the first 4 characters of str to an unsigned int, should ensure consistent byte ordering across platforms Definition at line 289 of file EventBase.h.
template<typename T >
Definition at line 172 of file EventBase.h.
gets the name of the event - useful for debugging output, see also getDescription() Definition at line 218 of file EventBase.h.
is true if the genID, typeID, and sourceID's all match Definition at line 221 of file EventBase.h.
resets name to generated form, overwriting any previous name Definition at line 205 of file EventBase.h.
tests to see if events have the same generator and source IDs Definition at line 225 of file EventBase.h. Referenced by Controller::trapEvent().
save to binary format Reimplemented in DataEvent< T, TID >, KoduEventBase, KoduGiveEvent, KoduSayEvent, LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, VisionObjectEvent, and DataEvent< T >. Definition at line 203 of file EventBase.cc. Referenced by EventProxy::processEvent(), VisionObjectEvent::saveBinaryBuffer(), TimerEvent::saveBinaryBuffer(), TextMsgEvent::saveBinaryBuffer(), PitchEvent::saveBinaryBuffer(), LookoutPointAtEvent::saveBinaryBuffer(), LocomotionEvent::saveBinaryBuffer(), KoduEventBase::saveBinaryBuffer(), DataEvent< T, TID >::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 260 of file EventBase.h.
automatically calls either XMLLoadSave::saveFile or LoadSave::saveFile based on saveFormat Reimplemented from XMLLoadSave. Definition at line 271 of file EventBase.h.
automatically calls either XMLLoadSave::loadFileStream or LoadSave::loadFileStream based on saveFormat Reimplemented from XMLLoadSave. Definition at line 276 of file EventBase.h.
save to XML format Implements XMLLoadSave. Reimplemented in DataEvent< T, TID >, LocomotionEvent, LookoutPointAtEvent, LookoutIREvent, PitchEvent, TextMsgEvent, TimerEvent, VisionObjectEvent, and DataEvent< T >. Definition at line 281 of file EventBase.cc.
sets the time since the beginning of this sequence (the timestamp of the activate event)
Definition at line 203 of file EventBase.h.
sets the generator ID for this event
Definition at line 190 of file EventBase.h.
sets the ID of the host associated with this event Definition at line 200 of file EventBase.h. sets "strength" of event - you may want to override the default values (see getMagnitude()) Definition at line 184 of file EventBase.h. Referenced by EventBase().
sets name to a given string, prevents overwriting by generated names Definition at line 125 of file EventBase.cc. Referenced by BallDetectionGenerator::createEvent(), EventBase(), genName(), and loadXML().
set saveFormat Definition at line 283 of file EventBase.h. Referenced by EventTranslator::decodeEvent().
sets the source ID for this event
Definition at line 193 of file EventBase.h. Referenced by CameraBehavior::doStart().
resets time event was created Definition at line 187 of file EventBase.h.
sets the type ID
Definition at line 196 of file EventBase.h. Referenced by SegmentedColorGenerator::doEvent(), RegionGenerator::doEvent(), PNGGenerator::doEvent(), JPEGGenerator::doEvent(), and InterleavedYUVGenerator::doEvent().
compares event duration and ensures same event generator, source, and type - useful for event masks Definition at line 228 of file EventBase.h. Referenced by CameraBehavior::doEvent(). Member Data Documentation
causes class type id to automatically be regsitered with EventBase's FamilyFactory (getTypeRegistry()) Definition at line 321 of file EventBase.h. Referenced by getClassTypeID().
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 315 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 127 of file EventBase.h. Referenced by EventRouter::addListener(), EventRouter::addTrapper(), doNameChecks(), EventLogger::EventLogger(), loadXML(), EventRouter::removeListener(), EventRouter::removeTrapper(), saveXML(), setName(), and Controller::takeLine().
holds abbreviated string versions of EventTypeID_t Definition at line 141 of file EventBase.h. Referenced by doNameChecks(), loadXML(), saveXML(), setName(), setTypeID(), and Controller::takeLine().
Initial value:
{ "activate", "status", "deactivate", NULL } holds string versions of EventTypeID_t Definition at line 138 of file EventBase.h. Referenced by doNameChecks(), loadXML(), and Controller::takeLine().
generator ID, see EventGeneratorID_t Definition at line 308 of file EventBase.h. Referenced by getGeneratorID(), loadBinaryBuffer(), loadXML(), operator==(), PitchEvent::PitchEvent(), sameGenSource(), saveBinaryBuffer(), saveXML(), setGeneratorID(), and setName().
Definition at line 314 of file EventBase.h. Referenced by getBinSize(), getHostID(), loadBinaryBuffer(), loadXML(), saveBinaryBuffer(), saveXML(), setHostID(), and setName().
the current "strength" of the event/stimuli... MAKE SURE this gets set to ZERO IF event is DEACTIVATE Definition at line 300 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 305 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 303 of file EventBase.h. Referenced by VisionObjectEvent::getBinSize(), TimerEvent::getBinSize(), TextMsgEvent::getBinSize(), PitchEvent::getBinSize(), LookoutIREvent::getBinSize(), LookoutPointAtEvent::getBinSize(), LocomotionEvent::getBinSize(), KoduSayEvent::getBinSize(), KoduGiveEvent::getBinSize(), KoduEventBase::getBinSize(), getBinSize(), DataEvent< T, TID >::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 310 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 299 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 301 of file EventBase.h. Referenced by getBinSize(), getTimeStamp(), loadBinaryBuffer(), loadXML(), operator<(), saveBinaryBuffer(), saveXML(), and setTimeStamp().
type ID, see EventTypeID_t Definition at line 309 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 v5.1CVS |
Generated Mon May 9 04:59:07 2016 by Doxygen 1.6.3 |