Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

EventBase Class Reference

Forms the basis of communication between modules/behaviors in the framework. More...

#include <EventBase.h>

Inheritance diagram for EventBase:

Detailed Description

Forms the basis of communication between modules/behaviors in the framework.

Events are defined by a 3-tuple:

  • The generator indicates the class of the creator of the event, and in practice also generally implies the type (i.e. subclass) of the event itself.
  • The source indicates the instance of the creator of the event, which differentiates when more than one generator is available.
  • The type indicates the role of the event among other events from the source.

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:

(EventBase::buttonEGID, ERS7Info::HeadButOffset, EventBase::activateETID)

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

(EventBase::sensorEGID,SensorSrcID::UpdatedSID,EventBase::statusETID)

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.

Note:
All subclasses must override getClassTypeID() and provide a unique value to allow fast polymorphic serialization for inter-process communication. Implementing the load/save functions ({load,save}BinaryBuffer and {load,save}XML) for your addtional data fields would also be necessary in order to allow your event to be sent between processes, or eventually, between robots.
See also:
EventRouter for discussion on sending and receiving of events
Tutorials:

Definition at line 74 of file EventBase.h.

List of all members.

Public Types

enum  EventGeneratorID_t {
  unknownEGID = 0, aiEGID, audioEGID, buttonEGID,
  cameraResolutionEGID, erouterEGID, estopEGID, grasperEGID,
  koduEGID, locomotionEGID, lookoutEGID, mapbuilderEGID,
  micOSndEGID, micRawEGID, micFFTEGID, micPitchEGID,
  mocapEGID, motmanEGID, pilotEGID, powerEGID,
  remoteStateEGID, runtimeEGID, sensorEGID, servoEGID,
  stateMachineEGID, stateSignalEGID, stateTransitionEGID, textmsgEGID,
  timerEGID, userEGID, visInterleaveEGID, visJPEGEGID,
  visObjEGID, visOFbkEGID, visPNGEGID, visRawCameraEGID,
  visRawDepthEGID, visRegionEGID, visRLEEGID, visSegmentEGID,
  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...
typedef unsigned int classTypeID_t
 type used for class ids in the type registry (see getTypeRegistry())
typedef FamilyFactory
< EventBase, classTypeID_t
registry_t
 type used for the type registry

Public Member Functions

template<typename T >
 operator const T & () const
Constructors/Destructors

 EventBase ()
 constructor
 EventBase (EventGeneratorID_t gid, size_t sid, EventTypeID_t tid, unsigned int dur=0)
 constructor
 EventBase (EventGeneratorID_t gid, size_t sid, EventTypeID_t tid, unsigned int dur, const std::string &n)
 constructor
 EventBase (EventGeneratorID_t gid, size_t sid, EventTypeID_t tid, unsigned int dur, const std::string &n, float mag)
 constructor
virtual ~EventBase ()
 destructor
virtual EventBaseclone () const
 allows a copy to be made of an event, supporting polymorphism

Static Public Member Functions

static registry_tgetTypeRegistry ()
 returns a FamilyFactory with which you can look up classTypeID_t's to make new instances from serialized data

Static Public Attributes

static const char *const EventGeneratorNames [numEGIDs+1]
 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).
static const char *const EventTypeNames [numETIDs+1]
 holds string versions of EventTypeID_t
static const char *const EventTypeAbbr [numETIDs] = { "A", "S", "D" }
 holds abbreviated string versions of EventTypeID_t

Protected Member Functions

virtual void genName ()
 calls setName() with a string version of sourceID, decimal notation

Static Protected Member Functions

static unsigned int makeClassTypeID (const char *str)
 converts the first 4 characters of str to an unsigned int, should ensure consistent byte ordering across platforms

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
SaveFormat saveFormat
 controls the format used during the next call to saveBuffer() (packed binary or XML)
bool nameisgen
 tracks whether the current name (stim_id) was generated by genName() (true) or setName() (false)
EventGeneratorID_t genID
 generator ID, see EventGeneratorID_t
EventTypeID_t typeID
 type ID, see EventTypeID_t
size_t sourceID
 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
int hostID
unsigned int duration
 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

Static Protected Attributes

static const
EventBase::classTypeID_t 
autoRegisterEventBase = getTypeRegistry().registerType<EventBase>(makeClassTypeID("BASE"))
 causes class type id to automatically be regsitered with EventBase's FamilyFactory (getTypeRegistry())

LoadSave interface

Useful for serializing events to send between processes



enum  SaveFormat { BINARY, XML }
 

values to pass to setSaveFormat()

More...
virtual classTypeID_t getClassTypeID () const
 All subclasses should override this and return a unique ID for their class.
virtual unsigned int getBinSize () const
 should return the minimum size needed if using binary format (i.e. not XML)
virtual unsigned int loadBinaryBuffer (const char buf[], unsigned int len)
 load from binary format
virtual unsigned int saveBinaryBuffer (char buf[], unsigned int len) const
 save to binary format
virtual void loadXML (xmlNode *node)
 load from XML format
virtual void saveXML (xmlNode *node) const
 save to XML format
virtual unsigned int loadBuffer (const char buf[], unsigned int len, const char *filename=NULL)
 no longer need to override this -- will automatically call either loadXML() or loadBinaryBuffer() based on saveFormat
virtual unsigned int saveBuffer (char buf[], unsigned int len) const
 no longer need to override this -- will automatically call either saveXML() or saveBinaryBuffer() based on saveFormat
virtual unsigned int loadFile (const char *filename)
 automatically calls either XMLLoadSave::loadFile or LoadSave::loadFile based on saveFormat
virtual unsigned int saveFile (const char *filename) const
 automatically calls either XMLLoadSave::saveFile or LoadSave::saveFile based on saveFormat
virtual unsigned int loadFileStream (FILE *f, const char *filename=NULL)
 automatically calls either XMLLoadSave::loadFileStream or LoadSave::loadFileStream based on saveFormat
virtual unsigned int saveFileStream (FILE *f) const
 automatically calls either XMLLoadSave::loadFileStream or LoadSave::loadFileStream based on saveFormat
virtual void setSaveFormat (SaveFormat sf) const
 set saveFormat
virtual SaveFormat getSaveFormat () const
 return saveFormat

Methods



static bool isValidGeneratorID (unsigned int egid)
 gets the name of the event - useful for debugging output, see also getDescription()
virtual const std::string & getName () const
 gets the name of the event - useful for debugging output, see also getDescription()
virtual EventBasesetName (const std::string &n)
 sets name to a given string, prevents overwriting by generated names
virtual float getMagnitude () const
 gets "strength" of event - by default 1 for activate and status events, 0 for deactivate events
virtual EventBasesetMagnitude (float m)
 sets "strength" of event - you may want to override the default values (see getMagnitude())
virtual unsigned int getTimeStamp () const
 time event was created
virtual void setTimeStamp (unsigned int t)
 resets time event was created
virtual EventGeneratorID_t getGeneratorID () const
 gets the generator ID for this event
virtual EventBasesetGeneratorID (EventGeneratorID_t gid)
 sets the generator ID for this event
virtual size_t getSourceID () const
 gets the source ID for this event
virtual EventBasesetSourceID (size_t sid)
 sets the source ID for this event
virtual EventTypeID_t getTypeID () const
 gets the type ID
virtual EventBasesetTypeID (EventTypeID_t tid)
 sets the type ID
virtual int getHostID () const
 ID of the host that generated this event (-1U for localhost).
virtual EventBasesetHostID (int host)
 sets the ID of the host associated with this event
virtual unsigned int getDuration () const
 gets the time since the beginning of this sequence (the timestamp of the activate event)
virtual EventBasesetDuration (unsigned int d)
 sets 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
virtual std::string getDescription (bool showTypeSpecific=true, unsigned int verbosity=0) const
 generates a description of the event with variable verbosity
bool operator< (const EventBase &e) const
 gets the name of the event - useful for debugging output, see also getDescription()
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

Member Typedef Documentation

typedef unsigned int EventBase::classTypeID_t

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 Documentation

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)

Enumerator:
unknownEGID 

default EGID, used if you forget to set it, probably not a good idea to use this for anything except errors or testing quick hacks

aiEGID 

not being used, yet (might use this when AI makes decisions?)

audioEGID 

Sends an event when a sound starts/ends playback, status events as chained sounds end; SID is SoundManager::Play_ID; duration is playtime.

buttonEGID 

Sends activate event for button down, deactivate for button up. Status events only for when pressure sensitive buttons' reading changes. (on sensorEGID updates); SIDs are from ButtonOffset_t in the namespace of the target model (e.g. ERS210Info::ButtonOffset_t); duration is button down time.

cameraResolutionEGID 

Sends a status event whenever the camera's resolution changes, such as a different camera than predicted by RobotInfo is being used, or a camera is hotswapped. SID corresponds to the visOFbkEGID for that camera.

erouterEGID 

Sends activate event on first listener, deactivate on last listener, and status on other listener changes.; SID is the generator ID affected.

estopEGID 

Sends an event when the estop is turned on or off; SID is the MotionManager::MC_ID of the EmergencyStopMC; duration is length of estop activation.

grasperEGID 

Sends events when the Grasper processes a user request.

koduEGID 

Sends events when a kodu event occurs.

locomotionEGID 

Sends events regarding transportation in the world; you can/should assume these will all be LocomotionEvent classes; SID is MotionManager::MC_ID of posting MotionCommand; duration is the time since last velocity change of that MC. (You could generate these for things other than walking...).

lookoutEGID 

Sends an event when Lookout request is complete; SID is the id for lookout request.

mapbuilderEGID 

Sends a status event when map is completed.

micOSndEGID 

Sends a DataEvent<OSoundVectorData> for every audio buffer received from the system; SID and duration are always 0 (This is generated by the MainObj instantiation of MMCombo).

micRawEGID 

reserved for future use

micFFTEGID 

reserved for future use

micPitchEGID 

Sends a PitchEvent when a particular frequency is detected; SID is a pointer to the PitchDetector, magnitude is product of amplitude and confidence.

mocapEGID 

Sends a MoCapEvent for "motion capture" or GPS type updates from an external localization source. Used for position/orientation feedback from simulation as well.

motmanEGID 

Sends events when a MotionCommand is added or removed, SID is is the MotionManager::MC_ID, duration is always 0; individual MotionCommands may throw status events to signal intermediary status.

pilotEGID 

Sends events when position of agent is updated or pilot request is completed.

powerEGID 

Sends events for low power warnings, temperature, etc. see PowerSrcID::PowerSourceID_t.

remoteStateEGID 

Sent when remote state is updated.

runtimeEGID 

Sends an activate upon completion of startup, and a deactivate event upon shutdown; source ID undefined (currently 0).

sensorEGID 

Sends a status event when new sensor readings are available. see SensorSrcID::SensorSourceID_t.

servoEGID 

Sends notifications of servo errors; the source id is the Tekkotsu output offset.

stateMachineEGID 

Sends an event upon entering and leaving a StateNode; SID is pointer to the StateNode; duration is always 0; some state will throw a status event when they have completed their task and are now idling.

stateSignalEGID 

Sends a DataEvent that can be monitored by a SignalTrans for triggering a state transition.

stateTransitionEGID 

Sends an event each time a transition is triggered; SID is a pointer to the transition; type is activate at start of firing and deactivate when firing is complete; duration is always 0; activate guaranteed to occur immediately *before* the transition actually occurs.

textmsgEGID 

Sends status events when a text msg is received on console; generated by the Controller, SID is 0 if broadcast from ControllerGUI, 1 if "private" from BehaviorSwitchControl; duration is always 0 (see Controller for more information).

timerEGID 

Sends timer events; you set timers explicitly, you don't have to listen as well. (See EventRouter::addTimer()) There's no cross-talk, only the listener which requested the timer will receive it; SID is whatever you requested it to be; duration is the time (since boot, in ms) that the timer was supposed to go off; these are always status.

userEGID 

Reserved for user-generated events.

visInterleaveEGID 

Sends a FilterBankEvent when new interleaved images are available; SID is whatever value you gave during setup (typically in StartupBehavior_SetupVision.cc), duration is always 0.

visJPEGEGID 

Sends a FilterBankEvent when JPEG compressed images are available; SID is whatever value you gave during setup (typically in StartupBehavior_SetupVision.cc), duration is always 0.

visObjEGID 

Sends VisionObjectEvents for objects detected in camera images; SID is whatever value you gave during setup (typically in StartupBehavior_SetupVision.cc), duration is always 0.

visOFbkEGID 

Sends a DataEvent < OFbkImageVectorData > for every camera image received from the system; SID and duration are always 0 (This is generated by the MainObj instantiation of MMCombo).

visPNGEGID 

Sends a FilterBankEvent when PNG compressed images are available; SID is whatever value you gave during setup (typically in StartupBehavior_SetupVision.cc), duration is always 0.

visRawCameraEGID 

Sends a FilterBankEvent when new raw camera images are available; SID is whatever value you gave during setup (typically in StartupBehavior_SetupVision.cc), duration is always 0.

visRawDepthEGID 

Sends FilterBankEvent when new depth images are available.

visRegionEGID 

Sends a SegmentedColorFilterBankEvent when color regions are available; SID is whatever value you gave during setup (typically in StartupBehavior_SetupVision.cc), duration is always 0.

visRLEEGID 

Sends a SegmentedColorFilterBankEvent when RLE encoded color segmentated images are available; SID is whatever value you gave during setup (typically in StartupBehavior_SetupVision.cc), duration is always 0.

visSegmentEGID 

Sends a SegmentedColorFilterBankEvent when color segmentated images are available; SID is whatever value you gave during setup (typically in StartupBehavior_SetupVision.cc), duration is always 0.

wmVarEGID 

Sends an event when a watched memory is changed; source id is pointer to WMEntry.

worldModelEGID 

not being used, yet (for when objects are detected/lost?)

numEGIDs 

the number of generators available

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)

Enumerator:
activateETID 

Start of an event sequence, e.g. button down.

statusETID 

Indicates a value has changed, e.g. new sensor readings.

deactivateETID 

Last of a series of events, e.g. button up.

numETIDs 

the number of different event types

Definition at line 130 of file EventBase.h.

values to pass to setSaveFormat()

Enumerator:
BINARY 

saves will be in packed binary, loads will try binary first

XML 

saves will be in xml, loads will try xml first

Definition at line 279 of file EventBase.h.


Constructor & Destructor Documentation

EventBase::EventBase (  ) 

constructor

See also:
EventRouter::postEvent()

Definition at line 90 of file EventBase.cc.

Referenced by clone().

EventBase::EventBase ( EventGeneratorID_t  gid,
size_t  sid,
EventTypeID_t  tid,
unsigned int  dur = 0 
)

constructor

See also:
EventRouter::postEvent()

Definition at line 98 of file EventBase.cc.

EventBase::EventBase ( EventGeneratorID_t  gid,
size_t  sid,
EventTypeID_t  tid,
unsigned int  dur,
const std::string &  n 
)

constructor

See also:
EventRouter::postEvent()

Definition at line 108 of file EventBase.cc.

EventBase::EventBase ( EventGeneratorID_t  gid,
size_t  sid,
EventTypeID_t  tid,
unsigned int  dur,
const std::string &  n,
float  mag 
)

constructor

See also:
EventRouter::postEvent()

Definition at line 118 of file EventBase.cc.

virtual EventBase::~EventBase (  )  [virtual]

destructor

Definition at line 159 of file EventBase.h.


Member Function Documentation

virtual EventBase* EventBase::clone (  )  const [virtual]

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().

bool EventBase::equalOrLongerThan ( const EventBase eb  )  const

compares event duration and ensures same event generator, source, and type - useful for event masks

Definition at line 229 of file EventBase.h.

bool EventBase::equalOrShorterThan ( const EventBase eb  )  const

compares event duration and ensures same event generator, source, and type - useful for event masks

Definition at line 230 of file EventBase.h.

void EventBase::genName (  )  [protected, virtual]

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().

unsigned int EventBase::getBinSize (  )  const [virtual]

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.

virtual classTypeID_t EventBase::getClassTypeID (  )  const [virtual]

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.

std::string EventBase::getDescription ( bool  showTypeSpecific = true,
unsigned int  verbosity = 0 
) const [virtual]

generates a description of the event with variable verbosity

Parameters:
showTypeSpecific should be read by subclasses to add additional information
verbosity can be one of the following values:

  • 0 - Basic: event_name \t generator_id \t source_id \t type_id
  • 1 - Numerics: event_name \t generator_id \t source_id \t type_id
  • 2 - Timing: event_name \t generator_id \t source_id \t type_id \t duration \t timestamp
  • 3 and above - Full: event_name \t generator_id \t source_id \t type_id \t duration \t timestamp \t magnitude if showTypeSpecific, additional fields will be added after the common fields listed above.

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().

virtual unsigned int EventBase::getDuration (  )  const [virtual]

gets the time since the beginning of this sequence (the timestamp of the activate event)

See also:
duration

Definition at line 202 of file EventBase.h.

Referenced by EventRouter::addTimer(), getDescription(), and Controller::trapEvent().

virtual EventGeneratorID_t EventBase::getGeneratorID (  )  const [virtual]

gets the generator ID for this event

See also:
EventGeneratorID_t

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().

virtual int EventBase::getHostID (  )  const [virtual]

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().

virtual float EventBase::getMagnitude (  )  const [virtual]

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().

virtual SaveFormat EventBase::getSaveFormat (  )  const [virtual]

return saveFormat

Definition at line 284 of file EventBase.h.

EventBase::registry_t & EventBase::getTypeRegistry (  )  [static]

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().

virtual bool EventBase::isCustomName (  )  const [virtual]

returns true if not using the generated name

Definition at line 206 of file EventBase.h.

static bool EventBase::isValidGeneratorID ( unsigned int  egid  )  [static]

gets the name of the event - useful for debugging output, see also getDescription()

Definition at line 232 of file EventBase.h.

virtual unsigned int EventBase::loadBuffer ( const char  buf[],
unsigned int  len,
const char *  filename = NULL 
) [virtual]

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().

virtual unsigned int EventBase::loadFile ( const char *  filename  )  [virtual]

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.

virtual unsigned int EventBase::loadFileStream ( FILE *  f,
const char *  filename = NULL 
) [virtual]

automatically calls either XMLLoadSave::loadFileStream or LoadSave::loadFileStream based on saveFormat

Reimplemented from XMLLoadSave.

Definition at line 274 of file EventBase.h.

void EventBase::loadXML ( xmlNode node  )  [virtual]

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.

bool EventBase::longerThan ( const EventBase eb  )  const

compares event duration and ensures same event generator, source, and type - useful for event masks

Definition at line 227 of file EventBase.h.

static unsigned int EventBase::makeClassTypeID ( const char *  str  )  [static, protected]

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 >
EventBase::operator const T & (  )  const

Definition at line 172 of file EventBase.h.

bool EventBase::operator< ( const EventBase e  )  const

gets the name of the event - useful for debugging output, see also getDescription()

Definition at line 218 of file EventBase.h.

virtual bool EventBase::operator== ( const EventBase eb  )  const [virtual]

is true if the genID, typeID, and sourceID's all match

Definition at line 221 of file EventBase.h.

virtual const std::string& EventBase::resetName (  )  [virtual]

resets name to generated form, overwriting any previous name

Definition at line 205 of file EventBase.h.

bool EventBase::sameGenSource ( const EventBase eb  )  const

tests to see if events have the same generator and source IDs

Definition at line 225 of file EventBase.h.

Referenced by Controller::trapEvent().

virtual unsigned int EventBase::saveBuffer ( char  buf[],
unsigned int  len 
) const [virtual]

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.

virtual unsigned int EventBase::saveFile ( const char *  filename  )  const [virtual]

automatically calls either XMLLoadSave::saveFile or LoadSave::saveFile based on saveFormat

Reimplemented from XMLLoadSave.

Definition at line 271 of file EventBase.h.

virtual unsigned int EventBase::saveFileStream ( FILE *  f  )  const [virtual]

automatically calls either XMLLoadSave::loadFileStream or LoadSave::loadFileStream based on saveFormat

Reimplemented from XMLLoadSave.

Definition at line 276 of file EventBase.h.

void EventBase::saveXML ( xmlNode node  )  const [virtual]
virtual EventBase& EventBase::setDuration ( unsigned int  d  )  [virtual]

sets the time since the beginning of this sequence (the timestamp of the activate event)

See also:
duration

Definition at line 203 of file EventBase.h.

virtual EventBase& EventBase::setGeneratorID ( EventGeneratorID_t  gid  )  [virtual]

sets the generator ID for this event

See also:
EventGeneratorID_t

Definition at line 190 of file EventBase.h.

virtual EventBase& EventBase::setHostID ( int  host  )  [virtual]

sets the ID of the host associated with this event

Definition at line 200 of file EventBase.h.

virtual EventBase& EventBase::setMagnitude ( float  m  )  [virtual]

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().

EventBase & EventBase::setName ( const std::string &  n  )  [virtual]

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().

virtual void EventBase::setSaveFormat ( SaveFormat  sf  )  const [virtual]

set saveFormat

Definition at line 283 of file EventBase.h.

Referenced by EventTranslator::decodeEvent().

virtual EventBase& EventBase::setSourceID ( size_t  sid  )  [virtual]

sets the source ID for this event

See also:
sourceID

Definition at line 193 of file EventBase.h.

Referenced by CameraBehavior::doStart().

virtual void EventBase::setTimeStamp ( unsigned int  t  )  [virtual]

resets time event was created

Definition at line 187 of file EventBase.h.

virtual EventBase& EventBase::setTypeID ( EventTypeID_t  tid  )  [virtual]
bool EventBase::shorterThan ( const EventBase eb  )  const

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

const EventBase::classTypeID_t EventBase::autoRegisterEventBase = getTypeRegistry().registerType<EventBase>(makeClassTypeID("BASE")) [static, protected]

causes class type id to automatically be regsitered with EventBase's FamilyFactory (getTypeRegistry())

Definition at line 321 of file EventBase.h.

Referenced by getClassTypeID().

unsigned int EventBase::duration [protected]

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().

const char *const EventBase::EventGeneratorNames [static]

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().

const char *const EventBase::EventTypeAbbr = { "A", "S", "D" } [static]

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().

const char *const EventBase::EventTypeNames [static]
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().

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().

bool EventBase::nameisgen [protected]

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().

size_t EventBase::sourceID [protected]

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().

std::string EventBase::stim_id [protected]

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().

unsigned int EventBase::timestamp [protected]

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