ifw-fcf 7.1.4
Loading...
Searching...
No Matches
deviceFactory.hpp
Go to the documentation of this file.
1
8#ifndef FCF_DEVMGR_COMMON_DEVICEFACTORY_HPP
9#define FCF_DEVMGR_COMMON_DEVICEFACTORY_HPP
10
11#include <map>
12#include <string>
13
14#include <ifw/core/utils/bat/logger.hpp>
16
17namespace ifw::fcf {
18 namespace devmgr {
19 namespace common {
20
21 class IDevice;
26 public:
27
35 static DeviceFactory& Instance();
36
44 void RegisterMaker(const std::string& key, IDeviceMaker * maker);
45
46
54 void DeregisterMaker(const std::string& key, IDeviceMaker * maker);
55
64 std::shared_ptr<IDevice> Create(const std::string& filename,
65 const std::string& name,
66 const std::string& type,
67 DataContext& data_ctx) const;
68
69 private:
70 // Disable copying and assignment
71 DeviceFactory() {};
72
73 // Disable copying and assignment
74 DeviceFactory(const DeviceFactory& other);
75 DeviceFactory& operator=(const DeviceFactory& other);
76
77
79 std::map<std::string, IDeviceMaker* > m_makers; // cppcheck-suppress unusedStructMember
80 log4cplus::Logger m_logger;
81 };
82
83 }
84 }
85}
86
87
88
89#endif //FCF_DEVMGR_COMMON_DEVICE_FACTORY_HPP
Definition dataContext.hpp:86
Definition deviceFactory.hpp:25
static DeviceFactory & Instance()
Get instance of singleton.
Definition deviceFactory.cpp:28
void RegisterMaker(const std::string &key, IDeviceMaker *maker)
Register device maker.
Definition deviceFactory.cpp:36
void DeregisterMaker(const std::string &key, IDeviceMaker *maker)
Deregister device maker.
Definition deviceFactory.cpp:47
std::shared_ptr< IDevice > Create(const std::string &filename, const std::string &name, const std::string &type, DataContext &data_ctx) const
Creates a new device.
Definition deviceFactory.cpp:56
Definition iDeviceMaker.hpp:26
ActionsEnable class source file.
Definition actionMgr.cpp:28