Interface class used to manage a request handler. More...
#include <ignition/transport/ReqHandler.hh>
Public Member Functions | |
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... | |
Public Attributes | |
bool | repAvailable |
When there is a blocking service call request, the call can be unlocked when a service call REP is available. More... | |
Protected Attributes | |
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.
|
inlineexplicit |
Constructor.
[in] | _nUuid | UUID of the node registering the request handler. |
|
virtualdefault |
Destructor.
|
inline |
Returns the unique handler UUID.
|
inline |
Get the node UUID.
|
pure virtual |
Executes the callback registered for this handler and notify a potential requester waiting on a blocking call.
[in] | _rep | Serialized data containing the response coming from the service call responser. |
[in] | _result | Contains the result of the service call coming from the service call responser. |
Implemented in ignition::transport::ReqHandler< google::protobuf::Message, google::protobuf::Message >, and ignition::transport::ReqHandler< Req, Rep >.
|
pure virtual |
Get the message type name used in the service response.
Implemented in ignition::transport::ReqHandler< google::protobuf::Message, google::protobuf::Message >, and ignition::transport::ReqHandler< Req, Rep >.
|
pure virtual |
Get the message type name used in the service request.
Implemented in ignition::transport::ReqHandler< google::protobuf::Message, google::protobuf::Message >, and ignition::transport::ReqHandler< Req, Rep >.
|
inline |
Returns if this service call request has already been requested.
|
inline |
Mark the service call as requested (or not).
[in] | _value | true when you want to flag this REQ as requested. |
|
inline |
Get the service response as raw bytes.
|
inline |
Get the result of the service response.
|
pure virtual |
Serialize the Req protobuf message stored.
[out] | _buffer | The serialized data. |
Implemented in ignition::transport::ReqHandler< google::protobuf::Message, google::protobuf::Message >, and ignition::transport::ReqHandler< Req, Rep >.
|
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.
[in] | _lock | Lock used to protect the condition variable. |
[in] | _timeout | Maximum waiting time in milliseconds. |
|
protected |
Condition variable used to wait until a service call REP is available.
Referenced by ignition::transport::ReqHandler< Req, Rep >::NotifyResult(), and ignition::transport::ReqHandler< google::protobuf::Message, google::protobuf::Message >::NotifyResult().
|
protected |
Unique handler's UUID.
|
protected |
Stores the service response as raw bytes.
Referenced by ignition::transport::ReqHandler< Req, Rep >::NotifyResult(), and ignition::transport::ReqHandler< google::protobuf::Message, google::protobuf::Message >::NotifyResult().
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.
Referenced by ignition::transport::ReqHandler< Req, Rep >::NotifyResult(), and ignition::transport::ReqHandler< google::protobuf::Message, google::protobuf::Message >::NotifyResult().
|
protected |
Stores the result of the service call.
Referenced by ignition::transport::ReqHandler< Req, Rep >::NotifyResult(), and ignition::transport::ReqHandler< google::protobuf::Message, google::protobuf::Message >::NotifyResult().