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

Class of clients. More...

#include <msgpack_rpc/clients/client.h>

Collaboration diagram for msgpack_rpc::clients::Client:

Public Member Functions

 Client (std::shared_ptr< impl::IClientImpl > impl)
 Constructor.
template<typename Result, typename... Parameters>
CallFuture< std::decay_t< Result > > async_call (messages::MethodNameView method_name, const Parameters &... parameters)
 Asynchronously call a method.
template<typename Result, typename... Parameters>
std::decay_t< Result > call (messages::MethodNameView method_name, const Parameters &... parameters)
 Synchronously call a method.
std::shared_ptr< executors::IExecutorexecutor ()
 Get the executor.
template<typename... Parameters>
void notify (messages::MethodNameView method_name, const Parameters &... parameters)
 Notify to a method.
void stop ()
 Stop processing of this client.

Private Attributes

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

Detailed Description

Class of clients.

Clients can be created using ClientBuilder.

Examples
more_client.cpp, and simple_client.cpp.

Definition at line 39 of file client.h.

Constructor & Destructor Documentation

◆ Client()

msgpack_rpc::clients::Client::Client ( std::shared_ptr< impl::IClientImpl > impl)
inlineexplicit

Constructor.

Parameters
[in]implObject of the internal implementation.
Warning
Users should create clients using ClientBuilder instead of this constructor.

Definition at line 49 of file client.h.

Member Function Documentation

◆ async_call()

template<typename Result, typename... Parameters>
CallFuture< std::decay_t< Result > > msgpack_rpc::clients::Client::async_call ( messages::MethodNameView method_name,
const Parameters &... parameters )
inlinenodiscard

Asynchronously call a method.

Template Parameters
ResultType of the result.
ParametersTypes of parameters.
Parameters
[in]method_nameName of the method.
[in]parametersParameters.
Returns
Future object to get the result of the RPC.
Examples
more_client.cpp.

Definition at line 70 of file client.h.

◆ call()

template<typename Result, typename... Parameters>
std::decay_t< Result > msgpack_rpc::clients::Client::call ( messages::MethodNameView method_name,
const Parameters &... parameters )
inline

Synchronously call a method.

Template Parameters
ResultType of the result.
ParametersTypes of parameters.
Parameters
[in]method_nameName of the method.
[in]parametersParameters.
Returns
Result of the RPC.
Exceptions
ServerExceptionErrors in the server.
MsgpackRPCExceptionOther errors.
Examples
more_client.cpp, and simple_client.cpp.

Definition at line 89 of file client.h.

◆ executor()

std::shared_ptr< executors::IExecutor > msgpack_rpc::clients::Client::executor ( )
inlinenodiscard

Get the executor.

Returns
Executor.
Note
This function is mainly for testing. So this function may be removed in the future.

Definition at line 119 of file client.h.

◆ notify()

template<typename... Parameters>
void msgpack_rpc::clients::Client::notify ( messages::MethodNameView method_name,
const Parameters &... parameters )
inline

Notify to a method.

Template Parameters
ParametersTypes of parameters.
Parameters
[in]method_nameName of the method.
[in]parametersParameters.
Note
Notifications are always processed asynchronously because a notification doesn't have a response.
Examples
more_client.cpp.

Definition at line 105 of file client.h.

◆ stop()

void msgpack_rpc::clients::Client::stop ( )
inline

Stop processing of this client.

Note
Destructing this client without call of this function will automatically stop this client internally.

Definition at line 58 of file client.h.

Member Data Documentation

◆ impl_

std::shared_ptr<impl::IClientImpl> msgpack_rpc::clients::Client::impl_
private

Object of the internal implementation.

Definition at line 125 of file client.h.


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