ifw-fcf 6.0.0
Loading...
Searching...
No Matches
deviceMaker.hpp
Go to the documentation of this file.
1
9#ifndef FCF_DEVMGR_COMMON_DEVICEMAKER_HPP
10#define FCF_DEVMGR_COMMON_DEVICEMAKER_HPP
11
12// System headers
13#include <string>
14
15// Local headers
18
19namespace fcf {
20 namespace devmgr {
21 namespace common {
22
27 class IDevice;
28 template<typename T>
29 class DeviceMaker : public IDeviceMaker {
30 public:
31
32
41 explicit DeviceMaker(const std::string& key) {
43 }
44
53 virtual std::shared_ptr<IDevice> Create(const std::string& filename,
54 const std::string& name,
55 DataContext& data_ctx) const {
56 // Create new instance of T using constructor from YAML::Node
57 // Assumes T has a constructor that accepts YAML::Node
58 return std::make_shared<T>(filename, name, data_ctx);
59 }
60 };
61 }
62 }
63}
64#endif // FCF_DEVMGR_COMMON_DEVICEMAKER_HPP
Definition: dataContext.hpp:90
void RegisterMaker(const std::string &key, IDeviceMaker *maker)
Register device maker.
Definition: deviceFactory.cpp:38
static DeviceFactory & Instance()
Get instance of singleton.
Definition: deviceFactory.cpp:30
Definition: deviceMaker.hpp:29
DeviceMaker(const std::string &key)
DeviceMaker constructor.
Definition: deviceMaker.hpp:41
virtual std::shared_ptr< IDevice > Create(const std::string &filename, const std::string &name, DataContext &data_ctx) const
Create an instance of a device.
Definition: deviceMaker.hpp:53
Definition: iDeviceMaker.hpp:27
DeviceFactory class header file.
Config class header file.
Definition: actionMgr.cpp:29