Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
SensorObserverControl.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_SensorObserverControl_h_ 00003 #define INCLUDED_SensorObserverControl_h_ 00004 00005 #include "ControlBase.h" 00006 #include "Events/EventListener.h" 00007 #include "StringInputControl.h" 00008 #include "ToggleControl.h" 00009 #include <fstream> 00010 00011 //! allows logging of sensor information to the console or file 00012 class SensorObserverControl : public ControlBase, public EventListener { 00013 public: 00014 //!constructor 00015 SensorObserverControl(); 00016 00017 //!opens a custom (embedded) menu to toggle individual sensors 00018 virtual ControlBase* doSelect(); 00019 00020 virtual void refresh(); 00021 00022 //!sends all events received to stdout and/or logfile 00023 virtual void processEvent(const EventBase& event); 00024 00025 protected: 00026 //!checks to see if logfilePath differs from the StringInputControl's value and switches it if it is 00027 void checkLogFile(); 00028 00029 //!address of the logfile, if any (empty string is no logfile) 00030 std::string logfilePath; 00031 00032 //!if a filename is given, events are logged to here 00033 std::ofstream logfile; 00034 00035 ControlBase * helpCtl; //!< control containing help info 00036 ControlBase * sensorCtl; //!< control of sensor selectors 00037 ControlBase * buttonCtl; //!< control of buttons selectors 00038 ControlBase * outputCtl; //!< control of outputs selectors 00039 ControlBase * dutyCtl; //!< control of duty selectors 00040 ToggleControl * consoleCtl; //!< turn logging to the console on and off 00041 StringInputControl * fileCtl; //!< turn logging to a file on and off 00042 00043 unsigned int numListeners; //!< count of active console or file control so we know if we're actually logging 00044 00045 private: 00046 SensorObserverControl(const SensorObserverControl& ); //!< don't call 00047 SensorObserverControl& operator=(const SensorObserverControl& ); //!< don't call 00048 00049 }; 00050 00051 /*! @file 00052 * @brief Describes SensorObserverControl which allows logging of sensor information to the console or file 00053 * @author ejt (Creator) 00054 * 00055 * $Author: ejt $ 00056 * $Name: tekkotsu-2_2_2 $ 00057 * $Revision: 1.2 $ 00058 * $State: Exp $ 00059 * $Date: 2004/01/18 10:16:56 $ 00060 */ 00061 00062 #endif |
Tekkotsu v2.2.2 |
Generated Tue Jan 4 15:43:15 2005 by Doxygen 1.4.0 |