3 #ifndef INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCCLIENT_H_
4 #define INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCCLIENT_H_
7 #include "nn/nlib/Swap.h"
11 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS)
12 #undef NLIB_VIS_PUBLIC
13 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT
21 class JsonRpcResponseHandler;
29 static void Shutdown();
36 m_Handle = rhs.m_Handle;
41 swap(m_Handle, rhs.m_Handle);
48 typedef ::nlib_ns::threading::Future<UniquePtr<JsonRpcResponse> >
FutureType;
49 errno_t GetFutureForId(FutureType* future, reqid_t reqid);
50 errno_t ResolveResponse(
const void* buf,
size_t nbytes);
52 errno_t SetNoTargetResponseHandler(NoTargetResponseHandler handler);
63 friend class JsonRpcClientImpl;
70 NLIB_DEFINE_STD_SWAP(::nlib_ns::msgpack::jsonrpc::JsonRpcClient)
72 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS)
73 #undef NLIB_VIS_PUBLIC
74 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT
77 #endif // INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCCLIENT_H_
JsonRpcClient(const JsonRpcClient &rhs)
コピーコンストラクタです。
void swap(JsonRpcClient &rhs)
スワップです。
#define NLIB_FINAL
利用可能であればfinalが定義されます。そうでない場合は空文字列です。
#define NLIB_SAFE_BOOL(class_name, exp)
クラス内に安全なoperator bool()を定義します。 可能であればC++11のexplicit boolを利用します。 ...
bool operator==(const JsonRpcClient &rhs) const
クライアントが同一の場合にtrueを返します。
UniquePtrはポインタの所有権を保持し、UniquePtrがスコープから出るときにデストラクタでポインタをDELで指...
std::unique_ptrに相当するクラスが定義されています。
::nlib_ns::threading::Future< UniquePtr< JsonRpcResponse > > FutureType
それぞれにリクエストに対して割り当てられる、レスポンス(又はタイムアウト)があるとセットされるfutureの...
JsonRpcClient()
デフォルトコンストラクタです。
JsonRpcClient & operator=(const JsonRpcClient &rhs)
代入演算子です。
uint32_t reqid_t
JSON-RPCのリクエストに付与されるidの型です。
JSON-RPCのクライアント側の管理を行うクラスです。
マルチスレッドプログラミングのためのFutureパターンを実装しています。
bool operator!=(const JsonRpcClient &rhs) const
クライアントが同一の場合にfalseを返します。