Ignition Transport

API Reference

8.1.0
ReqHandler< google::protobuf::Message, google::protobuf::Message > Class Template Reference

#include <ReqHandler.hh>

Public Member Functions

 ReqHandler (const std::string &_nUuid)
 
void NotifyResult (const std::string &_rep, const bool _result)
 Executes the callback registered for this handler and notify a potential requester waiting on a blocking call. More...
 
virtual std::string RepTypeName () const
 Get the message type name used in the service response. More...
 
virtual std::string ReqTypeName () const
 Get the message type name used in the service request. More...
 
bool Serialize (std::string &_buffer) const
 Serialize the Req protobuf message stored. More...
 
void SetMessage (const google::protobuf::Message *_reqMsg)
 Set the REQ protobuf message for this handler. More...
 
void SetResponse (const google::protobuf::Message *_repMsg)
 Set the REP protobuf message for this handler. More...
 
- Public Member Functions inherited from IReqHandler
 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...
 
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...
 
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. This method uses a condition variable to notify when the response is available. More...
 

Additional Inherited Members

- Public Attributes inherited from IReqHandler
bool 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. More...
 
- Protected Attributes inherited from IReqHandler
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...
 

Constructor & Destructor Documentation

◆ ReqHandler()

ReqHandler ( const std::string _nUuid)
inlineexplicit

Member Function Documentation

◆ NotifyResult()

void NotifyResult ( const std::string _rep,
const bool  _result 
)
inlinevirtual

Executes the callback registered for this handler and notify a potential requester waiting on a blocking call.

Parameters
[in]_repSerialized data containing the response coming from the service call responser.
[in]_resultContains the result of the service call coming from the service call responser.

Implements IReqHandler.

References IReqHandler::condition, condition_variable_any::notify_one(), IReqHandler::rep, IReqHandler::repAvailable, and IReqHandler::result.

◆ RepTypeName()

virtual std::string RepTypeName ( ) const
inlinevirtual

Get the message type name used in the service response.

Returns
Message type name.

Implements IReqHandler.

References std::endl().

◆ ReqTypeName()

virtual std::string ReqTypeName ( ) const
inlinevirtual

Get the message type name used in the service request.

Returns
Message type name.

Implements IReqHandler.

References std::endl().

◆ Serialize()

bool Serialize ( std::string _buffer) const
inlinevirtual

Serialize the Req protobuf message stored.

Parameters
[out]_bufferThe serialized data.
Returns
True if the serialization succeed or false otherwise.

Implements IReqHandler.

References std::endl().

◆ SetMessage()

void SetMessage ( const google::protobuf::Message *  _reqMsg)
inline

Set the REQ protobuf message for this handler.

Parameters
[in]_reqMsgProtofub message containing the input parameters of of the service request.

References std::endl().

◆ SetResponse()

void SetResponse ( const google::protobuf::Message *  _repMsg)
inline

Set the REP protobuf message for this handler.

Parameters
[in]_repMsgProtofub message containing the variable where the result will be stored. The only purpose of this function is to store the type information of _repMsg.

References std::endl().


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