dmpservermanagerapi.h
1.6 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
/**************************************************************************
* file: dmpservermanagerapi.h
* Author: wanzhongping
* Date: 2021-07-15 11:07:36
* Email: zhongpingw@chinadci.com
* copyright: 广州城市信息研究所有限公司
***************************************************************************/
#ifndef __dmpservermanagerapi_h__
#define __dmpservermanagerapi_h__
#include "dmap_server.h"
#include "dmpserverapi.h"
#include "dmpserverapihandler.h"
#include "dmpserverapicontext.h"
#include <memory>
#include <vector>
class DmpServerApiHandler;
class SERVER_EXPORT DmpServerManagerApi : public DmpServerApi
{
public:
DmpServerManagerApi(const std::string &path,
const std::string &name,
const std::string &description = std::string(),
const std::string &version = std::string());
~DmpServerManagerApi() override;
std::string name() const override { return name_; }
std::string path() const override { return path_ ; }
virtual void executeRequest(const DmpServerApiContext &context) override ;
template<class T, typename... Args>
void registerHandler( Args... args )
{
handlers_.emplace_back(std::make_shared<T>( args... ));
}
void registerHandler(DmpServerApiHandler *handler);
private:
std::string path_;
std::string name_;
std::string description_;
std::string version_;
std::vector<std::shared_ptr<DmpServerApiHandler>> handlers_;
};
#endif //__dmpservermanagerapi_h__