|
cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
|
Class to wrap IConnection objects with template functions. More...
#include <msgpack_rpc/transport/connection_wrapper.h>
Public Types | |
| using | ConnectionClosedCallback = IConnection::ConnectionClosedCallback |
| Type of callback functions called when a connection is closed. | |
| using | MessageReceivedCallback = IConnection::MessageReceivedCallback |
| Type of callback functions called when a message is received. | |
| using | MessageSentCallback = IConnection::MessageSentCallback |
| Type of callback functions called when a message is successfully sent. | |
Public Member Functions | |
| ConnectionWrapper (std::shared_ptr< IConnection > connection) noexcept | |
| Constructor. | |
| void | async_close () |
| Asynchronously close this connection. | |
| template<typename... Parameters> | |
| void | async_notify (messages::MethodNameView method_name, const Parameters &... parameters) |
| Asynchronously send a notification. | |
| template<typename... Parameters> | |
| void | async_request (messages::MethodNameView method_name, messages::MessageID message_id, const Parameters &... parameters) |
| Asynchronously send a request. | |
| template<typename T> | |
| void | async_response_error (messages::MessageID request_id, const T &error) |
| Asynchronously send a response with an error. | |
| template<typename T> | |
| void | async_response_success (messages::MessageID request_id, const T &result) |
| Asynchronously send a response without an error. | |
| std::shared_ptr< IConnection > | connection () const noexcept |
| Get the IConnection object of this wrapper. | |
| const addresses::IAddress & | local_address () const noexcept |
| Get the address of the local endpoint. | |
| const addresses::IAddress & | remote_address () const noexcept |
| Get the address of the remote endpoint. | |
| void | start (MessageReceivedCallback on_received, MessageSentCallback on_sent, ConnectionClosedCallback on_closed) |
| Start process of this connection. | |
Private Attributes | |
| std::shared_ptr< IConnection > | connection_ |
| Connection. | |
Class to wrap IConnection objects with template functions.
Definition at line 36 of file connection_wrapper.h.
| using msgpack_rpc::transport::ConnectionWrapper::ConnectionClosedCallback = IConnection::ConnectionClosedCallback |
Type of callback functions called when a connection is closed.
Parameters:
Definition at line 60 of file connection_wrapper.h.
| using msgpack_rpc::transport::ConnectionWrapper::MessageReceivedCallback = IConnection::MessageReceivedCallback |
Type of callback functions called when a message is received.
Parameters:
Definition at line 45 of file connection_wrapper.h.
| using msgpack_rpc::transport::ConnectionWrapper::MessageSentCallback = IConnection::MessageSentCallback |
Type of callback functions called when a message is successfully sent.
Definition at line 51 of file connection_wrapper.h.
|
inlineexplicitnoexcept |
Constructor.
| [in] | connection | Connection. |
Definition at line 67 of file connection_wrapper.h.
|
inline |
Asynchronously close this connection.
Definition at line 148 of file connection_wrapper.h.
|
inline |
Asynchronously send a notification.
| Parameters | Types of parameters. |
| [in] | method_name | Method name. |
| [in] | parameters | Parameters. |
Definition at line 138 of file connection_wrapper.h.
|
inline |
Asynchronously send a request.
| Parameters | Types of parameters. |
| [in] | method_name | Method name. |
| [in] | message_id | Message ID. |
| [in] | parameters | Parameters. |
Definition at line 95 of file connection_wrapper.h.
|
inline |
Asynchronously send a response with an error.
| T | Type of the error. |
| [in] | request_id | Message ID of the request. |
| [in] | error | Error. |
Definition at line 124 of file connection_wrapper.h.
|
inline |
Asynchronously send a response without an error.
| T | Type of the result. |
| [in] | request_id | Message ID of the request. |
| [in] | result | Result. |
Definition at line 109 of file connection_wrapper.h.
|
inlinenodiscardnoexcept |
Get the IConnection object of this wrapper.
Definition at line 173 of file connection_wrapper.h.
|
inlinenodiscardnoexcept |
Get the address of the local endpoint.
Definition at line 155 of file connection_wrapper.h.
|
inlinenodiscardnoexcept |
Get the address of the remote endpoint.
Definition at line 164 of file connection_wrapper.h.
|
inline |
Start process of this connection.
| [in] | on_received | Callback function called when a message is received. |
| [in] | on_sent | Callback function called when a message is sent. |
| [in] | on_closed | Callback function called when this connection is closed. |
Definition at line 80 of file connection_wrapper.h.
|
private |
Definition at line 179 of file connection_wrapper.h.