EventGeneratorBase Class Reference#include <EventGeneratorBase.h>
Inheritance diagram for EventGeneratorBase:
[legend]List of all members.
Detailed Description
A simple convenience class for event generators.
Note that you don't need to inherit from this class to be able to send events! Any code can send any event any time, just by calling one of the EventRouter::postEvent() functions.
Uses a BehaviorBase base class so that you can start and stop it.
Allows variable settings of the generator id and source id for outgoing events as well as automatic handling of listening/unlistening for a single optional event source. If you want something more fancy that that though, you'll have to override DoStart/DoStop yourself. (or extend/modify this class...)
Definition at line 21 of file EventGeneratorBase.h.
|
Upstream Settings |
These help select which events will be received from other generators
|
enum | specificity_t { GENERATOR,
SOURCE,
TYPE
} |
| lets you specify what level of filtering should be done More...
|
virtual specificity_t | getSpecificity () const |
| returns the current specificity level, to modify this, call the appropriate version of setAutoListen()
|
virtual void | setAutoListen (EventBase::EventGeneratorID_t gid) |
| turns on auto listening to make it easier to set up dependancies between vision filters
|
virtual void | setAutoListen (EventBase::EventGeneratorID_t gid, unsigned int sid) |
| turns on auto listening to make it easier to set up dependancies between vision filters
|
virtual void | setAutoListen (EventBase::EventGeneratorID_t gid, unsigned int sid, EventBase::EventTypeID_t tid) |
| turns on auto listening to make it easier to set up dependancies between vision filters
|
virtual void | unsetAutoListen () |
| turns off auto listening
|
virtual EventBase::EventGeneratorID_t | getListenGeneratorID () const |
| returns the generator ID that will be listened for (not the generator of the FilterBankEvent to be created - that depends on the subclass)
|
virtual unsigned int | getListenSourceID () const |
| returns the source ID that will be listened for (not the source of the FilterBankEvent to be created - that depends on the subclass)
|
virtual EventBase::EventTypeID_t | getListenTypeID () const |
| returns the type ID that will be listened for (not the type of the FilterBankEvent to be created - that depends on the subclass)
|
Public Member Functions |
virtual | ~EventGeneratorBase () |
| destructor - does nothing
|
virtual void | DoStart () |
| By default, merely adds to the reference counter (through AddReference()); Note you should still call this from your overriding methods.
|
virtual void | DoStop () |
| By default, subtracts from the reference counter (RemoveReference()), and thus may deletex if zero; Don't forget to still call this when you override this; Warning: call this at the end of your DoStop(), not beginning (it might delete this ).
|
virtual void | processEvent (const EventBase &event) |
| if autolistening, will receive EventRouter events concerning our own listeners
|
|
These concern the events which will be thrown to listeners
|
virtual EventBase::EventGeneratorID_t | getGeneratorID () const |
| return the generator ID that will be broadcast from
|
virtual void | setGeneratorID (EventBase::EventGeneratorID_t gid) |
| set the generator ID that will be broadcast from (typically it's a bad idea to call this...)
|
virtual unsigned int | getSourceID () const |
| return the source ID that will be broadcast on
|
virtual void | setSourceID (unsigned int sid) |
| set the source ID that will be broadcast on
|
virtual bool | hasListeners () const |
| return true if this generator has listeners
|
Protected Member Functions |
virtual void | addSrcListener () |
| subscribe this generator to its source
|
virtual void | removeSrcListener () |
| unsubscribe this generator from its source
|
|
| EventGeneratorBase (const std::string &classname, const std::string &instancename, EventBase::EventGeneratorID_t mgid, unsigned int msid) |
| EventGeneratorBase (const std::string &classname, const std::string &instancename, EventBase::EventGeneratorID_t mgid, unsigned int msid, EventBase::EventGeneratorID_t srcgid) |
| EventGeneratorBase (const std::string &classname, const std::string &instancename, EventBase::EventGeneratorID_t mgid, unsigned int msid, EventBase::EventGeneratorID_t srcgid, unsigned int srcsid) |
| EventGeneratorBase (const std::string &classname, const std::string &instancename, EventBase::EventGeneratorID_t mgid, unsigned int msid, EventBase::EventGeneratorID_t srcgid, unsigned int srcsid, EventBase::EventTypeID_t srctype) |
Protected Attributes |
EventBase::EventGeneratorID_t | myGenID |
| the generator ID to broadcast on
|
unsigned int | mySourceID |
| the source ID to broadcast on
|
bool | autoListen |
| if true, will automatically start listening for EventBase(genID,sourceID) events
|
bool | isListening |
| true if listening triggered by autoListen
|
EventBase::EventGeneratorID_t | srcGenID |
| the generator ID to listen for (typically the source that this filter works on)
|
unsigned int | srcSourceID |
| the source ID to listen for
|
EventBase::EventTypeID_t | srcTypeID |
| the type ID to listen for
|
specificity_t | specificity |
| the level of event specificity that is being listened for, so when autoListen is triggered, we can subscribe to the right level of event stream
|
Member Enumeration Documentation
|
lets you specify what level of filtering should be done
- Enumerator:
-
GENERATOR |
only the generator needs to match, select all sources and types |
SOURCE |
both generator and source need to match, select all types |
TYPE |
explicit event tuple; generator, source, and type must all match |
Definition at line 63 of file EventGeneratorBase.h. |
Constructor & Destructor Documentation
virtual EventGeneratorBase::~EventGeneratorBase |
( |
|
) |
[inline, virtual] |
|
EventGeneratorBase::EventGeneratorBase |
( |
const std::string & |
classname, |
|
|
const std::string & |
instancename, |
|
|
EventBase::EventGeneratorID_t |
mgid, |
|
|
unsigned int |
msid |
|
) |
[inline, protected] |
|
Member Function Documentation
void EventGeneratorBase::addSrcListener |
( |
|
) |
[protected, virtual] |
|
void EventGeneratorBase::DoStart |
( |
|
) |
[virtual] |
|
void EventGeneratorBase::DoStop |
( |
|
) |
[virtual] |
|
|
By default, subtracts from the reference counter (RemoveReference()), and thus may deletex if zero; Don't forget to still call this when you override this; Warning: call this at the end of your DoStop(), not beginning (it might delete this ).
Reimplemented from BehaviorBase.
Definition at line 17 of file EventGeneratorBase.cc. |
|
return the generator ID that will be broadcast from
Definition at line 45 of file EventGeneratorBase.h.
Referenced by DoStart(), hasListeners(), SegmentedColorGenerator::processEvent(), RLEGenerator::processEvent(), RegionGenerator::processEvent(), RawCameraGenerator::processEvent(), JPEGGenerator::processEvent(), InterleavedYUVGenerator::processEvent(), processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), and setAutoListen(). |
|
returns the generator ID that will be listened for (not the generator of the FilterBankEvent to be created - that depends on the subclass)
Definition at line 81 of file EventGeneratorBase.h.
Referenced by addSrcListener(), SegmentedColorGenerator::processEvent(), RLEGenerator::processEvent(), RegionGenerator::processEvent(), RawCameraGenerator::processEvent(), JPEGGenerator::processEvent(), InterleavedYUVGenerator::processEvent(), FilterBankGenerator::processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), BallDetectionGenerator::processEvent(), and removeSrcListener(). |
virtual unsigned int EventGeneratorBase::getListenSourceID |
( |
|
) |
const [inline, virtual] |
|
|
returns the source ID that will be listened for (not the source of the FilterBankEvent to be created - that depends on the subclass)
Definition at line 83 of file EventGeneratorBase.h.
Referenced by addSrcListener(), SegmentedColorGenerator::processEvent(), RLEGenerator::processEvent(), RegionGenerator::processEvent(), RawCameraGenerator::processEvent(), JPEGGenerator::processEvent(), InterleavedYUVGenerator::processEvent(), FilterBankGenerator::processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), BallDetectionGenerator::processEvent(), and removeSrcListener(). |
virtual unsigned int EventGeneratorBase::getSourceID |
( |
|
) |
const [inline, virtual] |
|
virtual specificity_t EventGeneratorBase::getSpecificity |
( |
|
) |
const [inline, virtual] |
|
bool EventGeneratorBase::hasListeners |
( |
|
) |
const [virtual] |
|
void EventGeneratorBase::processEvent |
( |
const EventBase & |
event |
) |
[virtual] |
|
|
if autolistening, will receive EventRouter events concerning our own listeners
This will automatically reduce overhead by eliminating chains of events thrown that don't have any end listeners. However, this might mean your subclass's processEvent will be receiving the events from erouterEGID, and will need to call EventGeneratorBase::processEvent() in order to allow them to be used
Reimplemented from BehaviorBase.
Reimplemented in BallDetectionGenerator, BufferedImageGenerator, CDTGenerator, FilterBankGenerator, InterleavedYUVGenerator, JPEGGenerator, RawCameraGenerator, RegionGenerator, RLEGenerator, and SegmentedColorGenerator.
Definition at line 24 of file EventGeneratorBase.cc.
Referenced by RawCameraGenerator::processEvent(), FilterBankGenerator::processEvent(), CDTGenerator::processEvent(), BufferedImageGenerator::processEvent(), and BallDetectionGenerator::processEvent(). |
void EventGeneratorBase::removeSrcListener |
( |
|
) |
[protected, virtual] |
|
|
turns on auto listening to make it easier to set up dependancies between vision filters
Definition at line 70 of file EventGeneratorBase.cc. |
|
turns on auto listening to make it easier to set up dependancies between vision filters
Definition at line 53 of file EventGeneratorBase.cc. |
|
turns on auto listening to make it easier to set up dependancies between vision filters
Definition at line 37 of file EventGeneratorBase.cc. |
|
set the generator ID that will be broadcast from (typically it's a bad idea to call this...)
Definition at line 47 of file EventGeneratorBase.h. |
virtual void EventGeneratorBase::setSourceID |
( |
unsigned int |
sid |
) |
[inline, virtual] |
|
void EventGeneratorBase::unsetAutoListen |
( |
|
) |
[virtual] |
|
Member Data Documentation
The documentation for this class was generated from the following files:
|