Fabcoin Core  0.16.2
P2P Digital Currency
DBFace.h
Go to the documentation of this file.
1 
5 #ifndef JSONRPC_CPP_STUB_DEV_RPC_DBFACE_H_
6 #define JSONRPC_CPP_STUB_DEV_RPC_DBFACE_H_
7 
8 #include "ModularServer.h"
9 
10 namespace dev {
11  namespace rpc {
12  class DBFace : public ServerInterface<DBFace>
13  {
14  public:
16  {
17  this->bindAndAddMethod(jsonrpc::Procedure("db_put", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &dev::rpc::DBFace::db_putI);
18  this->bindAndAddMethod(jsonrpc::Procedure("db_get", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &dev::rpc::DBFace::db_getI);
19  }
20 
21  inline virtual void db_putI(const Json::Value &request, Json::Value &response)
22  {
23  response = this->db_put(request[0u].asString(), request[1u].asString(), request[2u].asString());
24  }
25  inline virtual void db_getI(const Json::Value &request, Json::Value &response)
26  {
27  response = this->db_get(request[0u].asString(), request[1u].asString());
28  }
29  virtual bool db_put(const std::string& param1, const std::string& param2, const std::string& param3) = 0;
30  virtual std::string db_get(const std::string& param1, const std::string& param2) = 0;
31  };
32 
33  }
34 }
35 #endif //JSONRPC_CPP_STUB_DEV_RPC_DBFACE_H_
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
void bindAndAddMethod(jsonrpc::Procedure const &_proc, MethodPointer _pointer)
Definition: ModularServer.h:59
virtual std::string db_get(const std::string &param1, const std::string &param2)=0
virtual void db_putI(const Json::Value &request, Json::Value &response)
Definition: DBFace.h:21
Config::Value_type Value
virtual bool db_put(const std::string &param1, const std::string &param2, const std::string &param3)=0
virtual void db_getI(const Json::Value &request, Json::Value &response)
Definition: DBFace.h:25
std::string asString(bytes const &_b)
Converts byte array to a string containing the same (binary) data.
Definition: CommonData.h:79