Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
BehaviorSwitchActivatorControl.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_BehaviorSwitchActivatorControl_h 00003 #define INCLUDED_BehaviorSwitchActivatorControl_h 00004 00005 #include "ControlBase.h" 00006 #include "BehaviorSwitchControl.h" 00007 00008 //! Upon activation, will tell the specified BehaviorSwitchControl to start or stop the behavior 00009 class BehaviorSwitchActivatorControl : public ControlBase { 00010 public: 00011 //! lets you tell it what action to perform 00012 enum Mode_t { 00013 start, //!< Passed to constructor, indicates this control should start the behavior when activated 00014 stop, //!< Passed to constructor, indicates this control should stop the behavior when activated 00015 toggle //!< Passed to constructor, indicates this control should toggle the behavior when activated 00016 }; 00017 00018 //!constructor 00019 BehaviorSwitchActivatorControl(const std::string& n, BehaviorSwitchControlBase* bscb, Mode_t m=toggle) : ControlBase(n), behswitch(bscb), mode(m) {} 00020 00021 //!destructor 00022 virtual ~BehaviorSwitchActivatorControl() {} 00023 00024 //! performs the action denoted by #mode 00025 virtual ControlBase * activate(MotionManager::MC_ID disp_id, Socket *) { 00026 switch(mode) { 00027 case start: 00028 behswitch->start(); 00029 break; 00030 case stop: 00031 behswitch->stop(); 00032 break; 00033 case toggle: 00034 behswitch->toggle(); 00035 break; 00036 } 00037 if(disp_id!=MotionManager::invalid_MC_ID) { 00038 MMAccessor<LedMC> display(disp_id); 00039 display.mc()->flash(FaceLEDMask,100); 00040 } 00041 return NULL; 00042 } 00043 00044 virtual std::string getName() const { return behswitch->getName(); } 00045 virtual std::string getDescription() const { return behswitch->getDescription(); } 00046 00047 protected: 00048 BehaviorSwitchControlBase* behswitch; //!< The behavior switch to activate/deactivate 00049 Mode_t mode; //!< the mode this control is in 00050 00051 private: 00052 BehaviorSwitchActivatorControl(const BehaviorSwitchActivatorControl&); //!< don't copy this class 00053 BehaviorSwitchActivatorControl operator=(const BehaviorSwitchActivatorControl&); //!< don't assign this class 00054 }; 00055 00056 /*! @file 00057 * @brief Defines BehaviorSwitchActivatorControl, which will tell the specified BehaviorSwitchControl to start or stop the behavior 00058 * @author ejt (Creator) 00059 * 00060 * $Author: ejt $ 00061 * $Name: tekkotsu-4_0 $ 00062 * $Revision: 1.4 $ 00063 * $State: Exp $ 00064 * $Date: 2006/09/16 06:28:06 $ 00065 */ 00066 00067 #endif |
Tekkotsu v4.0 |
Generated Thu Nov 22 00:54:51 2007 by Doxygen 1.5.4 |