ifw-core 6.0.0
Loading...
Searching...
No Matches
commFactory.hpp
Go to the documentation of this file.
1
8#ifndef CORE_PROTOCOL_BASE_COMMFACTORY_HPP
9#define CORE_PROTOCOL_BASE_COMMFACTORY_HPP
10
11#include <map>
12#include <string>
13
16
18
19 // Abstract-Factory Pattern Implementation
21 public:
22 // Factory is implemented as a Singleton
23 static CommFactory& Instance();
24
25 // Adds new device maker with given key
26 void RegisterMaker(const std::string& key, ICommMaker* maker);
27
28 // Creates new IComm
29 std::shared_ptr<IComm> Create(const std::string& filename,
30 const std::string& name,
31 const std::string& interface) const;
32
33 private:
34 CommFactory() {}
35
36 // Disable copying and assignment
37 CommFactory(const CommFactory& other);
38 CommFactory& operator=(const CommFactory& other);
39
41 std::map<std::string, ICommMaker* > m_makers;
42 };
43
44}
45
46#endif //CORE_PROTOCOL_BASE_COMMFACTORY_HPP
Definition commFactory.hpp:20
std::shared_ptr< IComm > Create(const std::string &filename, const std::string &name, const std::string &interface) const
Definition commFactory.cpp:28
void RegisterMaker(const std::string &key, ICommMaker *maker)
Definition commFactory.cpp:20
static CommFactory & Instance()
Definition commFactory.cpp:15
Definition iCommMaker.hpp:19
Definition commFactory.cpp:13