Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
#include <EventBase.h>
Inheritance diagram for EventBase:
Contains the list of 'known' event generators in EventGeneratorID_t and EventGeneratorNames[]. 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 it's name in the EventGeneratorNames[] array.
Alternatively, there is an 'unlicensed spectrum' available under the 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 SourceID is generator specific. A SID of i from the button generator will refer to a particular button, whereas a SID from vision refers to seeing a particular object. These SIDs are usually defined in the generators themselves. See the EventGeneratorID_t list for links to the generators.
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)
Definition at line 31 of file EventBase.h.
Public Types | |
enum | EventGeneratorID_t { unknownEGID = 0, aiEGID, audioEGID, buttonEGID, erouterEGID, estopEGID, locomotionEGID, motmanEGID, powerEGID, sensorEGID, stateMachineEGID, textmsgEGID, timerEGID, visOFbkEGID, visRawCameraEGID, visInterleaveEGID, visJPEGEGID, visSegmentEGID, visRLEEGID, visRegionEGID, visObjEGID, wmVarEGID, worldModelEGID, numEGIDs } |
Lists all possible event generator ids. More... | |
enum | EventTypeID_t { activateETID, statusETID, deactivateETID, numETIDs } |
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) More... | |
Public Member Functions | |
Constructors/Destructors | |
EventBase () | |
constructor | |
EventBase (EventGeneratorID_t gid, unsigned int sid, EventTypeID_t tid, unsigned int dur=0) | |
constructor | |
EventBase (EventGeneratorID_t gid, unsigned int sid, EventTypeID_t tid, unsigned int dur, const std::string &n, float mag) | |
constructor | |
virtual | ~EventBase () |
destructor | |
Methods | |
virtual const std::string & | getName () const |
gets the name of the event - useful for debugging, outputs | |
virtual EventBase & | setName (const std::string &n) |
sets name to a given string, prevents overwriting by generated names | |
virtual float | getMagnitude () const |
gets "strength" of event - you might have useful values... used by AI | |
virtual EventBase & | setMagnitude (float m) |
sets "strength" of event - but you might have useful values... used by AI | |
virtual unsigned int | getTimeStamp () const |
time event was created | |
virtual EventGeneratorID_t | getGeneratorID () const |
gets the generator ID for this event | |
virtual EventBase & | setGeneratorID (EventGeneratorID_t gid) |
sets the generator ID for this event | |
virtual unsigned int | getSourceID () const |
gets the source ID for this event | |
virtual EventBase & | setSourceID (unsigned int sid) |
sets the source ID for this event | |
virtual EventTypeID_t | getTypeID () const |
gets the type ID | |
virtual EventBase & | setTypeID (EventTypeID_t tid) |
sets the type ID | |
virtual unsigned int | getDuration () const |
OPTIONAL gets the time since the beginning of this sequence (the timestamp of the activate event). | |
virtual EventBase & | setDuration (unsigned int d) |
OPTIONAL gets the time since the beginning of this sequence (the timestamp of the activate event). | |
virtual const std::string & | resetName () |
resets name to generated form, overwriting any previous name | |
virtual bool | isCustomName () const |
returns true if not using the generated name | |
bool | operator< (const EventBase &e) const |
gets the name of the event - useful for debugging, outputs | |
virtual bool | operator== (const EventBase &eb) const |
is true if the genID, typeID, and sourceID's all match | |
bool | sameGenSource (const EventBase &eb) const |
tests to see if events have the same generator and source IDs | |
bool | longerThan (const EventBase &eb) const |
compares event duration and ensures same event generator, source, and type - useful for event masks | |
bool | shorterThan (const EventBase &eb) const |
compares event duration and ensures same event generator, source, and type - useful for event masks | |
bool | equalOrLongerThan (const EventBase &eb) const |
compares event duration and ensures same event generator, source, and type - useful for event masks | |
bool | equalOrShorterThan (const EventBase &eb) const |
compares event duration and ensures same event generator, source, and type - useful for event masks | |
LoadSave interface | |
Useful for serializing events to send between processes | |
virtual unsigned int | getBinSize () const |
calculates space needed to save - if you can't precisely add up the size, overestimate and things will still work. | |
virtual unsigned int | LoadBuffer (const char buf[], unsigned int len) |
Load from a saved buffer. | |
virtual unsigned int | SaveBuffer (char buf[], unsigned int len) const |
Save to a given buffer. | |
Static Public Attributes | |
const char *const | EventGeneratorNames [numEGIDs] |
Holds string versions of each of the generator's names, handy for debugging so you can output the events as readable strings. | |
Protected Member Functions | |
virtual void | genName () |
This does the actual generation of names based on genID, sourceID, and typeID. | |
Protected Attributes | |
std::string | stim_id |
the name of the event, use the same name consistently or else will be seen as different stimuli | |
float | magnitude |
the current "strength" of the event/stimuli... MAKE SURE this gets set to ZERO IF event is DEACTIVATE | |
unsigned int | timestamp |
the time the event was created - set automatically by constructor | |
bool | nameisgen |
tracks whether the current name (stim_id) is generated or set | |
EventGeneratorID_t | genID |
generator ID, see EventGeneratorID_t | |
EventTypeID_t | typeID |
type ID, see EventTypeID_t | |
unsigned int | sourceID |
the source ID for this event Source IDs are defined by the generator that made it | |
unsigned int | duration |
the time since this sequence started (like, how long the button has been pressed) ideally, this would be 0 for activate, (activate.timestamp-get_time()) for status and deactivate |
|
Lists 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 37 of file EventBase.h. Referenced by EventRouter::addTrapper(), EventLogger::doSelect(), EventGeneratorBase::getGeneratorID(), getGeneratorID(), EventGeneratorBase::getListenGeneratorID(), LoadBuffer(), EventRouter::removeListener(), and EventRouter::removeTrapper(). |
|
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 68 of file EventBase.h. Referenced by EventRouter::addListener(), EventRouter::addTrapper(), getTypeID(), LoadBuffer(), EventRouter::removeListener(), and EventRouter::removeTrapper(). |
|
constructor
Definition at line 31 of file EventBase.cc. |
|
constructor
Definition at line 37 of file EventBase.cc. |
|
constructor
Definition at line 47 of file EventBase.cc. |
|
destructor
Definition at line 81 of file EventBase.h. |
|
compares event duration and ensures same event generator, source, and type - useful for event masks
Definition at line 119 of file EventBase.h. |
|
compares event duration and ensures same event generator, source, and type - useful for event masks
Definition at line 120 of file EventBase.h. |
|
This does the actual generation of names based on genID, sourceID, and typeID.
Definition at line 123 of file EventBase.cc. Referenced by EventBase(), resetName(), setGeneratorID(), setSourceID(), and setTypeID(). |
|
calculates space needed to save - if you can't precisely add up the size, overestimate and things will still work.
Implements LoadSave. Reimplemented in LocomotionEvent, TextMsgEvent, and VisionObjectEvent. Definition at line 55 of file EventBase.cc. Referenced by EventTranslator::enqueue(), VisionObjectEvent::getBinSize(), TextMsgEvent::getBinSize(), and LocomotionEvent::getBinSize(). |
|
OPTIONAL gets the time since the beginning of this sequence (the timestamp of the activate event).
Definition at line 102 of file EventBase.h. Referenced by EventRouter::addListener(), EventRouter::addTimer(), EventLogger::processEvent(), and Controller::trapEvent(). |
|
|
gets "strength" of event - you might have useful values... used by AI
Definition at line 88 of file EventBase.h. Referenced by EventLogger::processEvent(), and Controller::trapEvent(). |
|
gets the name of the event - useful for debugging, outputs
Definition at line 85 of file EventBase.h. Referenced by TimeOutTrans::processEvent(), RegionGenerator::processEvent(), HeadLevelBehavior::processEvent(), FollowHeadBehavior::processEvent(), EventLogger::processEvent(), BatteryMonitorBehavior::processEvent(), BallDetectionGenerator::processEvent(), and AlanBehavior::processEvent(). |
|
|
time event was created
Definition at line 91 of file EventBase.h. Referenced by WorldStateVelDaemon::processEvent(), WalkCalibration::processEvent(), EventLogger::processEvent(), WorldStateVelDaemon::trapEvent(), RawCamBehavior::writeColor(), SegCamBehavior::writeRLE(), SegCamBehavior::writeSeg(), and RawCamBehavior::writeSingleChannel(). |
|
|
returns true if not using the generated name
Definition at line 106 of file EventBase.h. |
|
Load from a saved buffer.
Implements LoadSave. Reimplemented in LocomotionEvent, TextMsgEvent, and VisionObjectEvent. Definition at line 70 of file EventBase.cc. Referenced by VisionObjectEvent::LoadBuffer(), TextMsgEvent::LoadBuffer(), LocomotionEvent::LoadBuffer(), and EventTranslator::sendEvent(). |
|
compares event duration and ensures same event generator, source, and type - useful for event masks
Definition at line 117 of file EventBase.h. |
|
gets the name of the event - useful for debugging, outputs
Definition at line 108 of file EventBase.h. |
|
is true if the genID, typeID, and sourceID's all match
Definition at line 111 of file EventBase.h. |
|
resets name to generated form, overwriting any previous name
Definition at line 105 of file EventBase.h. |
|
tests to see if events have the same generator and source IDs
Definition at line 115 of file EventBase.h. Referenced by Controller::trapEvent(). |
|
Save to a given buffer.
Implements LoadSave. Reimplemented in LocomotionEvent, TextMsgEvent, and VisionObjectEvent. Definition at line 98 of file EventBase.cc. Referenced by EventTranslator::enqueue(), VisionObjectEvent::SaveBuffer(), TextMsgEvent::SaveBuffer(), and LocomotionEvent::SaveBuffer(). |
|
OPTIONAL gets the time since the beginning of this sequence (the timestamp of the activate event).
Definition at line 103 of file EventBase.h. |
|
sets the generator ID for this event
Definition at line 94 of file EventBase.h. |
|
sets "strength" of event - but you might have useful values... used by AI
Definition at line 89 of file EventBase.h. Referenced by EventBase(). |
|
sets name to a given string, prevents overwriting by generated names
Definition at line 86 of file EventBase.h. |
|
sets the source ID for this event
Definition at line 97 of file EventBase.h. Referenced by CameraBehavior::DoStart(), HeadLevelBehavior::HeadLevelBehavior(), and SoundTestBehavior::SoundTestBehavior(). |
|
sets the type ID
Definition at line 100 of file EventBase.h. |
|
compares event duration and ensures same event generator, source, and type - useful for event masks
Definition at line 118 of file EventBase.h. Referenced by CameraBehavior::processEvent(). |
|
the time since this sequence started (like, how long the button has been pressed) ideally, this would be 0 for activate, (activate.timestamp-get_time()) for status and deactivate
Definition at line 143 of file EventBase.h. Referenced by equalOrLongerThan(), equalOrShorterThan(), getBinSize(), getDuration(), LoadBuffer(), longerThan(), SaveBuffer(), setDuration(), and shorterThan(). |
|
Initial value: { "UnknownGen", "AI", "Audio", "Button", "EventRouter", "EStop", "Locomotion", "MotionManager", "Power", "Sensor", "StateMachine", "TextMsg", "Timer", "VisionOFbkVector", "VisionRawCamera", "VisionInterleaver", "VisionJPEGCompressor", "VisionSegmenter", "VisionRLEEncoder", "VisionRegionConnector", "VisionObjectDetector", "WMVariable", "WorldModel", }
Definition at line 4 of file EventBase.cc. Referenced by EventLogger::EventLogger(), and genName(). |
|
generator ID, see EventGeneratorID_t
Definition at line 137 of file EventBase.h. Referenced by genName(), getGeneratorID(), LoadBuffer(), operator==(), sameGenSource(), SaveBuffer(), and setGeneratorID(). |
|
the current "strength" of the event/stimuli... MAKE SURE this gets set to ZERO IF event is DEACTIVATE
Definition at line 131 of file EventBase.h. Referenced by getBinSize(), getMagnitude(), LoadBuffer(), SaveBuffer(), and setMagnitude(). |
|
tracks whether the current name (stim_id) is generated or set
Definition at line 134 of file EventBase.h. Referenced by genName(), getBinSize(), isCustomName(), LoadBuffer(), resetName(), SaveBuffer(), and setName(). |
|
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 139 of file EventBase.h. Referenced by genName(), getBinSize(), getSourceID(), LoadBuffer(), operator==(), sameGenSource(), SaveBuffer(), and setSourceID(). |
|
the name of the event, use the same name consistently or else will be seen as different stimuli
Definition at line 130 of file EventBase.h. Referenced by genName(), getBinSize(), getName(), LoadBuffer(), resetName(), SaveBuffer(), and setName(). |
|
the time the event was created - set automatically by constructor
Definition at line 132 of file EventBase.h. Referenced by getBinSize(), getTimeStamp(), LoadBuffer(), operator<(), and SaveBuffer(). |
|
type ID, see EventTypeID_t
Definition at line 138 of file EventBase.h. Referenced by getTypeID(), LoadBuffer(), operator==(), SaveBuffer(), and setTypeID(). |
Tekkotsu v2.0 |
Generated Wed Jan 21 03:23:08 2004 by Doxygen 1.3.4 |