cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
msgpack_rpc::clients::impl::Call Class Reference

Class of data of RPC. More...

#include <msgpack_rpc/clients/impl/call.h>

Collaboration diagram for msgpack_rpc::clients::impl::Call:

Public Member Functions

 Call (const std::shared_ptr< executors::IExecutor > &executor, std::chrono::steady_clock::time_point deadline)
 Constructor.
std::shared_ptr< CallFutureImplfuture () const noexcept
 Get the future object to set and get the result of this RPC.
void set (const messages::CallResult &result)
 Set the result.
void set (const Status &error)
 Set an error.
template<typename OnTimeout>
void set_timeout (std::chrono::steady_clock::time_point deadline, OnTimeout &&on_timeout)
 Set timeout.

Private Attributes

CallPromise promise_
 Object to set the result of this RPC.
executors::Timer timeout_timer_
 Timer of timeout.

Detailed Description

Class of data of RPC.

Definition at line 39 of file call.h.

Constructor & Destructor Documentation

◆ Call()

msgpack_rpc::clients::impl::Call::Call ( const std::shared_ptr< executors::IExecutor > & executor,
std::chrono::steady_clock::time_point deadline )
inline

Constructor.

Parameters
[in]executorExecutor.
[in]deadlineDeadline of the result of the RPC.

Definition at line 47 of file call.h.

Member Function Documentation

◆ future()

std::shared_ptr< CallFutureImpl > msgpack_rpc::clients::impl::Call::future ( ) const
inlinenodiscardnoexcept

Get the future object to set and get the result of this RPC.

Returns
Future object to set and get the result of this RPC.

Definition at line 71 of file call.h.

◆ set() [1/2]

void msgpack_rpc::clients::impl::Call::set ( const messages::CallResult & result)
inline

Set the result.

Parameters
[in]resultResult.

Definition at line 80 of file call.h.

◆ set() [2/2]

void msgpack_rpc::clients::impl::Call::set ( const Status & error)
inline

Set an error.

Parameters
[in]errorError.

Definition at line 87 of file call.h.

◆ set_timeout()

template<typename OnTimeout>
void msgpack_rpc::clients::impl::Call::set_timeout ( std::chrono::steady_clock::time_point deadline,
OnTimeout && on_timeout )
inline

Set timeout.

Template Parameters
OnTimeoutType of the function to handle timeout.
Parameters
[in]deadlineDeadline.
[in]on_timeoutFunction to handle timeout.

Definition at line 60 of file call.h.

Member Data Documentation

◆ promise_

CallPromise msgpack_rpc::clients::impl::Call::promise_
private

Object to set the result of this RPC.

Definition at line 91 of file call.h.

◆ timeout_timer_

executors::Timer msgpack_rpc::clients::impl::Call::timeout_timer_
private

Timer of timeout.

Definition at line 94 of file call.h.


The documentation for this class was generated from the following file:
  • src/msgpack_rpc/clients/impl/call.h