Changeset 20123
- Timestamp:
- 05/03/07 14:53:57 (2 years ago)
- Files:
-
- juggler/trunk/modules/gadgeteer/gadget/Type/Analog.cpp (modified) (1 diff)
- juggler/trunk/modules/gadgeteer/gadget/Type/Analog.h (modified) (4 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/Command.cpp (modified) (1 diff)
- juggler/trunk/modules/gadgeteer/gadget/Type/Command.h (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/Digital.cpp (modified) (1 diff)
- juggler/trunk/modules/gadgeteer/gadget/Type/Digital.h (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/Gesture.h (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/Glove.cpp (modified) (1 diff)
- juggler/trunk/modules/gadgeteer/gadget/Type/Glove.h (modified) (2 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/Input.h (modified) (4 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouse.cpp (modified) (1 diff)
- juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouse.h (modified) (3 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/Position.cpp (modified) (1 diff)
- juggler/trunk/modules/gadgeteer/gadget/Type/Position.h (modified) (3 diffs)
- juggler/trunk/modules/gadgeteer/gadget/Type/String.cpp (modified) (1 diff)
- juggler/trunk/modules/gadgeteer/gadget/Type/String.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/trunk/modules/gadgeteer/gadget/Type/Analog.cpp
r19729 r20123 48 48 { 49 49 /* Do nothing. */ ; 50 } 51 52 AnalogPtr Analog::create() 53 { 54 return AnalogPtr(new Analog()); 50 55 } 51 56 juggler/trunk/modules/gadgeteer/gadget/Type/Analog.h
r20055 r20123 30 30 #include <gadget/gadgetConfig.h> 31 31 #include <vector> 32 #include <boost/noncopyable.hpp> 32 33 33 34 #include <vpr/IO/SerializableObject.h> … … 58 59 * @see Input, InputMixer 59 60 */ 60 class GADGET_CLASS_API Analog : public vpr::SerializableObject 61 class GADGET_CLASS_API Analog 62 : public vpr::SerializableObject 63 , boost::noncopyable 61 64 { 62 65 public: 63 66 typedef gadget::SampleBuffer<AnalogData> SampleBuffer_t; 64 67 65 public: 66 68 protected: 67 69 /** 68 70 * Constructor. … … 71 73 */ 72 74 Analog(); 75 76 public: 77 /** 78 * Creates a Analog instance and returns it wrapped in a 79 * AnalogPtr object. 80 * 81 * @since 1.3.7 82 */ 83 static AnalogPtr create(); 73 84 74 85 virtual ~Analog(); … … 175 186 void setMax(float mAx); 176 187 177 // gadget::SampleBuffer<T> is not copyable, so neither are we.178 Analog(const gadget::Analog& d)179 : vpr::SerializableObject(d)180 {;}181 182 void operator=(const gadget::Analog&) {;}183 184 188 private: 185 189 float mMin, mMax; juggler/trunk/modules/gadgeteer/gadget/Type/Command.cpp
r19729 r20123 34 34 namespace gadget 35 35 { 36 37 Command::Command() 38 {;} 39 40 Command::~Command() 41 {;} 42 43 CommandPtr Command::create() 44 { 45 return CommandPtr(new Command()); 46 } 36 47 37 48 const CommandData Command::getCommandData(int devNum) juggler/trunk/modules/gadgeteer/gadget/Type/Command.h
r20055 r20123 29 29 30 30 #include <gadget/gadgetConfig.h> 31 32 #include <boost/concept_check.hpp> /* for ignore_unused_variable_warning */ 33 #include <boost/noncopyable.hpp> 34 #include <vector> 35 31 36 #include <vpr/IO/SerializableObject.h> 32 37 #include <jccl/Config/ConfigElementPtr.h> … … 36 41 #include <gadget/Util/DeviceSerializationTokens.h> 37 42 38 #include <boost/concept_check.hpp> /* for ignore_unused_variable_warning */39 #include <vector>40 43 41 44 namespace gadget 42 45 { 43 46 44 const unsigned short MSG_DATA_COMMAND = 423;47 const unsigned short MSG_DATA_COMMAND = 423; 45 48 46 typedef DigitalData CommandData;49 typedef DigitalData CommandData; 47 50 48 /** \class Command Command.h gadget/Type/Command.h 51 /** \class Command Command.h gadget/Type/Command.h 52 * 53 * Command is the abstract base class for devices that translate spoken 54 * commends into integer-identified commands. Drivers for all such 55 * devices must derive from this class (through gadget::InputMixer). This 56 * is in addition to gadget::Input. gadget::Input provides pure virtual 57 * function constraints in the following functions: startSampling(), 58 * stopSampling(), sample(), and updateData(). 59 * 60 * gadget::Command adds the function getCommandData() for retreiving the 61 * received commands. This is similar to the additions made by 62 * gadget::Position and gadget::Analog. 63 * 64 * @see Input, InputMixer 65 */ 66 class GADGET_CLASS_API Command 67 : public vpr::SerializableObject 68 , boost::noncopyable 69 { 70 public: 71 typedef gadget::SampleBuffer<CommandData> SampleBuffer_t; 72 73 protected: 74 /* Constructor/Destructors */ 75 Command(); 76 77 public: 78 /** 79 * Creates a Position instance and returns it wrapped in a 80 * PositionPtr object. 49 81 * 50 * Command is the abstract base class for devices that translate spoken 51 * commends into integer-identified commands. Drivers for all such 52 * devices must derive from this class (through gadget::InputMixer). This 53 * is in addition to gadget::Input. gadget::Input provides pure virtual 54 * function constraints in the following functions: startSampling(), 55 * stopSampling(), sample(), and updateData(). 82 * @since 1.3.7 83 */ 84 static CommandPtr create(); 85 86 virtual ~Command(); 87 88 virtual bool config(jccl::ConfigElementPtr e) 89 { 90 boost::ignore_unused_variable_warning(e); 91 return true; 92 } 93 94 /** 95 * Gets the command data for the given devNum. 56 96 * 57 * gadget::Command adds the function getCommandData() for retreiving the 58 * received commands. This is similar to the additions made by 59 * gadget::Position and gadget::Analog. 97 * @return Command 0 or 1, if devNum makes sense. 98 * -1 is returned if function fails or if devNum is out of range. 99 * @note If devNum is out of range, function will fail, possibly issuing 100 * an error to a log or console - but will not ASSERT. 101 */ 102 const CommandData getCommandData(int devNum = 0); 103 104 /** 105 * Helper method to add a collection of command samples to the sample 106 * buffers. This MUST be called by all command devices to add new 107 * samples. 60 108 * 61 * @see Input, InputMixer 109 * @post The given command samples are added to the buffers. 110 * 111 * @param digSample A vector of CommandData objects that represent the 112 * newest samples taken. 62 113 */ 63 class GADGET_CLASS_API Command : public vpr::SerializableObject114 void addCommandSample(const std::vector< CommandData >& digSample) 64 115 { 65 public: 66 typedef gadget::SampleBuffer<CommandData> SampleBuffer_t; 116 // Locks and then swaps the indices. 117 mCommandSamples.lock(); 118 mCommandSamples.addSample(digSample); 119 mCommandSamples.unlock(); 120 } 67 121 68 public: 69 /* Constructor/Destructors */ 70 Command() 71 { 72 ; 73 } 122 /** 123 * Swaps the command data buffers. 124 * 125 * @post If the ready queue has values, then those values are copied from 126 * the ready queue to the stable queue. If not, then stable queue 127 * is not changed. 128 */ 129 void swapCommandBuffers() 130 { 131 mCommandSamples.swapBuffers(); 132 } 74 133 75 virtual ~Command() 76 { 77 ; 78 } 134 /** 135 * Returns the current stable sample buffers for this device. 136 */ 137 const SampleBuffer_t::buffer_t& getCommandDataBuffer() 138 { 139 return mCommandSamples.stableBuffer(); 140 } 79 141 80 virtual bool config(jccl::ConfigElementPtr e) 81 { 82 boost::ignore_unused_variable_warning(e); 83 return true; 84 } 142 virtual std::string getInputTypeName() 143 { 144 return std::string("Command"); 145 } 85 146 86 /**87 * Gets the command data for the given devNum.88 *89 * @return Command 0 or 1, if devNum makes sense.90 * -1 is returned if function fails or if devNum is out of range.91 * @note If devNum is out of range, function will fail, possibly issuing92 * an error to a log or console - but will not ASSERT.93 */94 const CommandData getCommandData(int devNum = 0);147 /** 148 * Serializes this object into the given object writer. 149 * 150 * @param writer The object writer to which this object will be 151 * serialized. 152 * 153 * @throw vpr::IOException is thrown if serialization fails. 154 */ 155 virtual void writeObject(vpr::ObjectWriter* writer); 95 156 96 /** 97 * Helper method to add a collection of command samples to the sample 98 * buffers. This MUST be called by all command devices to add new 99 * samples. 100 * 101 * @post The given command samples are added to the buffers. 102 * 103 * @param digSample A vector of CommandData objects that represent the 104 * newest samples taken. 105 */ 106 void addCommandSample(const std::vector< CommandData >& digSample) 107 { 108 // Locks and then swaps the indices. 109 mCommandSamples.lock(); 110 mCommandSamples.addSample(digSample); 111 mCommandSamples.unlock(); 112 } 157 /** 158 * De-serializes this object. 159 * 160 * @param reader The object reader from which this object will be 161 * de-serialized. 162 * 163 * @throw vpr::IOException is thrown if de-serialization fails. 164 */ 165 virtual void readObject(vpr::ObjectReader* reader); 113 166 114 /** 115 * Swaps the command data buffers. 116 * 117 * @post If the ready queue has values, then those values are copied from 118 * the ready queue to the stable queue. If not, then stable queue 119 * is not changed. 120 */ 121 void swapCommandBuffers() 122 { 123 mCommandSamples.swapBuffers(); 124 } 125 126 /** 127 * Returns the current stable sample buffers for this device. 128 */ 129 const SampleBuffer_t::buffer_t& getCommandDataBuffer() 130 { 131 return mCommandSamples.stableBuffer(); 132 } 133 134 virtual std::string getInputTypeName() 135 { 136 return std::string("Command"); 137 } 138 139 /** 140 * Serializes this object into the given object writer. 141 * 142 * @param writer The object writer to which this object will be 143 * serialized. 144 * 145 * @throw vpr::IOException is thrown if serialization fails. 146 */ 147 virtual void writeObject(vpr::ObjectWriter* writer); 148 149 /** 150 * De-serializes this object. 151 * 152 * @param reader The object reader from which this object will be 153 * de-serialized. 154 * 155 * @throw vpr::IOException is thrown if de-serialization fails. 156 */ 157 virtual void readObject(vpr::ObjectReader* reader); 158 159 protected: 160 // gadget::SampleBuffer<T> is not copyable, so neither are we. 161 Command(const gadget::Command&) 162 : vpr::SerializableObject() 163 {;} 164 165 void operator=(const gadget::Command&) {;} 166 167 private: 168 SampleBuffer_t mCommandSamples; /**< Command samples */ 169 CommandData mDefaultValue; /**< Default command value to return */ 170 }; 167 private: 168 SampleBuffer_t mCommandSamples; /**< Command samples */ 169 CommandData mDefaultValue; /**< Default command value to return */ 170 }; 171 171 172 172 } // End of gadget namespace juggler/trunk/modules/gadgeteer/gadget/Type/Digital.cpp
r19729 r20123 39 39 namespace gadget 40 40 { 41 42 Digital::Digital() 43 {;} 44 45 Digital::~Digital() 46 {;} 47 48 DigitalPtr Digital::create() 49 { 50 return DigitalPtr(new Digital()); 51 } 41 52 42 53 const DigitalData Digital::getDigitalData(int devNum) juggler/trunk/modules/gadgeteer/gadget/Type/Digital.h
r20055 r20123 32 32 #include <vector> 33 33 #include <boost/concept_check.hpp> /* for ignore_unused_variable_warning */ 34 #include <boost/noncopyable.hpp> 34 35 35 36 #include <vpr/IO/SerializableObject.h> … … 42 43 { 43 44 44 const unsigned short MSG_DATA_DIGITAL = 420;45 const unsigned short MSG_DATA_DIGITAL = 420; 45 46 46 /** \class Digital Digital.h gadget/Type/Digital.h 47 /** \class Digital Digital.h gadget/Type/Digital.h 48 * 49 * Digital is the abstract base class from which devices with digital data 50 * derive (through gadget::InputMixer). This is in addition to 51 * gadget::Input. gadget::Input provides pure virtual function constraints 52 * in the following functions: startSampling(), stopSampling(), sample(), 53 * and updateData(). 54 * 55 * gadget::Digital adds the function getDigitalData() for retreiving the 56 * received digital data. This is similar to the additions made by 57 * gadget::Position and gadget::Analog. 58 * 59 * @see Input, InputMixer 60 */ 61 class GADGET_CLASS_API Digital 62 : public vpr::SerializableObject 63 , boost::noncopyable 64 { 65 public: 66 typedef gadget::SampleBuffer<DigitalData> SampleBuffer_t; 67 68 public: 69 /** 70 * Enum for the state of the digital buttons. 71 * Used in DigitalProxy. 72 */ 73 enum State 74 { 75 OFF = 0, /**< Device is in the "off" state. */ 76 ON = 1, /**< Device is in the "on" state. */ 77 TOGGLE_ON = 2, /**< Device was in the "off" state and has changed to 78 "on" since the last frame. */ 79 TOGGLE_OFF = 3 /**< Device was in the "on" state and has changed to 80 "off" since the last frame. */ 81 }; 82 83 protected: 84 /* Constructor/Destructors */ 85 Digital(); 86 87 public: 88 /** 89 * Creates a Digital instance and returns it wrapped in a 90 * DigitalPtr object. 47 91 * 48 * Digital is the abstract base class from which devices with digital data 49 * derive (through gadget::InputMixer). This is in addition to 50 * gadget::Input. gadget::Input provides pure virtual function constraints 51 * in the following functions: startSampling(), stopSampling(), sample(), 52 * and updateData(). 92 * @since 1.3.7 93 */ 94 static DigitalPtr create(); 95 96 virtual ~Digital(); 97 98 virtual bool config(jccl::ConfigElementPtr e) 99 { 100 boost::ignore_unused_variable_warning(e); 101 return true; 102 } 103 104 /** 105 * Gets the digital data for the given devNum. 53 106 * 54 * gadget::Digital adds the function getDigitalData() for retreiving the 55 * received digital data. This is similar to the additions made by 56 * gadget::Position and gadget::Analog. 107 * @return Digital 0 or 1, if devNum makes sense. 108 * -1 is returned if function fails or if devNum is out of range. 57 109 * 58 * @see Input, InputMixer 110 * @note If devNum is out of range, function will fail, possibly issuing 111 * an error to a log or console - but will not ASSERT. 59 112 */ 60 class GADGET_CLASS_API Digital : public vpr::SerializableObject 113 const DigitalData getDigitalData(int devNum = 0); 114 115 /** 116 * Helper method to add a collection of digital samples to the sample 117 * buffers. This MUST be called by all digital devices to add new 118 * samples. 119 * 120 * @post The given digital samples are added to the buffers. 121 * 122 * @param digSample A vector of DigitalData objects that represent the 123 * newest samples taken. 124 */ 125 void addDigitalSample(const std::vector< DigitalData >& digSample) 61 126 { 62 public: 63 typedef gadget::SampleBuffer<DigitalData> SampleBuffer_t; 127 // Locks and then swaps the indices. 128 mDigitalSamples.lock(); 129 mDigitalSamples.addSample(digSample); 130 mDigitalSamples.unlock(); 131 } 64 132 65 public: 66 /** 67 * Enum for the state of the digital buttons. 68 * Used in DigitalProxy. 69 */ 70 enum State 71 { 72 OFF = 0, /**< Device is in the "off" state. */ 73 ON = 1, /**< Device is in the "on" state. */ 74 TOGGLE_ON = 2, /**< Device was in the "off" state and has changed to 75 "on" since the last frame. */ 76 TOGGLE_OFF = 3 /**< Device was in the "on" state and has changed to 77 "off" since the last frame. */ 78 }; 133 /** 134 * Swaps the digital data buffers. 135 * 136 * @post If the ready queue has values, then those values are copied from 137 * the ready queue to the stable queue. If not, then stable queue 138 * is not changed. 139 */ 140 void swapDigitalBuffers() 141 { 142 mDigitalSamples.swapBuffers(); 143 } 79 144 80 public: 81 /* Constructor/Destructors */ 82 Digital() 83 { 84 ; 85 } 145 /** 146 * Returns the current stable sample buffers for this device. 147 */ 148 const SampleBuffer_t::buffer_t& getDigitalDataBuffer() 149 { 150 return mDigitalSamples.stableBuffer(); 151 } 152 virtual std::string getInputTypeName() 153 { 154 return std::string("Digital"); 155 } 86 156 87 virtual ~Digital() 88 { 89 } 157 /** 158 * Serializes this object into the given object writer. 159 * 160 * @param writer The object writer to which this object will be 161 * serialized. 162 * 163 * @throw vpr::IOException is thrown if serialization fails. 164 */ 165 virtual void writeObject(vpr::ObjectWriter* writer); 90 166 91 virtual bool config(jccl::ConfigElementPtr e) 92 { 93 boost::ignore_unused_variable_warning(e); 94 return true; 95 } 167 /** 168 * De-serializes this object. 169 * 170 * @param reader The object reader from which this object will be 171 * de-serialized. 172 * 173 * @throw vpr::IOException is thrown if de-serialization fails. 174 */ 175 virtual void readObject(vpr::ObjectReader* reader); 96 176 97 /** 98 * Gets the digital data for the given devNum. 99 * 100 * @return Digital 0 or 1, if devNum makes sense. 101 * -1 is returned if function fails or if devNum is out of range. 102 * 103 * @note If devNum is out of range, function will fail, possibly issuing 104 * an error to a log or console - but will not ASSERT. 105 */ 106 const DigitalData getDigitalData(int devNum = 0); 107 108 /** 109 * Helper method to add a collection of digital samples to the sample 110 * buffers. This MUST be called by all digital devices to add new 111 * samples. 112 * 113 * @post The given digital samples are added to the buffers. 114 * 115 * @param digSample A vector of DigitalData objects that represent the 116 * newest samples taken. 117 */ 118 void addDigitalSample(const std::vector< DigitalData >& digSample) 119 { 120 // Locks and then swaps the indices. 121 mDigitalSamples.lock(); 122 mDigitalSamples.addSample(digSample); 123 mDigitalSamples.unlock(); 124 } 125 126 /** 127 * Swaps the digital data buffers. 128 * 129 * @post If the ready queue has values, then those values are copied from 130 * the ready queue to the stable queue. If not, then stable queue 131 * is not changed. 132 */ 133 void swapDigitalBuffers() 134 { 135 mDigitalSamples.swapBuffers(); 136 } 137 138 /** 139 * Returns the current stable sample buffers for this device. 140 */ 141 const SampleBuffer_t::buffer_t& getDigitalDataBuffer() 142 { 143 return mDigitalSamples.stableBuffer(); 144 } 145 virtual std::string getInputTypeName() 146 { 147 return std::string("Digital"); 148 } 149 150 /** 151 * Serializes this object into the given object writer. 152 * 153 * @param writer The object writer to which this object will be 154 * serialized. 155 * 156 * @throw vpr::IOException is thrown if serialization fails. 157 */ 158 virtual void writeObject(vpr::ObjectWriter* writer); 159 160 /** 161 * De-serializes this object. 162 * 163 * @param reader The object reader from which this object will be 164 * de-serialized. 165 * 166 * @throw vpr::IOException is thrown if de-serialization fails. 167 */ 168 virtual void readObject(vpr::ObjectReader* reader); 169 170 protected: 171 // gadget::SampleBuffer<T> is not copyable, so neither are we. 172 Digital(const gadget::Digital& d) : vpr::SerializableObject(d) {;} 173 void operator=(const gadget::Digital&) {;} 174 175 private: 176 SampleBuffer_t mDigitalSamples; /**< Digital samples */ 177 DigitalData mDefaultValue; /**< Default digital value to return */ 178 }; 177 private: 178 SampleBuffer_t mDigitalSamples; /**< Digital samples */ 179 DigitalData mDefaultValue; /**< Default digital value to return */ 180 }; 179 181 180 182 } // End of gadget namespace juggler/trunk/modules/gadgeteer/gadget/Type/Gesture.h
r20055 r20123 30 30 31 31 #include <gadget/gadgetConfig.h> 32 #include <boost/noncopyable.hpp> 32 33 #include <boost/concept_check.hpp> 33 34 #include <jccl/Config/ConfigElementPtr.h> … … 50 51 * 51 52 */ 52 class Gesture 53 class Gesture : boost::noncopyable 53 54 { 55 protected: 56 Gesture(); 57 54 58 public: 55 Gesture()56 {}57 58 59 virtual ~Gesture() 59 60 {;} juggler/trunk/modules/gadgeteer/gadget/Type/Glove.cpp
r19729 r20123 54 54 mGlovePositions.resize(2); 55 55 } 56 57 GlovePtr Glove::create() 58 { 59 return GlovePtr(new Glove()); 60 } 61 62 Glove::~Glove() 63 {;} 56 64 57 65 bool Glove::config(jccl::ConfigElementPtr e) juggler/trunk/modules/gadgeteer/gadget/Type/Glove.h
r20055 r20123 29 29 30 30 #include <gadget/gadgetConfig.h> 31 #include <boost/noncopyable.hpp> 31 32 #include <gadget/Type/GloveData.h> 32 33 #include <gadget/Type/DigitalData.h> /* For getGloveDataFromDigitalData */ … … 50 51 * Gadgeteer will deal only with gloves using this interface. 51 52 */ 52 class GADGET_CLASS_API Glove : public vpr::SerializableObject 53 class GADGET_CLASS_API Glove 54 : public vpr::SerializableObject 55 , boost::noncopyable 53 56 { 54 57 public: 55 58 typedef gadget::SampleBuffer<GloveData> SampleBuffer_t; 56 59 57 p ublic:60 protected: 58 61 Glove(); 59 62 60 virtual ~Glove() 61 { 62 /* Do nothing. */ ; 63 } 63 public: 64 /** 65 * Creates a Glove instance and returns it wrapped in a 66 * GlovePtr object. 67 * 68 * @since 1.3.7 69 */ 70 static GlovePtr create(); 71 72 virtual ~Glove(); 64 73 65 74 virtual bool config(jccl::ConfigElementPtr element); juggler/trunk/modules/gadgeteer/gadget/Type/Input.h
r20055 r20123 30 30 #include <gadget/gadgetConfig.h> 31 31 #include <boost/concept_check.hpp> 32 #include <boost/noncopyable.hpp> 32 33 #include <vpr/vpr.h> 33 34 … … 70 71 * it is being updated to the most recent copy. 71 72 */ 72 class GADGET_CLASS_API Input : public vpr::SerializableObject 73 class GADGET_CLASS_API Input 74 : public vpr::SerializableObject 75 , boost::noncopyable 73 76 { 74 p ublic:77 protected: 75 78 /** Default Constructor. 76 79 * … … 81 84 Input(); 82 85 86 public: 83 87 #ifndef VPR_OS_Windows 84 88 /** Input Destructor. … … 238 242 bool mActive; /**< Is the driver active? */ 239 243 bool mNeedUpdate; /**< @since 1.1.19 */ 240 241 Input(const Input& o) : vpr::SerializableObject(o)242 {;}243 void operator= (const Input&) {;}244 244 }; 245 245 juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouse.cpp
r19871 r20123 55 55 mCurKeys[gadget::KEY_NONE] = 1; 56 56 } 57 58 KeyboardMousePtr KeyboardMouse::create() 59 { 60 return KeyboardMousePtr(new KeyboardMouse()); 61 } 62 63 KeyboardMouse::~KeyboardMouse() 64 {;} 57 65 58 66 std::string KeyboardMouse::getInputTypeName() juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouse.h
r20055 r20123 30 30 #include <gadget/gadgetConfig.h> 31 31 32 #include <boost/noncopyable.hpp> 32 33 #include <vpr/IO/SerializableObject.h> 33 34 #include <vpr/Sync/Mutex.h> … … 58 59 * Juggler occur once per frame. 59 60 */ 60 class GADGET_CLASS_API KeyboardMouse : public vpr::SerializableObject 61 class GADGET_CLASS_API KeyboardMouse 62 : public vpr::SerializableObject 63 , boost::noncopyable 61 64 { 62 65 public: 63 66 typedef std::vector<gadget::EventPtr> EventQueue; 64 67 68 protected: 65 69 KeyboardMouse(); 66 70 67 virtual ~KeyboardMouse() 68 { 69 /* Do nothing. */ ; 70 } 71 public: 72 /** 73 * Creates a Position instance and returns it wrapped in a 74 * PositionPtr object. 75 * 76 * @since 1.3.7 77 */ 78 static KeyboardMousePtr create(); 79 80 virtual ~KeyboardMouse(); 71 81 72 82 virtual std::string getInputTypeName(); … … 156 166 157 167 protected: 158 // vpr::Mutex is not copyable, so neither are we.159 KeyboardMouse(const KeyboardMouse& w)160 : vpr::SerializableObject(w)161 {;}162 163 void operator=(const KeyboardMouse&) {;}164 165 168 /** 166 169 * (0,*): Copy of keys for this frame that the user reads from between juggler/trunk/modules/gadgeteer/gadget/Type/Position.cpp
r19729 r20123 54 54 {;} 55 55 56 PositionPtr Position::create() 57 { 58 return PositionPtr(new Position()); 59 } 56 60 57 61 // Set up the transformation information juggler/trunk/modules/gadgeteer/gadget/Type/Position.h
r20055 r20123 35 35 36 36 #include <gadget/gadgetConfig.h> 37 37 38 #include <typeinfo> 38 39 #include <vector> 40 #include <boost/noncopyable.hpp> 41 39 42 #include <gadget/Type/Input.h> 40 43 #include <gadget/Type/PositionData.h> … … 67 70 * @see Input, InputMixer 68 71 */ 69 class GADGET_CLASS_API Position : public vpr::SerializableObject 72 class GADGET_CLASS_API Position 73 : public vpr::SerializableObject 74 , boost::noncopyable 70 75 { 71 76 public: 72 77 typedef gadget::SampleBuffer<PositionData> SampleBuffer_t; 73 78 74 p ublic:79 protected: 75 80 /** Constructor */ 76 81 Position(); 82 83 public: 84 /** 85 * Creates a Position instance and returns it wrapped in a 86 * PositionPtr object. 87 * 88 * @since 1.3.7 89 */ 90 static PositionPtr create(); 77 91 78 92 /** Destructor */ … … 169 183 PositionData mDefaultValue; /**< Default positional value to return */ 170 184 171 // gadget::SampleBuffer<T> is not copyable, so neither are we.172 Position(const gadget::Position& p) : vpr::SerializableObject(p) {;}173 void operator=(const gadget::Position&) {;}174 175 185 private: 176 186 std::vector<PositionFilter*> mPositionFilters; /**< The active filters that are to be used */ juggler/trunk/modules/gadgeteer/gadget/Type/String.cpp
r19729 r20123 34 34 namespace gadget 35 35 { 36 37 String::String() : mDefaultValue("") 38 {;} 39 40 StringPtr String::create() 41 { 42 return StringPtr(new String()); 43 } 36 44 37 45 const StringData String::getStringData(int devNum) juggler/trunk/modules/gadgeteer/gadget/Type/String.h
r20055 r20123 29 29 30 30 #include <gadget/gadgetConfig.h> 31 #include <boost/noncopyable.hpp> 31 32 #include <vpr/IO/SerializableObject.h> 32 33 #include <jccl/Config/ConfigElementPtr.h> … … 42 43 { 43 44 44 const unsigned short MSG_DATA_STRING = 430;45 const unsigned short MSG_DATA_STRING = 430; 45 46 46 /** \class String String.h gadget/Type/String.h 47 /** \class String String.h gadget/Type/String.h 48 * 49 * gadget::String is the abstract base class for devices that return 50 * spoken commends. Drivers for all such devices must derive from this 51 * class (through gadget::InputMixer). This is in addition to 52 * gadget::Input. gadget::Input provides pure virtual function constraints 53 * in the following functions: startSampling(), stopSampling(), sample(), 54 * and updateData(). 55 * 56 * gadget::String adds the function getStringData() for retreiving the 57 * received commands. This is similar to the additions made 58 * by gadget::Position and gadget::Analog. 59 * 60 * @note This interface should be considered as being in an "alpha" state. 61 * String-oriented device types are very new to Gadgeteer, and they 62 * have not have the same amount of time to mature as the other 63 * device types (which have been around since VR Juggler 1.0). This 64 * interface may change in a future release of Gadgeteer (such as 65 * Version 1.2). 66 * 67 * @see Input, InputMixer 68 */ 69 class GADGET_CLASS_API String 70 : public vpr::SerializableObject 71 , boost::noncopyable 72 { 73 public: 74 typedef gadget::SampleBuffer<StringData> SampleBuffer_t; 75 76 public: 77 /* Constructor/Destructors */ 78 String(); 79 80 /** 81 * Creates a String instance and returns it wrapped in a 82 * StringPtr object. 47 83 * 48 * gadget::String is the abstract base class for devices that return 49 * spoken commends. Drivers for all such devices must derive from this 50 * class (through gadget::InputMixer). This is in addition to 51 * gadget::Input. gadget::Input provides pure virtual function constraints 52 * in the following functions: startSampling(), stopSampling(), sample(), 53 * and updateData(). 84 * @since 1.3.7 85 */ 86 static StringPtr create(); 87 88 virtual ~String(); 89 90 virtual bool config(jccl::ConfigElementPtr e) 91 { 92 boost::ignore_unused_variable_warning(e); 93 return true; 94 } 95 96 /** 97 * Gets the string data for the given devNum. 54 98 * 55 * gadget::String adds the function getStringData() for retreiving the 56 * received commands. This is similar to the additions made 57 * by gadget::Position and gadget::Analog. 99 * @note If devNum is out of range, function will fail, possibly issuing 100 * an error to a log or console - but will not ASSERT. 101 */ 102 const StringData getStringData(int devNum = 0); 103 104 /** 105 * Helper method to add a collection of string samples to the sample 106 * buffers. This MUST be called by all string devices to add new 107 * samples. 58 108 * 59 * @note This interface should be considered as being in an "alpha" s
