16 #ifndef INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCCLIENT_H_ 17 #define INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCCLIENT_H_ 20 #include "nn/nlib/Swap.h" 24 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS) 25 #undef NLIB_VIS_PUBLIC 26 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 34 class JsonRpcResponseHandler;
42 static void Shutdown();
49 handle_ = rhs.handle_;
54 swap(handle_, rhs.handle_);
61 typedef ::nlib_ns::threading::Future<UniquePtr<JsonRpcResponse> >
FutureType;
62 errno_t GetFutureForId(FutureType* future, reqid_t reqid);
63 errno_t ResolveResponse(
const void* buf,
size_t nbytes);
65 errno_t SetNoTargetResponseHandler(NoTargetResponseHandler handler);
76 friend class JsonRpcClientImpl;
83 NLIB_DEFINE_STD_SWAP(::nlib_ns::msgpack::jsonrpc::JsonRpcClient)
85 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS) 86 #undef NLIB_VIS_PUBLIC 87 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 90 #endif // INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCCLIENT_H_ void swap(JsonRpcClient &rhs)
A swap.
Class for representing the JSON-RPC response.
bool operator==(const JsonRpcClient &rhs) const
Returns true if the client is the same.
#define NLIB_SAFE_BOOL(class_name, exp)
Defines a safe operator bool function in the class. Uses the C++11 explicit bool if it is available f...
bool operator!=(const JsonRpcClient &rhs) const
Returns false if the client is the same.
UniquePtr owns the pointer, and when it goes out of scope, the pointer is released by the destructor ...
Defines that class that is corresponding to std::unique_ptr.
::nlib_ns::threading::Future< UniquePtr< JsonRpcResponse > > FutureType
A future type set when a response (or timeout) is assigned to each request.
An empty structure indicating that an argument to a function needs to be moved.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
A file that contains the configuration information for each development environment.
uint32_t reqid_t
id type for the JSON-RPC request.
Class to manage client side JSON-RPC.
Implements the Future pattern for multithread programming.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
constexpr JsonRpcClient() noexcept
Instantiates the object with default parameters (default constructor).