BuGUI
BUtton Grid User Interface
Loading...
Searching...
No Matches
hardware_factory.hpp
1#pragma once
2#include "hardware.hpp"
3
4#include <string_view>
5
6namespace bugui
7{
10template <typename T, typename... Arg>
12{ // FIXME : assigning hardware by passing device name
13 // is this the best way to do this ?
17 static std::unique_ptr<base_hardware>
18 get(std::string_view device_name, T* controller)
19 {
20 std::unique_ptr<base_hardware> h{nullptr};
21
22 ((void)
23 (Arg::c_name() == device_name
24 && (h = std::make_unique<hardware<Arg, T>>(controller)
25 , true)), ...);
26
27 if (h.get()) h->setup();
28 return h;
29 }
30};
31
32} // namespace bugui
Main class to inherit from. Acts ast the root of the widget tree, and provides generic access to the ...
Definition controller.hpp:18
Instantiate a hardware object specialised with a specific device.
Definition hardware_factory.hpp:12
static std::unique_ptr< base_hardware > get(std::string_view device_name, T *controller)
Retrieves an instance of hardware specialised with the device who's c_name matches the device_name ar...
Definition hardware_factory.hpp:18