rad 6.2.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rad::SMRequestorRaw Class Reference

#include <smRequestorRaw.hpp>

Public Member Functions

 SMRequestorRaw (const std::string &endpoint, const std::string &identity, boost::asio::io_context &ios, SMAdapter &sm, UniqueEvent &&ok_event, UniqueEvent &&err_event, UniqueEvent &&timeout_event)
 
virtual ~SMRequestorRaw ()
 
size_t Send (const std::string &payload_type, const std::string &payload, const long timeout=0)
 
void ReplyHandler (const std::error_code &err_code, const std::string &msg_type_id, const void *data, const size_t data_size)
 
const std::string & GetReplyPayloadType ()
 
const std::string & GetReplyPayload ()
 
 SMRequestorRaw (const SMRequestorRaw &)=delete
 
SMRequestorRawoperator= (const SMRequestorRaw &)=delete
 

Detailed Description

This class allows to send a request and receive a reply asynchronously. Upon reception of the reply an event OK or ERR event is injected in the SM engine.

Constructor & Destructor Documentation

◆ SMRequestorRaw() [1/2]

rad::SMRequestorRaw::SMRequestorRaw ( const std::string & endpoint,
const std::string & identity,
boost::asio::io_context & ios,
SMAdapter & sm,
UniqueEvent && ok_event,
UniqueEvent && err_event,
UniqueEvent && timeout_event )

Constructor for the SMRequestorRaw class.

Parameters
[in]endpointWhere to send the request.
[in]identityIdentity of the request (used by ZMQ to associated the reply).
[in]iosReference to the event loop.
[in]smSM Adapter used to trigger events.
[in]ok_eventOK event associated to an OK reply.
[in]err_eventERR event associated to an Error reply.
[in]timeout_eventTimeout event associated to a missing reply.

◆ ~SMRequestorRaw()

rad::SMRequestorRaw::~SMRequestorRaw ( )
virtual

Destructor for the SMRequestorRaw class.

◆ SMRequestorRaw() [2/2]

rad::SMRequestorRaw::SMRequestorRaw ( const SMRequestorRaw & )
delete

Member Function Documentation

◆ GetReplyPayload()

const std::string & rad::SMRequestorRaw::GetReplyPayload ( )
Returns
The reply payload.

◆ GetReplyPayloadType()

const std::string & rad::SMRequestorRaw::GetReplyPayloadType ( )
Returns
The reply payload type.

◆ operator=()

SMRequestorRaw & rad::SMRequestorRaw::operator= ( const SMRequestorRaw & )
delete

◆ ReplyHandler()

void rad::SMRequestorRaw::ReplyHandler ( const std::error_code & err_code,
const std::string & msg_type_id,
const void * data,
const size_t data_size )

Handler for raw replies. It is invoked when a reply is received.

Parameters
[in]err_codeError code.
[in]msg_type_idType of the reply's payload.
[in]dataPointer to the reply's payload.
[in]data_sizeSize in bytes of the reply's payload.

◆ Send()

size_t rad::SMRequestorRaw::Send ( const std::string & payload_type,
const std::string & payload,
const long timeout = 0 )

Send a raw request to an endpoint.

Parameters
[in]payload_typeType of the payload to send.
[in]payloadPayload to send.
[in]timeoutTimeout in msec.
Returns
The size in bytes of the request sent, 0 in case of errors.

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