rad
2.0.0
|
#include <smRequestorRaw.hpp>
Public Member Functions | |
SMRequestorRaw (const std::string &endpoint, const std::string &identity, boost::asio::io_service &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 | |
SMRequestorRaw & | operator= (const SMRequestorRaw &)=delete |
SMRequestorRaw (const std::string &endpoint, const std::string &identity, boost::asio::io_service &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 | |
SMRequestorRaw & | operator= (const SMRequestorRaw &)=delete |
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.
rad::SMRequestorRaw::SMRequestorRaw | ( | const std::string & | endpoint, |
const std::string & | identity, | ||
boost::asio::io_service & | ios, | ||
SMAdapter & | sm, | ||
UniqueEvent && | ok_event, | ||
UniqueEvent && | err_event, | ||
UniqueEvent && | timeout_event | ||
) |
Constructor for the SMRequestorRaw class.
[in] | endpoint | Where to send the request. |
[in] | identity | Identity of the request (used by ZMQ to associated the reply). |
[in] | ios | Reference to the event loop. |
[in] | sm | SM Adapter used to trigger events. |
[in] | ok_event | OK event associated to an OK reply. |
[in] | err_event | ERR event associated to an Error reply. |
[in] | timeout_event | Timeout event associated to a missing reply. |
|
virtual |
Destructor for the SMRequestorRaw class.
|
delete |
rad::SMRequestorRaw::SMRequestorRaw | ( | const std::string & | endpoint, |
const std::string & | identity, | ||
boost::asio::io_service & | ios, | ||
SMAdapter & | sm, | ||
UniqueEvent && | ok_event, | ||
UniqueEvent && | err_event, | ||
UniqueEvent && | timeout_event | ||
) |
|
virtual |
|
delete |
const std::string & rad::SMRequestorRaw::GetReplyPayload | ( | ) |
const std::string& rad::SMRequestorRaw::GetReplyPayload | ( | ) |
const std::string & rad::SMRequestorRaw::GetReplyPayloadType | ( | ) |
const std::string& rad::SMRequestorRaw::GetReplyPayloadType | ( | ) |
|
delete |
|
delete |
void rad::SMRequestorRaw::ReplyHandler | ( | const std::error_code & | err_code, |
const std::string & | msg_type_id, | ||
const void * | data, | ||
const size_t | data_size | ||
) |
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.
[in] | err_code | Error code. |
[in] | msg_type_id | Type of the reply's payload. |
[in] | data | Pointer to the reply's payload. |
[in] | data_size | Size in bytes of the reply's payload. |
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.
[in] | payload_type | Type of the payload to send. |
[in] | payload | Payload to send. |
[in] | timeout | Timeout in msec. |
size_t rad::SMRequestorRaw::Send | ( | const std::string & | payload_type, |
const std::string & | payload, | ||
const long | timeout = 0 |
||
) |