rad  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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)>
 
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_service &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))
 
 MsgRequestor2 (const std::string &endpoint, const std::string &identity, boost::asio::io_service &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

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

Constructor & Destructor Documentation

template<typename TREQ , typename TREP >
rad::MsgRequestor2< TREQ, TREP >::MsgRequestor2 ( const std::string &  endpoint,
const std::string &  identity,
boost::asio::io_service &  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.
template<typename TREQ , typename TREP >
virtual rad::MsgRequestor2< TREQ, TREP >::~MsgRequestor2 ( )
inlinevirtual
template<typename TREQ , typename TREP >
rad::MsgRequestor2< TREQ, TREP >::MsgRequestor2 ( const MsgRequestor2< TREQ, TREP > &  )
delete
template<typename TREQ , typename TREP >
rad::MsgRequestor2< TREQ, TREP >::MsgRequestor2 ( MsgRequestor2< TREQ, TREP > &&  )
default
template<typename TREQ , typename TREP >
rad::MsgRequestor2< TREQ, TREP >::MsgRequestor2 ( const std::string &  endpoint,
const std::string &  identity,
boost::asio::io_service &  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.
template<typename TREQ , typename TREP >
virtual rad::MsgRequestor2< TREQ, TREP >::~MsgRequestor2 ( )
inlinevirtual
template<typename TREQ , typename TREP >
rad::MsgRequestor2< TREQ, TREP >::MsgRequestor2 ( const MsgRequestor2< TREQ, TREP > &  )
delete
template<typename TREQ , typename TREP >
rad::MsgRequestor2< TREQ, TREP >::MsgRequestor2 ( MsgRequestor2< TREQ, TREP > &&  )
default

Member Function Documentation

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.
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.
template<typename TREQ , typename TREP >
MsgRequestor2& rad::MsgRequestor2< TREQ, TREP >::operator= ( const MsgRequestor2< TREQ, TREP > &  )
delete
template<typename TREQ , typename TREP >
MsgRequestor2& rad::MsgRequestor2< TREQ, TREP >::operator= ( const MsgRequestor2< TREQ, TREP > &  )
delete
template<typename TREQ , typename TREP >
MsgRequestor2& rad::MsgRequestor2< TREQ, TREP >::operator= ( MsgRequestor2< TREQ, TREP > &&  )
default
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 files: