diff options
Diffstat (limited to 'src/common/input.h')
| -rw-r--r-- | src/common/input.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/common/input.h b/src/common/input.h index 4030ad2e5..449e0193f 100644 --- a/src/common/input.h +++ b/src/common/input.h | |||
| @@ -383,6 +383,16 @@ void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDevic | |||
| 383 | } | 383 | } |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | inline void RegisterInputFactory(const std::string& name, | ||
| 387 | std::shared_ptr<Factory<InputDevice>> factory) { | ||
| 388 | RegisterFactory<InputDevice>(name, std::move(factory)); | ||
| 389 | } | ||
| 390 | |||
| 391 | inline void RegisterOutputFactory(const std::string& name, | ||
| 392 | std::shared_ptr<Factory<OutputDevice>> factory) { | ||
| 393 | RegisterFactory<OutputDevice>(name, std::move(factory)); | ||
| 394 | } | ||
| 395 | |||
| 386 | /** | 396 | /** |
| 387 | * Unregisters an input device factory. | 397 | * Unregisters an input device factory. |
| 388 | * @tparam InputDeviceType the type of input devices the factory can create | 398 | * @tparam InputDeviceType the type of input devices the factory can create |
| @@ -395,6 +405,14 @@ void UnregisterFactory(const std::string& name) { | |||
| 395 | } | 405 | } |
| 396 | } | 406 | } |
| 397 | 407 | ||
| 408 | inline void UnregisterInputFactory(const std::string& name) { | ||
| 409 | UnregisterFactory<InputDevice>(name); | ||
| 410 | } | ||
| 411 | |||
| 412 | inline void UnregisterOutputFactory(const std::string& name) { | ||
| 413 | UnregisterFactory<OutputDevice>(name); | ||
| 414 | } | ||
| 415 | |||
| 398 | /** | 416 | /** |
| 399 | * Create an input device from given paramters. | 417 | * Create an input device from given paramters. |
| 400 | * @tparam InputDeviceType the type of input devices to create | 418 | * @tparam InputDeviceType the type of input devices to create |
| @@ -416,6 +434,14 @@ std::unique_ptr<InputDeviceType> CreateDeviceFromString(const std::string& param | |||
| 416 | return pair->second->Create(package); | 434 | return pair->second->Create(package); |
| 417 | } | 435 | } |
| 418 | 436 | ||
| 437 | inline std::unique_ptr<InputDevice> CreateInputDeviceFromString(const std::string& params) { | ||
| 438 | return CreateDeviceFromString<InputDevice>(params); | ||
| 439 | } | ||
| 440 | |||
| 441 | inline std::unique_ptr<OutputDevice> CreateOutputDeviceFromString(const std::string& params) { | ||
| 442 | return CreateDeviceFromString<OutputDevice>(params); | ||
| 443 | } | ||
| 444 | |||
| 419 | /** | 445 | /** |
| 420 | * Create an input device from given parameters. | 446 | * Create an input device from given parameters. |
| 421 | * @tparam InputDeviceType the type of input devices to create | 447 | * @tparam InputDeviceType the type of input devices to create |
| @@ -435,4 +461,12 @@ std::unique_ptr<InputDeviceType> CreateDevice(const ParamPackage& package) { | |||
| 435 | return pair->second->Create(package); | 461 | return pair->second->Create(package); |
| 436 | } | 462 | } |
| 437 | 463 | ||
| 464 | inline std::unique_ptr<InputDevice> CreateInputDevice(const ParamPackage& package) { | ||
| 465 | return CreateDevice<InputDevice>(package); | ||
| 466 | } | ||
| 467 | |||
| 468 | inline std::unique_ptr<OutputDevice> CreateOutputDevice(const ParamPackage& package) { | ||
| 469 | return CreateDevice<OutputDevice>(package); | ||
| 470 | } | ||
| 471 | |||
| 438 | } // namespace Common::Input | 472 | } // namespace Common::Input |