Changeset 20603

Show
Ignore:
Timestamp:
07/28/07 11:28:25 (1 year ago)
Author:
aronb
Message:

Change getInputTypeName() to be virtual. This fixes a problem with clustering where we have a InputPtr? to a device and call getInputTypeName() on it. Before this change it would always return "Input" since getInputTypeName() was not virtual. I don't like this change that much, but there is no way to do a virtual static. We could introduce another virtual method that just calls through to the static. But the only benifit would be to remove the temporary that we have to create for each base type in BaseTypeFactory? when registering the type. GADGET_REGISTER_BASE_TYPE_CREATOR

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/gadgeteer/gadget/Devices/Sim/SimInput.h

    r20322 r20603  
    9999   virtual bool config(jccl::ConfigElementPtr element); 
    100100 
    101    static std::string getInputTypeName() 
     101   virtual std::string getInputTypeName() 
    102102   { 
    103103       return std::string("SimInput"); 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Analog.h

    r20322 r20603  
    165165   const SampleBuffer_t::buffer_t& getAnalogDataBuffer(); 
    166166 
    167    static std::string getInputTypeName() 
     167   virtual std::string getInputTypeName() 
    168168   { 
    169169      return std::string("Analog"); 
  • juggler/trunk/modules/gadgeteer/gadget/Type/BaseTypeFactory.cpp

    r20601 r20603  
    5555 * Ex: GADGET_REGISTER_BASE_TYPE_CREATOR(ConnectionAck) 
    5656 */ 
    57 #define GADGET_REGISTER_BASE_TYPE_CREATOR(BaseType) \ 
    58 const bool reg_ctr_ ## BaseType = \ 
    59    gadget::BaseTypeFactory::instance()-> \ 
    60       registerCreator(BaseType::MixedPlaceholderType::getInputTypeName(), \ 
    61                       BaseType::MixedPlaceholderType::create); \ 
     57/*const bool reg_ctr_input_ ## BaseType = BaseType::MixedPlaceholderType::create()  \*/ 
     58#define GADGET_REGISTER_BASE_TYPE_CREATOR(BaseType)                             \ 
     59InputPtr input_ ## BaseType = BaseType::MixedPlaceholderType::create();         \ 
     60const bool reg_ctr_ ## BaseType =                                               \ 
     61   gadget::BaseTypeFactory::instance()->                                        \ 
     62      registerCreator(input_ ## BaseType->getInputTypeName(),                   \ 
     63                      BaseType::MixedPlaceholderType::create);                  \ 
    6264   boost::ignore_unused_variable_warning(reg_ctr_ ## BaseType); 
    6365 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Command.h

    r20322 r20603  
    140140   } 
    141141 
    142    static std::string getInputTypeName() 
     142   virtual std::string getInputTypeName() 
    143143   { 
    144144      return std::string("Command"); 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Digital.h

    r20322 r20603  
    151151   } 
    152152 
    153    static std::string getInputTypeName() 
     153   virtual std::string getInputTypeName() 
    154154   { 
    155155      return std::string("Digital"); 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Glove.h

    r20322 r20603  
    134134   //@} 
    135135 
    136    static std::string getInputTypeName() 
     136   virtual std::string getInputTypeName() 
    137137   { 
    138138      return std::string("Glove"); 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Input.h

    r20356 r20603  
    179179    * @see gadget::BaseTypeFactory 
    180180    */ 
    181    static std::string getInputTypeName() 
     181   virtual std::string getInputTypeName() 
    182182   { 
    183183      return std::string("Input"); 
  • juggler/trunk/modules/gadgeteer/gadget/Type/InputMixer.h

    r20322 r20603  
    161161   } 
    162162 
    163    static std::string getInputTypeName() 
     163   virtual std::string getInputTypeName() 
    164164   { 
    165165      return(ComposedParent::getInputTypeName() + NewParent::getInputTypeName());    //Input,Digital,Analog,Position, NEED THIS TOO 
  • juggler/trunk/modules/gadgeteer/gadget/Type/KeyboardMouse.h

    r20322 r20603  
    8080   virtual ~KeyboardMouse(); 
    8181 
    82    static std::string getInputTypeName() 
     82   virtual std::string getInputTypeName() 
    8383   { 
    8484      return "keyboard_mouse"; 
  • juggler/trunk/modules/gadgeteer/gadget/Type/Position.h

    r20322 r20603  
    148148   } 
    149149 
    150    static std::string getInputTypeName() 
     150   virtual std::string getInputTypeName() 
    151151   { 
    152152      return std::string("Position"); 
  • juggler/trunk/modules/gadgeteer/gadget/Type/String.h

    r20322 r20603  
    137137   } 
    138138 
    139    static std::string getInputTypeName() 
     139   virtual std::string getInputTypeName() 
    140140   { 
    141141      return std::string("String");