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)
スワップです。
bool operator==(const JsonRpcClient &rhs) const
クライアントが同一の場合にtrueを返します。
#define NLIB_SAFE_BOOL(class_name, exp)
クラス内に安全なoperator bool()を定義します。 可能であればC++11のexplicit boolを利用します。 ...
bool operator!=(const JsonRpcClient &rhs) const
クライアントが同一の場合にfalseを返します。
UniquePtrはポインタの所有権を保持し、UniquePtrがスコープから出るときにデストラクタでポインタをDELで指...
std::unique_ptrに相当するクラスが定義されています。
::nlib_ns::threading::Future< UniquePtr< JsonRpcResponse > > FutureType
それぞれにリクエストに対して割り当てられる、レスポンス(又はタイムアウト)があるとセットされるfutureの...
空の構造体で、関数の引数をムーブすべきことを示すために利用されます。
#define NLIB_NOEXCEPT
環境に合わせてnoexcept 又は同等の定義がされます。
#define NLIB_CEXPR
利用可能であればconstexprが定義されます。そうでない場合は空文字列です。
uint32_t reqid_t
JSON-RPCのリクエストに付与されるidの型です。
JSON-RPCのクライアント側の管理を行うクラスです。
マルチスレッドプログラミングのためのFutureパターンを実装しています。
#define NLIB_FINAL
利用可能であればfinalが定義されます。そうでない場合は空文字列です。
constexpr JsonRpcClient() noexcept
デフォルトコンストラクタです。