Changeset 20123

Show
Ignore:
Timestamp:
05/03/07 14:53:57 (2 years ago)
Author:
aronb
Message:

Hide device type constructors and add create methods.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/gadgeteer/gadget/Type/Analog.cpp

    r19729 r20123  
    4848{ 
    4949   /* Do nothing. */ ; 
     50} 
     51 
     52AnalogPtr Analog::create() 
     53{ 
     54   return AnalogPtr(new Analog()); 
    5055} 
    5156 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Analog.h

    r20055 r20123  
    3030#include <gadget/gadgetConfig.h> 
    3131#include <vector> 
     32#include <boost/noncopyable.hpp> 
    3233 
    3334#include <vpr/IO/SerializableObject.h> 
     
    5859 * @see Input, InputMixer 
    5960 */ 
    60 class GADGET_CLASS_API Analog : public vpr::SerializableObject 
     61class GADGET_CLASS_API Analog 
     62   : public vpr::SerializableObject 
     63   , boost::noncopyable 
    6164{ 
    6265public: 
    6366   typedef gadget::SampleBuffer<AnalogData> SampleBuffer_t; 
    6467 
    65 public: 
    66  
     68protected: 
    6769   /** 
    6870    * Constructor. 
     
    7173    */ 
    7274   Analog(); 
     75 
     76public: 
     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(); 
    7384 
    7485   virtual ~Analog(); 
     
    175186   void setMax(float mAx); 
    176187 
    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  
    184188private: 
    185189   float mMin, mMax; 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Command.cpp

    r19729 r20123  
    3434namespace gadget 
    3535{ 
     36 
     37Command::Command() 
     38{;} 
     39 
     40Command::~Command() 
     41{;} 
     42 
     43CommandPtr Command::create() 
     44{ 
     45   return CommandPtr(new Command()); 
     46} 
    3647 
    3748const CommandData Command::getCommandData(int devNum) 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Command.h

    r20055 r20123  
    2929 
    3030#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 
    3136#include <vpr/IO/SerializableObject.h> 
    3237#include <jccl/Config/ConfigElementPtr.h> 
     
    3641#include <gadget/Util/DeviceSerializationTokens.h> 
    3742 
    38 #include <boost/concept_check.hpp>   /* for ignore_unused_variable_warning */ 
    39 #include <vector> 
    4043 
    4144namespace gadget 
    4245{ 
    4346 
    44    const unsigned short MSG_DATA_COMMAND = 423; 
     47const unsigned short MSG_DATA_COMMAND = 423; 
    4548 
    46    typedef DigitalData CommandData; 
     49typedef DigitalData CommandData; 
    4750 
    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 */ 
     66class GADGET_CLASS_API Command 
     67   : public vpr::SerializableObject 
     68   , boost::noncopyable 
     69
     70public: 
     71   typedef gadget::SampleBuffer<CommandData> SampleBuffer_t; 
     72 
     73protected: 
     74   /* Constructor/Destructors */ 
     75   Command(); 
     76 
     77public: 
     78   /** 
     79    * Creates a Position instance and returns it wrapped in a 
     80    * PositionPtr object. 
    4981    * 
    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. 
    5696    * 
    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. 
    60108    * 
    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. 
    62113    */ 
    63    class GADGET_CLASS_API Command : public vpr::SerializableObject 
     114   void addCommandSample(const std::vector< CommandData >& digSample) 
    64115   { 
    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   } 
    67121 
    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   } 
    74133 
    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   } 
    79141 
    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   } 
    85146 
    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 issuing 
    92        *       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); 
    95156 
    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); 
    113166 
    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    }; 
     167private: 
     168   SampleBuffer_t mCommandSamples; /**< Command samples */ 
     169   CommandData    mDefaultValue;   /**< Default command value to return */ 
     170}; 
    171171 
    172172} // End of gadget namespace 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Digital.cpp

    r19729 r20123  
    3939namespace gadget 
    4040{ 
     41 
     42Digital::Digital() 
     43{;} 
     44 
     45Digital::~Digital() 
     46{;} 
     47 
     48DigitalPtr Digital::create() 
     49{ 
     50   return DigitalPtr(new Digital()); 
     51} 
    4152 
    4253const DigitalData Digital::getDigitalData(int devNum) 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Digital.h

    r20055 r20123  
    3232#include <vector> 
    3333#include <boost/concept_check.hpp>   /* for ignore_unused_variable_warning */ 
     34#include <boost/noncopyable.hpp> 
    3435 
    3536#include <vpr/IO/SerializableObject.h> 
     
    4243{ 
    4344 
    44    const unsigned short MSG_DATA_DIGITAL = 420; 
     45const unsigned short MSG_DATA_DIGITAL = 420; 
    4546 
    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 */ 
     61class GADGET_CLASS_API Digital 
     62   : public vpr::SerializableObject 
     63   , boost::noncopyable 
     64
     65public: 
     66   typedef gadget::SampleBuffer<DigitalData> SampleBuffer_t; 
     67 
     68public: 
     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 
     83protected: 
     84   /* Constructor/Destructors */ 
     85   Digital(); 
     86 
     87public: 
     88   /** 
     89    * Creates a Digital instance and returns it wrapped in a 
     90    * DigitalPtr object. 
    4791    * 
    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. 
    53106    * 
    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. 
    57109    * 
    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. 
    59112    */ 
    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) 
    61126   { 
    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   } 
    64132 
    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   } 
    79144 
    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   } 
    86156 
    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); 
    90166 
    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); 
    96176 
    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    }; 
     177private: 
     178   SampleBuffer_t    mDigitalSamples; /**< Digital samples */ 
     179   DigitalData       mDefaultValue;   /**< Default digital value to return */ 
     180}; 
    179181 
    180182} // End of gadget namespace 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Gesture.h

    r20055 r20123  
    3030 
    3131#include <gadget/gadgetConfig.h> 
     32#include <boost/noncopyable.hpp> 
    3233#include <boost/concept_check.hpp> 
    3334#include <jccl/Config/ConfigElementPtr.h> 
     
    5051 * 
    5152 */ 
    52 class Gesture 
     53class Gesture : boost::noncopyable 
    5354{ 
     55protected: 
     56   Gesture(); 
     57 
    5458public: 
    55    Gesture() 
    56    {} 
    57  
    5859   virtual ~Gesture() 
    5960   {;} 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Glove.cpp

    r19729 r20123  
    5454   mGlovePositions.resize(2); 
    5555} 
     56 
     57GlovePtr Glove::create() 
     58{ 
     59   return GlovePtr(new Glove()); 
     60} 
     61 
     62Glove::~Glove() 
     63{;} 
    5664 
    5765bool Glove::config(jccl::ConfigElementPtr e) 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Glove.h

    r20055 r20123  
    2929 
    3030#include <gadget/gadgetConfig.h> 
     31#include <boost/noncopyable.hpp> 
    3132#include <gadget/Type/GloveData.h> 
    3233#include <gadget/Type/DigitalData.h> /* For getGloveDataFromDigitalData */ 
     
    5051 * Gadgeteer will deal only with gloves using this interface. 
    5152 */ 
    52 class GADGET_CLASS_API Glove : public vpr::SerializableObject 
     53class GADGET_CLASS_API Glove 
     54   : public vpr::SerializableObject 
     55   , boost::noncopyable 
    5356{ 
    5457public: 
    5558   typedef gadget::SampleBuffer<GloveData> SampleBuffer_t; 
    5659 
    57 public
     60protected
    5861   Glove(); 
    5962 
    60    virtual ~Glove() 
    61    { 
    62       /* Do nothing. */ ; 
    63    } 
     63public: 
     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(); 
    6473 
    6574   virtual bool config(jccl::ConfigElementPtr element); 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Input.h

    r20055 r20123  
    3030#include <gadget/gadgetConfig.h> 
    3131#include <boost/concept_check.hpp> 
     32#include <boost/noncopyable.hpp> 
    3233#include <vpr/vpr.h> 
    3334 
     
    7071 *       it is being updated to the most recent copy. 
    7172 */ 
    72 class GADGET_CLASS_API Input : public vpr::SerializableObject 
     73class GADGET_CLASS_API Input 
     74   : public vpr::SerializableObject 
     75   , boost::noncopyable 
    7376{ 
    74 public
     77protected
    7578   /** Default Constructor. 
    7679    * 
     
    8184   Input(); 
    8285 
     86public: 
    8387#ifndef VPR_OS_Windows 
    8488   /** Input Destructor. 
     
    238242   bool           mActive;       /**< Is the driver active? */ 
    239243   bool           mNeedUpdate;   /**< @since 1.1.19 */ 
    240  
    241    Input(const Input& o) : vpr::SerializableObject(o) 
    242    {;} 
    243    void operator= (const Input&) {;} 
    244244}; 
    245245 
  • juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouse.cpp

    r19871 r20123  
    5555   mCurKeys[gadget::KEY_NONE] = 1; 
    5656} 
     57 
     58KeyboardMousePtr KeyboardMouse::create() 
     59{ 
     60   return KeyboardMousePtr(new KeyboardMouse()); 
     61} 
     62 
     63KeyboardMouse::~KeyboardMouse() 
     64{;} 
    5765 
    5866std::string KeyboardMouse::getInputTypeName() 
  • juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouse.h

    r20055 r20123  
    3030#include <gadget/gadgetConfig.h> 
    3131 
     32#include <boost/noncopyable.hpp> 
    3233#include <vpr/IO/SerializableObject.h> 
    3334#include <vpr/Sync/Mutex.h> 
     
    5859 * Juggler occur once per frame. 
    5960 */ 
    60 class GADGET_CLASS_API KeyboardMouse : public vpr::SerializableObject 
     61class GADGET_CLASS_API KeyboardMouse 
     62   : public vpr::SerializableObject 
     63   , boost::noncopyable 
    6164{ 
    6265public: 
    6366   typedef std::vector<gadget::EventPtr> EventQueue; 
    6467 
     68protected: 
    6569   KeyboardMouse(); 
    6670 
    67    virtual ~KeyboardMouse() 
    68    { 
    69       /* Do nothing. */ ; 
    70    } 
     71public: 
     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(); 
    7181 
    7282   virtual std::string getInputTypeName(); 
     
    156166 
    157167protected: 
    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  
    165168   /** 
    166169    * (0,*): Copy of keys for this frame that the user reads from between 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Position.cpp

    r19729 r20123  
    5454{;} 
    5555 
     56PositionPtr Position::create() 
     57{ 
     58   return PositionPtr(new Position()); 
     59} 
    5660 
    5761// Set up the transformation information 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Position.h

    r20055 r20123  
    3535 
    3636#include <gadget/gadgetConfig.h> 
     37 
    3738#include <typeinfo> 
    3839#include <vector> 
     40#include <boost/noncopyable.hpp> 
     41 
    3942#include <gadget/Type/Input.h> 
    4043#include <gadget/Type/PositionData.h> 
     
    6770 * @see Input, InputMixer 
    6871 */ 
    69 class GADGET_CLASS_API Position : public vpr::SerializableObject 
     72class GADGET_CLASS_API Position 
     73   : public vpr::SerializableObject 
     74   , boost::noncopyable 
    7075{ 
    7176public: 
    7277   typedef gadget::SampleBuffer<PositionData> SampleBuffer_t; 
    7378 
    74 public
     79protected
    7580   /** Constructor */ 
    7681   Position(); 
     82 
     83public: 
     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(); 
    7791 
    7892   /** Destructor */ 
     
    169183   PositionData      mDefaultValue;   /**< Default positional value to return */ 
    170184 
    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  
    175185private: 
    176186   std::vector<PositionFilter*>  mPositionFilters;    /**< The active filters that are to be used */ 
  • juggler/trunk/modules/gadgeteer/gadget/Type/String.cpp

    r19729 r20123  
    3434namespace gadget 
    3535{ 
     36 
     37String::String() : mDefaultValue("") 
     38{;} 
     39 
     40StringPtr String::create() 
     41{ 
     42   return StringPtr(new String()); 
     43} 
    3644 
    3745const StringData String::getStringData(int devNum) 
  • juggler/trunk/modules/gadgeteer/gadget/Type/String.h

    r20055 r20123  
    2929 
    3030#include <gadget/gadgetConfig.h> 
     31#include <boost/noncopyable.hpp> 
    3132#include <vpr/IO/SerializableObject.h> 
    3233#include <jccl/Config/ConfigElementPtr.h> 
     
    4243{ 
    4344 
    44    const unsigned short MSG_DATA_STRING = 430; 
     45const unsigned short MSG_DATA_STRING = 430; 
    4546 
    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 */ 
     69class GADGET_CLASS_API String 
     70   : public vpr::SerializableObject 
     71   , boost::noncopyable 
     72
     73public: 
     74   typedef gadget::SampleBuffer<StringData> SampleBuffer_t; 
     75 
     76public: 
     77   /* Constructor/Destructors */ 
     78   String(); 
     79 
     80   /** 
     81    * Creates a String instance and returns it wrapped in a 
     82    * StringPtr object. 
    4783    * 
    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. 
    5498    * 
    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. 
    58108    * 
    59     * @note This interface should be considered as being in an "alpha" s