正在显示
1 个修改的文件
包含
52 行增加
和
0 行删除
src/server/dmpserviceregistry.h
0 → 100644
1 | +/************************************************************************** | ||
2 | +* file: dmpserviceregistry.h | ||
3 | + | ||
4 | +* Author: wanzhongping | ||
5 | +* Date: 2020-12-31 17:16:25 | ||
6 | +* Email: zhongpingw@chinadci.com | ||
7 | +* copyright: 广州城市信息研究所有限公司 | ||
8 | +***************************************************************************/ | ||
9 | + | ||
10 | +#ifndef __dmpserviceregistry_h__ | ||
11 | +#define __dmpserviceregistry_h__ | ||
12 | + | ||
13 | +#include <iostream> | ||
14 | +#include <string> | ||
15 | +#include <map> | ||
16 | +#include <memory> | ||
17 | + | ||
18 | +#include "dmpservicenativeloader.h" | ||
19 | + | ||
20 | + | ||
21 | +class DmpService; | ||
22 | +class SERVER_EXPORT DmpServiceRegistry | ||
23 | +{ | ||
24 | + | ||
25 | + public: | ||
26 | + | ||
27 | + DmpServiceRegistry() = default; | ||
28 | + | ||
29 | + ~DmpServiceRegistry(); | ||
30 | + | ||
31 | + void RegisterService(std::shared_ptr<DmpService> service); | ||
32 | + | ||
33 | + int UnregisterService(const std::string &name, const std::string &version = std::string()); | ||
34 | + | ||
35 | + std::shared_ptr<DmpService> GetService(const std::string &name, const std::string &version); | ||
36 | + | ||
37 | + void Init( const boost::filesystem::path &module_path); | ||
38 | + | ||
39 | + void CleanUp(); | ||
40 | + | ||
41 | + private: | ||
42 | + typedef std::map<std::string, std::shared_ptr<DmpService> > ServiceMap; | ||
43 | + typedef std::map<std::string, std::pair<std::string, std::string> > VersionMap; | ||
44 | + | ||
45 | + DmpServiceNativeLoader nativeLoader_; | ||
46 | + ServiceMap services_; | ||
47 | + VersionMap serviceVersions_; | ||
48 | + | ||
49 | +}; | ||
50 | + | ||
51 | + | ||
52 | +#endif // __dmpserviceregistry_h__ |
请
注册
或
登录
后发表评论