]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/hub.h
Use hashes to make button/axis indices in Hub predictable
[libs/gui.git] / source / input / hub.h
index 8ec2fad7fcb3dd60af82a5f6dbab52c28a7571c3..8d41bcee41393bc0314825db0c44b1fc2b65fc61 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef MSP_INPUT_INPUTHUB_H_
 #define MSP_INPUT_INPUTHUB_H_
 
+#include <map>
 #include "device.h"
 
 namespace Msp {
@@ -13,14 +14,13 @@ aggregate of them.  Button and axis numbers are mapped to unique values.
 class Hub: public Device
 {
 protected:
-       std::vector<Device *> devices;
+       std::map<unsigned, Device *> devices;
 
 public:
        Hub();
 
-       /** Attaches an input device to the hub.  Returns the index of the device
-       within the hub. */
-       unsigned attach(Device &dev);
+       /// Attaches an input device to the hub.
+       void attach(Device &dev);
 
        virtual std::string get_button_name(unsigned) const;
        virtual std::string get_axis_name(unsigned) const;