abstractstubserver.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * This file is generated by jsonrpcstub, DO NOT CHANGE IT MANUALLY!
  3. */
  4. #ifndef JSONRPC_CPP_STUB_ABSTRACTSTUBSERVER_H_
  5. #define JSONRPC_CPP_STUB_ABSTRACTSTUBSERVER_H_
  6. #include <jsonrpccpp/server.h>
  7. class AbstractStubServer : public jsonrpc::AbstractServer<AbstractStubServer>
  8. {
  9. public:
  10. AbstractStubServer(jsonrpc::AbstractServerConnector &conn, jsonrpc::serverVersion_t type = jsonrpc::JSONRPC_SERVER_V2) : jsonrpc::AbstractServer<AbstractStubServer>(conn, type)
  11. {
  12. this->bindAndAddMethod(jsonrpc::Procedure("sayHello", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, "name",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::sayHelloI);
  13. this->bindAndAddNotification(jsonrpc::Procedure("notifyServer", jsonrpc::PARAMS_BY_NAME, NULL), &AbstractStubServer::notifyServerI);
  14. this->bindAndAddMethod(jsonrpc::Procedure("addNumbers", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_INTEGER, "param1",jsonrpc::JSON_INTEGER,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::addNumbersI);
  15. this->bindAndAddMethod(jsonrpc::Procedure("addNumbers2", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_REAL, "param1",jsonrpc::JSON_REAL,"param2",jsonrpc::JSON_REAL, NULL), &AbstractStubServer::addNumbers2I);
  16. this->bindAndAddMethod(jsonrpc::Procedure("isEqual", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractStubServer::isEqualI);
  17. this->bindAndAddMethod(jsonrpc::Procedure("buildObject", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER, NULL), &AbstractStubServer::buildObjectI);
  18. this->bindAndAddMethod(jsonrpc::Procedure("methodWithoutParameters", jsonrpc::PARAMS_BY_NAME, jsonrpc::JSON_STRING, NULL), &AbstractStubServer::methodWithoutParametersI);
  19. }
  20. inline virtual void sayHelloI(const Json::Value &request, Json::Value &response)
  21. {
  22. response = this->sayHello(request["name"].asString());
  23. }
  24. inline virtual void notifyServerI(const Json::Value &request)
  25. {
  26. (void)request;
  27. this->notifyServer();
  28. }
  29. inline virtual void addNumbersI(const Json::Value &request, Json::Value &response)
  30. {
  31. response = this->addNumbers(request[0u].asInt(), request[1u].asInt());
  32. }
  33. inline virtual void addNumbers2I(const Json::Value &request, Json::Value &response)
  34. {
  35. response = this->addNumbers2(request[0u].asDouble(), request[1u].asDouble());
  36. }
  37. inline virtual void isEqualI(const Json::Value &request, Json::Value &response)
  38. {
  39. response = this->isEqual(request[0u].asString(), request[1u].asString());
  40. }
  41. inline virtual void buildObjectI(const Json::Value &request, Json::Value &response)
  42. {
  43. response = this->buildObject(request[0u].asString(), request[1u].asInt());
  44. }
  45. inline virtual void methodWithoutParametersI(const Json::Value &request, Json::Value &response)
  46. {
  47. (void)request;
  48. response = this->methodWithoutParameters();
  49. }
  50. virtual std::string sayHello(const std::string& name) = 0;
  51. virtual void notifyServer() = 0;
  52. virtual int addNumbers(int param1, int param2) = 0;
  53. virtual double addNumbers2(double param1, double param2) = 0;
  54. virtual bool isEqual(const std::string& param1, const std::string& param2) = 0;
  55. virtual Json::Value buildObject(const std::string& param1, int param2) = 0;
  56. virtual std::string methodWithoutParameters() = 0;
  57. };
  58. #endif //JSONRPC_CPP_STUB_ABSTRACTSTUBSERVER_H_