RCFProto
 All Classes Functions Typedefs
JsonRpc.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2013, Delta V Software. All rights reserved.
6 // http://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF
12 // under GPL terms.
13 //
14 // Version: 2.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_RCF_JSONRPC_HPP
20 #define INCLUDE_RCF_JSONRPC_HPP
21 
22 #include <RCF/ByteBuffer.hpp>
23 
24 #include <string>
25 
26 #include <boost/cstdint.hpp>
27 
28 #include "json_spirit_reader_template.h"
29 #include "json_spirit_writer_template.h"
30 
31 namespace RCF {
32 
33  class RCF_EXPORT JsonRpcRequest
34  {
35  public:
36  JsonRpcRequest(ByteBuffer message);
37  bool isNotification() const;
38  const std::string & getMethodName() const;
39  const json_spirit::Array & getJsonParams() const;
40  boost::uint64_t getRequestId() const;
41 
42  private:
43 
44  ByteBuffer mMessageBuffer;
45 
46  json_spirit::Value mJsonRequest;
47  json_spirit::Array mJsonParams;
48 
49  std::string mMethodName;
50  bool mIsNotification;
51  boost::uint64_t mRequestId;
52  };
53 
54  class RCF_EXPORT JsonRpcResponse
55  {
56  public:
57 
58  JsonRpcResponse(boost::uint64_t requestId);
59  json_spirit::mObject & getJsonResponse();
60 
61  private:
62 
63  json_spirit::mObject mJsonResponse;
64 
65  };
66 
67 } // namespace RCF
68 
69 #endif // ! INCLUDE_RCF_JSONRPC_HPP