rad 6.2.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
rad::MsgRequestor2< TREQ, TREP > Struct Template Reference

#include <msgRequestor.hpp>

Public Types

using request_t = TREQ
 
using reply_t = TREP
 
using handler_t = std::function<void(const std::error_code&, reply_t)>
 

Public Member Functions

 MsgRequestor2 (const std::string &endpoint, const std::string &identity, boost::asio::io_context &ios)
 
virtual ~MsgRequestor2 ()
 
 MsgRequestor2 (const MsgRequestor2 &)=delete
 
MsgRequestor2operator= (const MsgRequestor2 &)=delete
 
 MsgRequestor2 (MsgRequestor2 &&)=default
 
MsgRequestor2operator= (MsgRequestor2 &&)=default
 
size_t AsyncSendReceive (const request_t &payload, handler_t handler, std::chrono::milliseconds const timeout=std::chrono::milliseconds(0))
 

Detailed Description

template<typename TREQ, typename TREP>
struct rad::MsgRequestor2< TREQ, TREP >

This class allows to asynchronously send requests and wait for a reply.

Template Parameters
TREQRequest message type
TREPResponse message type

Member Typedef Documentation

◆ handler_t

template<typename TREQ , typename TREP >
using rad::MsgRequestor2< TREQ, TREP >::handler_t = std::function<void(const std::error_code&, reply_t)>

◆ reply_t

template<typename TREQ , typename TREP >
using rad::MsgRequestor2< TREQ, TREP >::reply_t = TREP

◆ request_t

template<typename TREQ , typename TREP >
using rad::MsgRequestor2< TREQ, TREP >::request_t = TREQ

Constructor & Destructor Documentation

◆ MsgRequestor2() [1/3]

template<typename TREQ , typename TREP >
rad::MsgRequestor2< TREQ, TREP >::MsgRequestor2 ( const std::string & endpoint,
const std::string & identity,
boost::asio::io_context & ios )
inline

Constructor for MsgRequestor2 class.

Parameters
[in]endpointDestination address and port to be used to send the requests.
[in]identityPrefix to be used to build the request identifier.
[in]iosReference to the event loop.
Exceptions
Onconnection error.

◆ ~MsgRequestor2()

template<typename TREQ , typename TREP >
virtual rad::MsgRequestor2< TREQ, TREP >::~MsgRequestor2 ( )
inlinevirtual

◆ MsgRequestor2() [2/3]

template<typename TREQ , typename TREP >
rad::MsgRequestor2< TREQ, TREP >::MsgRequestor2 ( const MsgRequestor2< TREQ, TREP > & )
delete

◆ MsgRequestor2() [3/3]

template<typename TREQ , typename TREP >
rad::MsgRequestor2< TREQ, TREP >::MsgRequestor2 ( MsgRequestor2< TREQ, TREP > && )
default

Member Function Documentation

◆ AsyncSendReceive()

template<typename TREQ , typename TREP >
size_t rad::MsgRequestor2< TREQ, TREP >::AsyncSendReceive ( const request_t & payload,
handler_t handler,
std::chrono::milliseconds const timeout = std::chrono::milliseconds(0) )
inline

Asynchronosly send a request message to an destination process and schedule a handler to receive the reply.

Parameters
[in]payloadRequest's payload.
[in]handlerHandler of the reply. Handler may not throw an exception!
[in]timeoutTimeout of request, set to zero for no timeout.
Returns
The number of bytes sent.

◆ operator=() [1/2]

template<typename TREQ , typename TREP >
MsgRequestor2 & rad::MsgRequestor2< TREQ, TREP >::operator= ( const MsgRequestor2< TREQ, TREP > & )
delete

◆ operator=() [2/2]

template<typename TREQ , typename TREP >
MsgRequestor2 & rad::MsgRequestor2< TREQ, TREP >::operator= ( MsgRequestor2< TREQ, TREP > && )
default

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