Changeset 20966
- Timestamp:
- 12/30/07 08:09:51 (10 months ago)
- Files:
-
- juggler/trunk/modules/gadgeteer/gadget/Type/AnalogProxy.cpp (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/AnalogProxy.h (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/CommandProxy.cpp (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/CommandProxy.h (modified) (3 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/DigitalProxy.cpp (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/DigitalProxy.h (modified) (3 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/GestureProxy.cpp (modified) (1 diff)
- juggler/trunk/modules/gadgeteer/gadget/Type/GestureProxy.h (modified) (3 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/GloveProxy.cpp (modified) (1 diff)
- juggler/trunk/modules/gadgeteer/gadget/Type/GloveProxy.h (modified) (4 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouseProxy.cpp (modified) (1 diff)
- juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouseProxy.h (modified) (3 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/PositionProxy.cpp (modified) (3 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/PositionProxy.h (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/Proxy.cpp (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/Proxy.h (modified) (3 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/StringProxy.cpp (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/StringProxy.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/trunk/modules/gadgeteer/gadget/Type/AnalogProxy.cpp
r20131 r20966 27 27 #include <gadget/gadgetConfig.h> 28 28 #include <jccl/Config/ConfigElement.h> 29 #include <gadget/Util/Debug.h>30 29 #include <gadget/Type/AnalogProxy.h> 30 31 31 32 32 namespace gadget 33 33 { 34 35 AnalogProxy::AnalogProxy(const std::string& deviceName, const int unitNum) 36 : TypedProxy<Analog>(deviceName) 37 , mUnitNum(unitNum) 38 , mData(-1.0f) 39 { 40 /* Do nothing. */ ; 41 } 42 34 43 AnalogProxyPtr AnalogProxy::create(const std::string& deviceName, 35 44 const int unitNum) … … 38 47 } 39 48 49 AnalogProxy::~AnalogProxy() 50 { 51 /* Do nothing. */ ; 52 } 53 54 void AnalogProxy::updateData() 55 { 56 if ( ! isStupefied() ) 57 { 58 // Make sure dependencies are updated. 59 getProxiedInputDevice()->updateDataIfNeeded(); 60 mData = mTypedDevice->getAnalogData(mUnitNum); 61 } 62 } 63 40 64 std::string AnalogProxy::getElementType() 41 65 { 42 66 return "analog_proxy"; 67 } 68 69 vpr::Interval AnalogProxy::getTimeStamp() const 70 { 71 return mData.getTime(); 43 72 } 44 73 juggler/trunk/modules/gadgeteer/gadget/Type/AnalogProxy.h
r20131 r20966 53 53 /** Constructor. */ 54 54 AnalogProxy(const std::string& deviceName = "UnknownAnalog", 55 const int unitNum = -1) 56 : TypedProxy<Analog>(deviceName) 57 , mUnitNum(unitNum) 58 , mData(-1.0f) 59 {;} 55 const int unitNum = -1); 60 56 61 57 public: … … 69 65 const int unitNum = -1); 70 66 71 virtual ~AnalogProxy() 72 {;} 67 virtual ~AnalogProxy(); 73 68 74 69 /** Updates the cached data copy from the device. */ 75 virtual void updateData() 76 { 77 if(!isStupefied()) 78 { 79 // Make sure dependencies are updated. 80 getProxiedInputDevice()->updateDataIfNeeded(); 81 mData = mTypedDevice->getAnalogData(mUnitNum); 82 } 83 } 70 virtual void updateData(); 84 71 85 72 /** Returns the time of last update. */ 86 virtual vpr::Interval getTimeStamp() const 87 { 88 return mData.getTime(); 89 } 73 virtual vpr::Interval getTimeStamp() const; 90 74 91 75 /** juggler/trunk/modules/gadgeteer/gadget/Type/CommandProxy.cpp
r20131 r20966 33 33 { 34 34 35 CommandProxy::CommandProxy(const std::string& deviceName, 36 const int unitNum) 37 : TypedProxy<Command>(deviceName) 38 , mUnitNum(unitNum) 39 , mData(0) 40 { 41 /* Do nothing. */ ; 42 } 43 35 44 CommandProxyPtr CommandProxy::create(const std::string& deviceName, 36 45 const int unitNum) 37 46 { 38 47 return CommandProxyPtr(new CommandProxy(deviceName, unitNum)); 48 } 49 50 CommandProxy::~CommandProxy() 51 { 52 /* Do nothing. */ ; 39 53 } 40 54 … … 74 88 } 75 89 90 vpr::Interval CommandProxy::getTimeStamp() const 91 { 92 return mData.getTime(); 93 } 94 76 95 } // End of gadget namespace juggler/trunk/modules/gadgeteer/gadget/Type/CommandProxy.h
r20132 r20966 51 51 { 52 52 protected: 53 CommandProxy(const std::string& deviceName = "UnknownCommand", 54 const int unitNum = -1); 55 56 public: 53 57 /** @name Construction/Destruction */ 54 58 //@{ 55 CommandProxy(const std::string& deviceName = "UnknownCommand",56 const int unitNum = -1)57 : TypedProxy<Command>(deviceName)58 , mUnitNum(unitNum)59 , mData(0)60 {;}61 62 public:63 59 /** 64 60 * Creates a CommandProxy instance and returns it wrapped in a … … 70 66 const int unitNum = -1); 71 67 72 virtual ~CommandProxy() 73 {;} 68 virtual ~CommandProxy(); 74 69 //@} 75 70 … … 77 72 78 73 /** Returns the time of the last update. */ 79 virtual vpr::Interval getTimeStamp() const 80 { 81 return mData.getTime(); 82 } 74 virtual vpr::Interval getTimeStamp() const; 83 75 84 76 /** juggler/trunk/modules/gadgeteer/gadget/Type/DigitalProxy.cpp
r20131 r20966 32 32 namespace gadget 33 33 { 34 35 DigitalProxy::DigitalProxy(const std::string& deviceName, const int unitNum) 36 : TypedProxy<Digital>(deviceName) 37 , mUnitNum(unitNum) 38 , mData(0) 39 { 40 /* Do nothing. */ ; 41 } 42 34 43 DigitalProxyPtr DigitalProxy::create(const std::string& deviceName, 35 44 const int unitNum) 36 45 { 37 46 return DigitalProxyPtr(new DigitalProxy(deviceName, unitNum)); 47 } 48 49 DigitalProxy::~DigitalProxy() 50 { 51 ; 38 52 } 39 53 … … 108 122 } 109 123 124 vpr::Interval DigitalProxy::getTimeStamp() const 125 { 126 return mData.getTime(); 127 } 128 110 129 } // End of gadget namespace juggler/trunk/modules/gadgeteer/gadget/Type/DigitalProxy.h
r20131 r20966 51 51 { 52 52 protected: 53 DigitalProxy(const std::string& deviceName = "UnknownDigital", 54 const int unitNum = -1); 55 56 public: 53 57 /** @name Construction/Destruction */ 54 58 //@{ 55 DigitalProxy(const std::string& deviceName = "UnknownDigital",56 const int unitNum = -1)57 : TypedProxy<Digital>(deviceName)58 , mUnitNum(unitNum)59 , mData(0)60 {;}61 62 public:63 59 /** 64 60 * Creates a DigitalProxy instance and returns it wrapped in a … … 70 66 const int unitNum = -1); 71 67 72 virtual ~DigitalProxy() 73 {;} 68 virtual ~DigitalProxy(); 74 69 //@} 75 70 … … 77 72 78 73 /** Returns the time of the last update. */ 79 virtual vpr::Interval getTimeStamp() const 80 { 81 return mData.getTime(); 82 } 74 virtual vpr::Interval getTimeStamp() const; 83 75 84 76 /** juggler/trunk/modules/gadgeteer/gadget/Type/GestureProxy.cpp
r20131 r20966 34 34 { 35 35 36 GestureProxy::GestureProxy(const std::string& deviceName) 37 : TypedProxy<Gesture>(deviceName) 38 { 39 /* Do nothing. */ ; 40 } 41 36 42 GestureProxyPtr GestureProxy::create(const std::string& deviceName) 37 43 { 38 44 return GestureProxyPtr(new GestureProxy(deviceName)); 45 } 46 47 GestureProxy::~GestureProxy() 48 { 49 /* Do nothing. */ ; 50 } 51 52 vpr::Interval GestureProxy::getTimeStamp() const 53 { 54 // XXX: Broken for now, this is a case similar to the KeyboardMouse type in 55 // that it does not point to one data element like digital, analog, 56 // and position. 57 return vpr::Interval(); 39 58 } 40 59 juggler/trunk/modules/gadgeteer/gadget/Type/GestureProxy.h
r20132 r20966 54 54 protected: 55 55 /** Constructs the proxy to point to the given gesture device. */ 56 GestureProxy(const std::string& deviceName = "UnknownGesture") 57 : TypedProxy<Gesture>(deviceName) 58 {;} 56 GestureProxy(const std::string& deviceName = "UnknownGesture"); 59 57 60 58 public: … … 67 65 static GestureProxyPtr create(const std::string& deviceName = "UnknownGesture"); 68 66 69 virtual ~GestureProxy() 70 {;} 67 virtual ~GestureProxy(); 71 68 72 69 /** … … 124 121 125 122 /** Returns time of last update. */ 126 vpr::Interval getTimeStamp() const 127 { 128 // XXX: Broken for now, this is a case similar to the KeyboardMouse type in that 129 // it does not point to one data element like digital, analog, and position. 130 return vpr::Interval(); 131 } 123 vpr::Interval getTimeStamp() const; 132 124 133 125 /** Returns a pointer to the device held by this proxy. */ juggler/trunk/modules/gadgeteer/gadget/Type/GloveProxy.cpp
r20131 r20966 34 34 { 35 35 36 GloveProxy::GloveProxy(const std::string& deviceName, const int unitNum) 37 : TypedProxy<Glove>(deviceName) 38 , mVisible(true) 39 , mUnitNum(unitNum) 40 { 41 /* Do nothing. */ ; 42 } 43 36 44 GloveProxyPtr GloveProxy::create(const std::string& deviceName, 37 45 const int unitNum) 38 46 { 39 47 return GloveProxyPtr(new GloveProxy(deviceName, unitNum)); 48 } 49 50 GloveProxy::~GloveProxy() 51 { 52 /* Do nothing. */ ; 53 } 54 55 vpr::Interval GloveProxy::getTimeStamp() const 56 { 57 // XXX: Broken for now, this is a case similar to the KeyboardMouse type in 58 // that it does not point to one data element like digital, analog, 59 // and position. 60 return vpr::Interval(); 40 61 } 41 62 juggler/trunk/modules/gadgeteer/gadget/Type/GloveProxy.h
r20131 r20966 56 56 */ 57 57 GloveProxy(const std::string& deviceName = "UnknownGlove", 58 const int unitNum = -1) 59 : TypedProxy<Glove>(deviceName) 60 , mUnitNum(unitNum) 61 { 62 mVisible = true; 63 } 58 const int unitNum = -1); 64 59 65 60 public: … … 73 68 const int unitNum = -1); 74 69 75 virtual ~GloveProxy() 76 {} 70 virtual ~GloveProxy(); 77 71 78 72 gmtl::Vec3f getTipVector(GloveData::GloveComponent component) … … 126 120 127 121 /** Returns time of last update. */ 128 vpr::Interval getTimeStamp() const 129 { 130 // XXX: Broken for now, this is a case similar to the KeyboardMouse type in that 131 // it does not point to one data element like digital, analog, and position. 132 return vpr::Interval(); 133 } 122 vpr::Interval getTimeStamp() const; 134 123 135 124 /** Returns a pointer to the device held by this proxy. */ … … 163 152 private: 164 153 /** Should we be drawn on the screen? */ 165 bool mVisible;154 bool mVisible; 166 155 167 156 /** The sub-unit number to use in the device. */ juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouseProxy.cpp
r20131 r20966 34 34 { 35 35 36 KeyboardMouseProxy::KeyboardMouseProxy() 37 { 38 /* Do nothing. */ ; 39 } 40 36 41 KeyboardMouseProxyPtr KeyboardMouseProxy::create() 37 42 { 38 43 return KeyboardMouseProxyPtr(new KeyboardMouseProxy()); 44 } 45 46 KeyboardMouseProxy::~KeyboardMouseProxy() 47 { 48 /* Do nothing. */ ; 49 } 50 51 vpr::Interval KeyboardMouseProxy::getTimeStamp() const 52 { 53 if ( isStupefied() || (NULL == mTypedDevice.get()) ) 54 { 55 return vpr::Interval(); 56 } 57 else 58 { 59 return mTypedDevice->getSyncTime(); 60 } 39 61 } 40 62 juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouseProxy.h
r20132 r20966 53 53 { 54 54 protected: 55 KeyboardMouseProxy() 56 {;} 55 KeyboardMouseProxy(); 57 56 58 57 public: … … 64 63 */ 65 64 static KeyboardMouseProxyPtr create(); 65 66 virtual ~KeyboardMouseProxy(); 66 67 67 68 /** … … 81 82 82 83 /** Returns the time of the last update. */ 83 virtual vpr::Interval getTimeStamp() const 84 { 85 if ( isStupefied() || (NULL == mTypedDevice.get()) ) 86 { 87 return vpr::Interval(); 88 } 89 else 90 { 91 return mTypedDevice->getSyncTime(); 92 } 93 } 84 virtual vpr::Interval getTimeStamp() const; 94 85 95 86 /** juggler/trunk/modules/gadgeteer/gadget/Type/PositionProxy.cpp
r20243 r20966 45 45 namespace gadget 46 46 { 47 48 PositionProxy::PositionProxy(const std::string& deviceName, const int unitNum) 49 : TypedProxy<Position>(deviceName) 50 , mUnitNum(unitNum) 51 { 52 /* Do nothing. */ ; 53 } 47 54 48 55 PositionProxyPtr PositionProxy::create(const std::string& deviceName, … … 172 179 } 173 180 174 175 181 void PositionProxy::updateData() 176 182 { … … 204 210 } 205 211 212 vpr::Interval PositionProxy::getTimeStamp() const 213 { 214 return mPositionData.getTime(); 215 } 216 206 217 } // End of gadget namespace juggler/trunk/modules/gadgeteer/gadget/Type/PositionProxy.h
r20243 r20966 67 67 protected: 68 68 PositionProxy(const std::string& deviceName = "UnknownPosition", 69 const int unitNum = -1) 70 : TypedProxy<Position>(deviceName) 71 , mUnitNum(unitNum) 72 {;} 69 const int unitNum = -1); 73 70 74 71 public: … … 91 88 92 89 /** Returns time of last update. */ 93 virtual vpr::Interval getTimeStamp() const 94 { 95 return mPositionData.getTime(); 96 } 90 virtual vpr::Interval getTimeStamp() const; 97 91 98 92 /** juggler/trunk/modules/gadgeteer/gadget/Type/Proxy.cpp
r19729 r20966 48 48 } 49 49 50 /**51 * Configures the proxy.52 * @post Proxy is configured (it is not registered yet though).53 * @return success.54 */55 50 bool Proxy::config(jccl::ConfigElementPtr element) 56 51 { … … 59 54 } 60 55 56 void Proxy::updateData() 57 { 58 /* Do nothing. */ ; 59 } 60 61 bool Proxy::isStupefied() const 62 { 63 return mStupefied; 64 } 65 61 66 } // end namespace juggler/trunk/modules/gadgeteer/gadget/Type/Proxy.h
r20138 r20966 48 48 class GADGET_CLASS_API Proxy 49 49 { 50 protected: 51 Proxy(); 52 50 53 public: 51 Proxy();52 53 54 virtual ~Proxy(); 54 55 55 56 /** 56 57 * Configures the proxy. 58 * 57 59 * @post Proxy is configured (it is not registered yet though). 58 * @return success. 60 * 61 * @return \c true is always returned. 59 62 */ 60 63 virtual bool config(jccl::ConfigElementPtr element); … … 66 69 virtual bool refresh() = 0; 67 70 68 virtual void updateData() 69 { 70 ; 71 } 71 virtual void updateData(); 72 72 73 73 /** … … 127 127 * @note Renamed from isStupified() in version 0.92.1. 128 128 */ 129 virtual bool isStupefied() const 130 { 131 return mStupefied; 132 } 129 virtual bool isStupefied() const; 133 130 134 131 /** juggler/trunk/modules/gadgeteer/gadget/Type/StringProxy.cpp
r20131 r20966 33 33 { 34 34 35 StringProxy::StringProxy(const std::string& deviceName, const int unitNum) 36 : TypedProxy<String>(deviceName) 37 , mUnitNum(unitNum) 38 , mData("") 39 { 40 /* Do nothing. */ ; 41 } 42 35 43 StringProxyPtr StringProxy::create(const std::string deviceName, 36 44 const int unitNum) 37 45 { 38 46 return StringProxyPtr(new StringProxy(deviceName, unitNum)); 47 } 48 49 StringProxy::~StringProxy() 50 { 51 /* Do nothing. */ ; 39 52 } 40 53 … … 77 90 } 78 91 92 vpr::Interval StringProxy::getTimeStamp() const 93 { 94 return mData.getTime(); 95 } 96 79 97 } // End of gadget namespace juggler/trunk/modules/gadgeteer/gadget/Type/StringProxy.h
r20131 r20966 61 61 { 62 62 protected: 63 StringProxy(const std::string& deviceName = "UnknownString", 64 const int unitNum = -1); 65 66 public: 63 67 /** @name Construction/Destruction */ 64 68 //@{ 65 StringProxy(const std::string& deviceName = "UnknownString",66 const int unitNum = -1)67 : TypedProxy<String>(deviceName)68 , mUnitNum(unitNum)69 , mData("")70 {;}71 72 public:73 69 /** 74 70 * Creates a StringProxy instance and returns it wrapped in a … … 80 76 const int unitNum = -1); 81 77 82 virtual ~StringProxy() 83 {;} 78 virtual ~StringProxy(); 84 79 //@} 85 80 … … 87 82 88 83 /** Returns the time of the last update. */ 89 virtual vpr::Interval getTimeStamp() const 90 { 91 return mData.getTime(); 92 } 84 virtual vpr::Interval getTimeStamp() const; 93 85 94 86 /**
