Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
CameraStreamBehavior.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_CameraStreamBehavior_h_ 00003 #define INCLUDED_CameraStreamBehavior_h_ 00004 00005 #include "Behaviors/BehaviorBase.h" 00006 00007 class Socket; 00008 00009 //! Base class for camera streaming communication classes, handles upstream communication 00010 /*! This class isn't meant to be run directly -- it just provides common functionality for its subclasses. */ 00011 class CameraStreamBehavior : public BehaviorBase { 00012 public: 00013 00014 virtual void processEvent(const EventBase& e); 00015 00016 static std::string getClassDescription() { return "Base class for camera streaming communication classes, handles upstream communication"; } 00017 virtual std::string getDescription() const { return getClassDescription(); } 00018 00019 int receiveData(char* data, unsigned int len); //!< called when new data is available (currently, only to toggle sensor sending) 00020 00021 void sendSensors(); //!< causes current sensor values to be sent through #curSocket (along with video data) 00022 00023 protected: 00024 //! constructor, protected because you're not intended to instantiate this directly 00025 /*! @param name the name of the instance and the class 00026 * @param s the subclass's socket, a reference is stored so CameraStreamBehavior will always have access to the current socket */ 00027 CameraStreamBehavior(const std::string& name, Socket*& s) 00028 : BehaviorBase(name), curSocket(s), sensorListeners(0), lastProcessedTime(0) 00029 {} 00030 //! constructor, protected because you're not intended to instantiate this directly 00031 /*! @param classname the name of the class type 00032 * @param name the name of the instance 00033 * @param s the subclass's socket, a reference is stored so CameraStreamBehavior will always have access to the current socket */ 00034 CameraStreamBehavior(const std::string& classname, const std::string& name, Socket*& s) 00035 : BehaviorBase(classname,name), curSocket(s), sensorListeners(0), lastProcessedTime(0) 00036 {} 00037 00038 //! the socket over which to send updates 00039 Socket*& curSocket; 00040 00041 //! number of times startSensors has been sent, minus number of times stopSensors has been sent 00042 unsigned int sensorListeners; 00043 00044 //! timestamp of last sensor update sent 00045 unsigned int lastProcessedTime; 00046 00047 private: 00048 // Providing declarations for these functions will avoid a compiler warning if 00049 // you have any class members which are pointers. However, as it is, an error 00050 // will result if you inadvertantly cause a call to either (which is probably 00051 // a good thing, unless you really intended to copy/assign a behavior, in 00052 // which case simply provide implementations for the functions) 00053 CameraStreamBehavior(const CameraStreamBehavior&); //!< don't call (copy constructor) 00054 CameraStreamBehavior& operator=(const CameraStreamBehavior&); //!< don't call (assignment operator) 00055 }; 00056 00057 /*! @file 00058 * @brief Defines CameraStreamBehavior, which is the base class for camera streaming communication classes, handles upstream communication 00059 * @author ejt (Creator) 00060 * 00061 * $Author: ejt $ 00062 * $Name: tekkotsu-4_0 $ 00063 * $Revision: 1.2 $ 00064 * $State: Exp $ 00065 * $Date: 2006/03/03 15:33:05 $ 00066 */ 00067 00068 #endif |
Tekkotsu v4.0 |
Generated Thu Nov 22 00:54:51 2007 by Doxygen 1.5.4 |