ifw-fcf 6.0.0
Loading...
Searching...
No Matches
deviceFactory.hpp
Go to the documentation of this file.
1
9#ifndef FCF_DEVMGR_COMMON_DEVICEFACTORY_HPP
10#define FCF_DEVMGR_COMMON_DEVICEFACTORY_HPP
11
12// System headers
13#include <map>
14#include <string>
15
16// Local headers
17#include <utils/bat/logger.hpp>
19
20namespace fcf {
21 namespace devmgr {
22 namespace common {
23
24 class IDevice;
29 public:
30
38 static DeviceFactory& Instance();
39
47 void RegisterMaker(const std::string& key, IDeviceMaker * maker);
48
49
57 void DeregisterMaker(const std::string& key, IDeviceMaker * maker);
58
67 std::shared_ptr<IDevice> Create(const std::string& filename,
68 const std::string& name,
69 const std::string& type,
70 DataContext& data_ctx) const;
71
72 private:
73 // Disable copying and assignment
74 DeviceFactory() {};
75
76 // Disable copying and assignment
77 DeviceFactory(const DeviceFactory& other);
78 DeviceFactory& operator=(const DeviceFactory& other);
79
80
82 std::map<std::string, IDeviceMaker* > m_makers;
83 log4cplus::Logger m_logger;
84 };
85
86 }
87 }
88}
89
90
91
92#endif //FCF_DEVMGR_COMMON_DEVICE_FACTORY_HPP
Definition: dataContext.hpp:90
Definition: deviceFactory.hpp:28
void RegisterMaker(const std::string &key, IDeviceMaker *maker)
Register device maker.
Definition: deviceFactory.cpp:38
void DeregisterMaker(const std::string &key, IDeviceMaker *maker)
Deregister device maker.
Definition: deviceFactory.cpp:50
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:59
static DeviceFactory & Instance()
Get instance of singleton.
Definition: deviceFactory.cpp:30
Definition: iDeviceMaker.hpp:27
Config class header file.
Definition: actionMgr.cpp:29