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