ifw-fcf  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
18 
19 namespace fcf {
20  namespace devmgr {
21  namespace common {
22 
23  class IDevice;
27  class DeviceFactory {
28  public:
29 
37  static DeviceFactory& Instance();
38 
46  void RegisterMaker(const std::string& key, IDeviceMaker * maker);
47 
48 
56  void DeregisterMaker(const std::string& key, IDeviceMaker * maker);
57 
66  std::shared_ptr<IDevice> Create(const std::string& filename,
67  const std::string& name,
68  DataContext& data_ctx) const;
69 
70  private:
71  // Disable copying and assignment
72  DeviceFactory() {}
73 
74  // Disable copying and assignment
75  DeviceFactory(const DeviceFactory& other);
76  DeviceFactory& operator=(const DeviceFactory& other);
77 
78 
80  std::map<std::string, IDeviceMaker* > m_makers;
81  };
82 
83  }
84  }
85 }
86 
87 
88 
89 #endif //FCF_DEVMGR_COMMON_DEVICE_FACTORY_HPP
static DeviceFactory & Instance()
Get instance of singleton.
Definition: deviceFactory.cpp:23
Config class header file.
Definition: deviceFactory.hpp:27
void RegisterMaker(const std::string &key, IDeviceMaker *maker)
Register device maker.
Definition: deviceFactory.cpp:30
std::shared_ptr< IDevice > Create(const std::string &filename, const std::string &name, DataContext &data_ctx) const
Creates a new device.
Definition: deviceFactory.cpp:51
Definition: dataContext.hpp:81
Definition: iDeviceMaker.hpp:26
void DeregisterMaker(const std::string &key, IDeviceMaker *maker)
Deregister device maker.
Definition: deviceFactory.cpp:42