added external rpc implementation
This commit is contained in:
parent
9b482ae956
commit
4ddaea91a7
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "rpc"]
|
||||
path = rpc
|
||||
url = https://github.com/jsonrpcx/json-rpc-cxx.git
|
||||
@ -1,20 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <jsonrpccxx/server.hpp>
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace cloud_point_rpc {
|
||||
|
||||
class RpcServer {
|
||||
public:
|
||||
public:
|
||||
using Handler = std::function<nlohmann::json(const nlohmann::json&)>;
|
||||
|
||||
void register_method(const std::string& name, Handler handler);
|
||||
[[nodiscard]] std::string process(const std::string& request_str);
|
||||
|
||||
private:
|
||||
private:
|
||||
std::map<std::string, Handler> handlers_;
|
||||
};
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ gtest_dep = gtest_proj.get_variable('gtest_dep')
|
||||
gtest_main_dep = gtest_proj.get_variable('gtest_main_dep')
|
||||
gmock_dep = gtest_proj.get_variable('gmock_dep')
|
||||
|
||||
inc = include_directories('include')
|
||||
inc = include_directories(['include', 'rpc/include'])
|
||||
|
||||
subdir('src')
|
||||
subdir('tests')
|
||||
|
||||
1
rpc
Submodule
1
rpc
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a0e195b575d62cb07016321ac9cd7e1b9e048fe5
|
||||
Loading…
x
Reference in New Issue
Block a user