dmpserviceregistry.h
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**************************************************************************
* file: dmpserviceregistry.h
* Author: wanzhongping
* Date: 2020-12-31 17:16:25
* Email: zhongpingw@chinadci.com
* copyright: 广州城市信息研究所有限公司
***************************************************************************/
#ifndef __dmpserviceregistry_h__
#define __dmpserviceregistry_h__
#include <iostream>
#include <string>
#include <map>
#include <memory>
#include "dmpservicenativeloader.h"
class DmpService;
class SERVER_EXPORT DmpServiceRegistry
{
public:
DmpServiceRegistry() = default;
~DmpServiceRegistry();
void RegisterService(std::shared_ptr<DmpService> service);
int UnregisterService(const std::string &name, const std::string &version = std::string());
std::shared_ptr<DmpService> GetService(const std::string &name, const std::string &version);
void Init( const boost::filesystem::path &module_path);
void CleanUp();
private:
typedef std::map<std::string, std::shared_ptr<DmpService> > ServiceMap;
typedef std::map<std::string, std::pair<std::string, std::string> > VersionMap;
DmpServiceNativeLoader nativeLoader_;
ServiceMap services_;
VersionMap serviceVersions_;
};
#endif // __dmpserviceregistry_h__