Interface class used to manage a request handler.
More...
#include <ignition/transport/ReqHandler.hh>
|
| IReqHandler (const std::string &_nUuid) |
| Constructor. More...
|
|
virtual | ~IReqHandler ()=default |
| Destructor. More...
|
|
std::string | HandlerUuid () const |
| Returns the unique handler UUID. More...
|
|
std::string | NodeUuid () const |
| Get the node UUID. More...
|
|
virtual void | NotifyResult (const std::string &_rep, const bool _result)=0 |
| Executes the callback registered for this handler and notify a potential requester waiting on a blocking call. More...
|
|
virtual std::string | RepTypeName () const =0 |
| Get the message type name used in the service response. More...
|
|
virtual std::string | ReqTypeName () const =0 |
| Get the message type name used in the service request. More...
|
|
bool | Requested () const |
| Returns if this service call request has already been requested. More...
|
|
void | Requested (const bool _value) |
| Mark the service call as requested (or not). More...
|
|
std::string | Response () const |
| Get the service response as raw bytes. More...
|
|
bool | Result () const |
| Get the result of the service response. More...
|
|
virtual bool | Serialize (std::string &_buffer) const =0 |
| Serialize the Req protobuf message stored. More...
|
|
template<typename Lock > |
bool | WaitUntil (Lock &_lock, const unsigned int _timeout) |
| Block the current thread until the response to the service request is available or until the timeout expires. More...
|
|
|
bool | repAvailable |
| When there is a blocking service call request, the call can be unlocked when a service call REP is available. More...
|
|
|
std::condition_variable_any | condition |
| Condition variable used to wait until a service call REP is available. More...
|
|
std::string | hUuid |
| Unique handler's UUID. More...
|
|
std::string | rep |
| Stores the service response as raw bytes. More...
|
|
bool | result |
| Stores the result of the service call. More...
|
|
Interface class used to manage a request handler.
§ IReqHandler()
ignition::transport::IReqHandler::IReqHandler |
( |
const std::string & |
_nUuid | ) |
|
|
inlineexplicit |
Constructor.
- Parameters
-
[in] | _nUuid | UUID of the node registering the request handler. |
§ ~IReqHandler()
virtual ignition::transport::IReqHandler::~IReqHandler |
( |
| ) |
|
|
virtualdefault |
§ HandlerUuid()
std::string ignition::transport::IReqHandler::HandlerUuid |
( |
| ) |
const |
|
inline |
Returns the unique handler UUID.
- Returns
- The handler's UUID.
§ NodeUuid()
std::string ignition::transport::IReqHandler::NodeUuid |
( |
| ) |
const |
|
inline |
Get the node UUID.
- Returns
- The string representation of the node UUID.
§ NotifyResult()
virtual void ignition::transport::IReqHandler::NotifyResult |
( |
const std::string & |
_rep, |
|
|
const bool |
_result |
|
) |
| |
|
pure virtual |
§ RepTypeName()
virtual std::string ignition::transport::IReqHandler::RepTypeName |
( |
| ) |
const |
|
pure virtual |
§ ReqTypeName()
virtual std::string ignition::transport::IReqHandler::ReqTypeName |
( |
| ) |
const |
|
pure virtual |
§ Requested() [1/2]
bool ignition::transport::IReqHandler::Requested |
( |
| ) |
const |
|
inline |
Returns if this service call request has already been requested.
- Returns
- True when the service call has been requested.
§ Requested() [2/2]
void ignition::transport::IReqHandler::Requested |
( |
const bool |
_value | ) |
|
|
inline |
Mark the service call as requested (or not).
- Parameters
-
[in] | _value | true when you want to flag this REQ as requested. |
§ Response()
std::string ignition::transport::IReqHandler::Response |
( |
| ) |
const |
|
inline |
Get the service response as raw bytes.
- Returns
- The string containing the service response.
§ Result()
bool ignition::transport::IReqHandler::Result |
( |
| ) |
const |
|
inline |
Get the result of the service response.
- Returns
- The boolean result.
§ Serialize()
virtual bool ignition::transport::IReqHandler::Serialize |
( |
std::string & |
_buffer | ) |
const |
|
pure virtual |
§ WaitUntil()
template<typename Lock >
bool ignition::transport::IReqHandler::WaitUntil |
( |
Lock & |
_lock, |
|
|
const unsigned int |
_timeout |
|
) |
| |
|
inline |
Block the current thread until the response to the service request is available or until the timeout expires.
This method uses a condition variable to notify when the response is available.
- Parameters
-
[in] | _lock | Lock used to protect the condition variable. |
[in] | _timeout | Maximum waiting time in milliseconds. |
- Returns
- True if the service call was executed or false otherwise.
§ condition
std::condition_variable_any ignition::transport::IReqHandler::condition |
|
protected |
Condition variable used to wait until a service call REP is available.
§ hUuid
std::string ignition::transport::IReqHandler::hUuid |
|
protected |
§ rep
std::string ignition::transport::IReqHandler::rep |
|
protected |
Stores the service response as raw bytes.
§ repAvailable
bool ignition::transport::IReqHandler::repAvailable |
When there is a blocking service call request, the call can be unlocked when a service call REP is available.
This variable captures if we have found a node that can satisty our request.
§ result
bool ignition::transport::IReqHandler::result |
|
protected |
Stores the result of the service call.
The documentation for this class was generated from the following file: