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::MsgRequestorRaw2 Struct Reference

#include <msgRequestorRaw.hpp>

Public Types

using handler_t = std::function< void(const std::error_code &, std::string const &, const void *, const size_t)>
 
using handler_t = std::function< void(const std::error_code &, std::string const &, const void *, const size_t)>
 

Public Member Functions

 MsgRequestorRaw2 (const std::string &endpoint, const std::string &identity, boost::asio::io_service &io_ctx)
 
 ~MsgRequestorRaw2 ()
 
size_t AsyncSendReceive (std::string const &payload_type, std::string const &payload, handler_t handler, std::chrono::milliseconds const timeout=std::chrono::milliseconds(0))
 
size_t AsyncSend (std::string const &payload_type, std::string const &payload)
 
void AsyncReceive (handler_t handler, std::chrono::milliseconds const timeout=std::chrono::milliseconds(0))
 
void Cancel () noexcept
 
 MsgRequestorRaw2 (const MsgRequestorRaw2 &)=delete
 
MsgRequestorRaw2operator= (const MsgRequestorRaw2 &)=delete
 
 MsgRequestorRaw2 (MsgRequestorRaw2 &&)=default
 
MsgRequestorRaw2operator= (MsgRequestorRaw2 &&)=default
 
 MsgRequestorRaw2 (const std::string &endpoint, const std::string &identity, boost::asio::io_service &io_ctx)
 
 ~MsgRequestorRaw2 ()
 
size_t AsyncSendReceive (std::string const &payload_type, std::string const &payload, handler_t handler, std::chrono::milliseconds const timeout=std::chrono::milliseconds(0))
 
size_t AsyncSend (std::string const &payload_type, std::string const &payload)
 
void AsyncReceive (handler_t handler, std::chrono::milliseconds const timeout=std::chrono::milliseconds(0))
 
void Cancel () noexcept
 
 MsgRequestorRaw2 (const MsgRequestorRaw2 &)=delete
 
MsgRequestorRaw2operator= (const MsgRequestorRaw2 &)=delete
 
 MsgRequestorRaw2 (MsgRequestorRaw2 &&)=default
 
MsgRequestorRaw2operator= (MsgRequestorRaw2 &&)=default
 

Detailed Description

Send requests and receive reply asynchrously.

Only one Async[Send]Receive operation may be live at any one point.

Warning
MsgRequestorRaw2 must not be destroyed from within a registered handler. This may lead to recursive cancellation of socket and deadlock.

Member Typedef Documentation

using rad::MsgRequestorRaw2::handler_t = std::function<void(const std::error_code& , std::string const& , const void* , const size_t )>
using rad::MsgRequestorRaw2::handler_t = std::function<void(const std::error_code& , std::string const& , const void* , const size_t )>

Constructor & Destructor Documentation

rad::MsgRequestorRaw2::MsgRequestorRaw2 ( const std::string &  endpoint,
const std::string &  identity,
boost::asio::io_service &  io_ctx 
)
Parameters
[in]endpointAddress of the request destination process.
[in]identityIdentity of the originator of the request.
[in]io_ctxReference to the event loop.

Constructor for the MsgRequestorRaw2 class.

Parameters
[in]endpointAddress of the request destination process.
[in]identityIdentity of the originator of the request.
[in]io_ctxReference to the event loop.
rad::MsgRequestorRaw2::~MsgRequestorRaw2 ( )

Deleting object will cancel pending socket operations.

Destructor for the MsgRequestorRaw2 class.

rad::MsgRequestorRaw2::MsgRequestorRaw2 ( const MsgRequestorRaw2 )
delete
rad::MsgRequestorRaw2::MsgRequestorRaw2 ( MsgRequestorRaw2 &&  )
default
rad::MsgRequestorRaw2::MsgRequestorRaw2 ( const std::string &  endpoint,
const std::string &  identity,
boost::asio::io_service &  io_ctx 
)
Parameters
[in]endpointAddress of the request destination process.
[in]identityIdentity of the originator of the request.
[in]io_ctxReference to the event loop.
rad::MsgRequestorRaw2::~MsgRequestorRaw2 ( )

Deleting object will cancel pending socket operations.

rad::MsgRequestorRaw2::MsgRequestorRaw2 ( const MsgRequestorRaw2 )
delete
rad::MsgRequestorRaw2::MsgRequestorRaw2 ( MsgRequestorRaw2 &&  )
default

Member Function Documentation

void rad::MsgRequestorRaw2::AsyncReceive ( MsgRequestorRaw2::handler_t  handler,
std::chrono::milliseconds const  timeout = std::chrono::milliseconds(0) 
)

Receive a response message from endpoint.

Note
: If operation times out, handler will be called with rad::ErrorCodes::REPLY_TIMEOUT and any pending socket operations will be cancelled. Replies may still be received after this point and further attempts to receive the reply may be perfomed by calling AsyncReceive.
Parameters
handlerCompletion handler for the asynchronous operation.
timeoutRequest timeout.
Returns
The number of bytes sent.
void rad::MsgRequestorRaw2::AsyncReceive ( handler_t  handler,
std::chrono::milliseconds const  timeout = std::chrono::milliseconds(0) 
)

Receive a response message from endpoint.

Note
: If operation times out, handler will be called with rad::ErrorCodes::REPLY_TIMEOUT and any pending socket operations will be cancelled. Replies may still be received after this point and further attempts to receive the reply may be perfomed by calling AsyncReceive.
Parameters
handlerCompletion handler for the asynchronous operation.
timeoutRequest timeout.
Returns
The number of bytes sent.
size_t rad::MsgRequestorRaw2::AsyncSend ( std::string const &  payload_type,
std::string const &  payload 
)

Send ZMQ message.

Returns
Number of bytes sent. Send a request message to the endpoint.
Parameters
payload_typeType of the request's payload.
payloadRequest's payload.
Returns
The number of bytes sent.
size_t rad::MsgRequestorRaw2::AsyncSend ( std::string const &  payload_type,
std::string const &  payload 
)

Send ZMQ message.

Returns
Number of bytes sent. Send a request message to the endpoint.
Parameters
payload_typeType of the request's payload.
payloadRequest's payload.
Returns
The number of bytes sent.
size_t rad::MsgRequestorRaw2::AsyncSendReceive ( std::string const &  payload_type,
std::string const &  payload,
handler_t  handler,
std::chrono::milliseconds const  timeout = std::chrono::milliseconds(0) 
)

Send a request message to an destination process and receive reply. This is a convenience function and is equivalent to calling AsyncSend and then AsyncReceive.

See AsyncSend and AsyncReceive for parameters.

size_t rad::MsgRequestorRaw2::AsyncSendReceive ( std::string const &  payload_type,
std::string const &  payload,
handler_t  handler,
std::chrono::milliseconds const  timeout = std::chrono::milliseconds(0) 
)

Send a request message to an destination process and receive reply. This is a convenience function and is equivalent to calling AsyncSend and then AsyncReceive.

See AsyncSend and AsyncReceive for parameters.

void rad::MsgRequestorRaw2::Cancel ( )
noexcept

Cancels pending asynchronous operations.

Cancel any pending request/reply transaction.

void rad::MsgRequestorRaw2::Cancel ( )
noexcept

Cancels pending asynchronous operations.

MsgRequestorRaw2& rad::MsgRequestorRaw2::operator= ( const MsgRequestorRaw2 )
delete
MsgRequestorRaw2& rad::MsgRequestorRaw2::operator= ( const MsgRequestorRaw2 )
delete
MsgRequestorRaw2& rad::MsgRequestorRaw2::operator= ( MsgRequestorRaw2 &&  )
default
MsgRequestorRaw2& rad::MsgRequestorRaw2::operator= ( MsgRequestorRaw2 &&  )
default

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