cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
msgpack_rpc::clients::CallFuture< Result > Class Template Reference

Class of future object to wait for asynchronous RPCs. More...

#include <msgpack_rpc/clients/call_future.h>

Inheritance diagram for msgpack_rpc::clients::CallFuture< Result >:
Collaboration diagram for msgpack_rpc::clients::CallFuture< Result >:

Public Member Functions

 CallFuture (std::shared_ptr< impl::ICallFutureImpl > impl)
 Constructor.
Result get_result ()
 Get the result of RPC.
Result get_result_within (std::chrono::nanoseconds timeout)
 Get the result of RPC within a timeout.

Static Private Member Functions

static Result get_from_call_result (const messages::CallResult &call_result)
 Get the result from CallResult object.

Private Attributes

std::shared_ptr< impl::ICallFutureImplimpl_
 Object of the internal implementation.

Detailed Description

template<typename Result>
class msgpack_rpc::clients::CallFuture< Result >

Class of future object to wait for asynchronous RPCs.

Template Parameters
ResultType of the result.

Objects of this class are created by Client::async_call function.

Examples
more_client.cpp.

Definition at line 40 of file call_future.h.

Constructor & Destructor Documentation

◆ CallFuture()

template<typename Result>
msgpack_rpc::clients::CallFuture< Result >::CallFuture ( std::shared_ptr< impl::ICallFutureImpl > impl)
inlineexplicit

Constructor.

Parameters
[in]implObject of the internal implementation.
Warning
Users should create objects of this class using Client::async_call function.

Definition at line 50 of file call_future.h.

Member Function Documentation

◆ get_from_call_result()

template<typename Result>
Result msgpack_rpc::clients::CallFuture< Result >::get_from_call_result ( const messages::CallResult & call_result)
inlinestaticnodiscardprivate

Get the result from CallResult object.

Parameters
[in]call_resultCallResult object.
Returns
Result.

Definition at line 92 of file call_future.h.

◆ get_result()

template<typename Result>
Result msgpack_rpc::clients::CallFuture< Result >::get_result ( )
inlinenodiscard

Get the result of RPC.

Returns
Result.
Exceptions
ServerExceptionErrors in the server.
MsgpackRPCExceptionOther errors.
Note
This function will wait for the result if not received.
Examples
more_client.cpp.

Definition at line 63 of file call_future.h.

◆ get_result_within()

template<typename Result>
Result msgpack_rpc::clients::CallFuture< Result >::get_result_within ( std::chrono::nanoseconds timeout)
inlinenodiscard

Get the result of RPC within a timeout.

Parameters
[in]timeoutTimeout.
Returns
Result.
Exceptions
ServerExceptionErrors in the server.
MsgpackRPCExceptionOther errors including timeout.
Note
This function will wait for the result if not received, and throw an exception when no result can be received within the given timeout.
Examples
more_client.cpp.

Definition at line 80 of file call_future.h.

Member Data Documentation

◆ impl_

template<typename Result>
std::shared_ptr<impl::ICallFutureImpl> msgpack_rpc::clients::CallFuture< Result >::impl_
private

Object of the internal implementation.

Definition at line 101 of file call_future.h.


The documentation for this class was generated from the following file: