| 1 | /************************************************************************* |
| 2 | * libjson-rpc-cpp |
| 3 | ************************************************************************* |
| 4 | * @file client.h |
| 5 | * @date 03.01.2013 |
| 6 | * @author Peter Spiess-Knafl <dev@spiessknafl.at> |
| 7 | * @license See attached LICENSE.txt |
| 8 | ************************************************************************/ |
| 9 | |
| 10 | #ifndef JSONRPC_CPP_CLIENT_H_ |
| 11 | #define JSONRPC_CPP_CLIENT_H_ |
| 12 | |
| 13 | #include "batchcall.h" |
| 14 | #include "batchresponse.h" |
| 15 | #include "iclientconnector.h" |
| 16 | #include <jsonrpccpp/common/jsonparser.h> |
| 17 | |
| 18 | #include <map> |
| 19 | #include <vector> |
| 20 | |
| 21 | namespace jsonrpc { |
| 22 | class RpcProtocolClient; |
| 23 | |
| 24 | typedef enum { JSONRPC_CLIENT_V1, JSONRPC_CLIENT_V2 } clientVersion_t; |
| 25 | |
| 26 | class Client { |
| 27 | public: |
| 28 | Client(IClientConnector &connector, clientVersion_t version = JSONRPC_CLIENT_V2, bool omitEndingLineFeed = false); |
| 29 | virtual ~Client(); |
| 30 | |
| 31 | void CallMethod(const std::string &name, const Json::Value ¶meter, Json::Value &result); |
| 32 | Json::Value CallMethod(const std::string &name, const Json::Value ¶meter); |
| 33 | |
| 34 | void CallProcedures(const BatchCall &calls, BatchResponse &response); |
| 35 | BatchResponse CallProcedures(const BatchCall &calls); |
| 36 | |
| 37 | void CallNotification(const std::string &name, const Json::Value ¶meter); |
| 38 | |
| 39 | private: |
| 40 | IClientConnector &connector; |
| 41 | RpcProtocolClient *protocol; |
| 42 | }; |
| 43 | |
| 44 | } /* namespace jsonrpc */ |
| 45 | #endif /* JSONRPC_CPP_CLIENT_H_ */ |
| 46 | |