Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

VisualTargetCloseTrans.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_VisualTargetCloseTrans_h_
00003 #define INCLUDED_VisualTargetCloseTrans_h_
00004 
00005 #include "Events/EventRouter.h"
00006 #include "Events/VisionEvent.h"
00007 #include "Shared/debuget.h"
00008 
00009 //! causes a transition when a visual object is "close"
00010 class VisualTargetCloseTrans : public Transition, public EventListener {
00011 public:
00012   //!constructor
00013   explicit VisualTargetCloseTrans(StateNode* source, StateNode* destination, VisionEventNS::VisionSourceID_t source_id) : Transition(source,destination), EventListener(), sid(source_id) {}
00014 
00015   //!starts listening for the object specified by the source id in the constructor
00016   virtual void enable() { erouter->addListener(this,EventBase::visionEGID,sid); }
00017 
00018   //!called by StateNode when it becomes inactive - undo whatever you did in Enable()
00019   virtual void disable() { erouter->forgetListener(this); }
00020 
00021   //!if the object is "close", calls activate()
00022   virtual void processEvent(const EventBase& e) {
00023     const VisionEvent* ve=dynamic_cast<const VisionEvent*>(&e);
00024     ASSERTRET(ve!=NULL,"Casting error");
00025     //!@todo need to activate if it's "close"
00026   }
00027 protected:
00028   //!Source ID of object to track
00029   VisionEventNS::VisionSourceID_t sid;
00030 };
00031 
00032 /*! @file
00033  * @brief Defines VisualTargetCloseTrans, which causes a transition when a visual object is "close"
00034  * @author ejt (Creator)
00035  *
00036  * $Author: ejt $
00037  * $Name: tekkotsu-1_4_1 $
00038  * $Revision: 1.1 $
00039  * $State: Exp $
00040  * $Date: 2003/03/01 20:53:32 $
00041  */
00042 
00043 #endif

Tekkotsu v1.4
Generated Sat Jul 19 00:06:32 2003 by Doxygen 1.3.2