Gazebo Transport

API Reference

8.5.0
RepHandler< Req, Rep > Class Template Reference

with the service response. More...

#include <RepHandler.hh>

Public Member Functions

 RepHandler ()=default
 
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 RunCallback (const std::string &_req, std::string &_rep)
 Executes the callback registered for this handler. More...
 
bool RunLocalCallback (const transport::ProtoMsg &_msgReq, transport::ProtoMsg &_msgRep)
 Executes the local callback registered for this handler. More...
 
void SetCallback (const std::function< bool(const Req &, Rep &)> &_cb)
 Set the callback for this handler. More...
 
- Public Member Functions inherited from IRepHandler
 IRepHandler ()
 Constructor. More...
 
virtual ~IRepHandler ()=default
 Destructor. More...
 
std::string HandlerUuid () const
 Get the unique UUID of this handler. More...
 

Additional Inherited Members

- Protected Attributes inherited from IRepHandler
std::string hUuid
 Unique handler's UUID. More...
 

Detailed Description

template<typename Req, typename Rep>
class ignition::transport::RepHandler< Req, Rep >

with the service response.

It creates a service reply handler for a pair of protobuf messages containing the request parameters and the response. 'Req' is the protobuf message type containing the input parameters of.

Constructor & Destructor Documentation

◆ RepHandler()

RepHandler ( )
default

Member Function Documentation

◆ RepTypeName()

virtual std::string RepTypeName ( ) const
inlinevirtual

Get the message type name used in the service response.

Returns
Message type name.

Implements IRepHandler.

◆ ReqTypeName()

virtual std::string ReqTypeName ( ) const
inlinevirtual

Get the message type name used in the service request.

Returns
Message type name.

Implements IRepHandler.

◆ RunCallback()

bool RunCallback ( const std::string _req,
std::string _rep 
)
inlinevirtual

Executes the callback registered for this handler.

Parameters
[in]_reqSerialized data received. The data will be used to compose a specific protobuf message and will be passed to the callback function.
[out]_repOut parameter with the data serialized.
Returns
Service call result.

Implements IRepHandler.

References std::endl().

◆ RunLocalCallback()

bool RunLocalCallback ( const transport::ProtoMsg _msgReq,
transport::ProtoMsg _msgRep 
)
inlinevirtual

Executes the local callback registered for this handler.

Parameters
[in]_msgReqInput parameter (Protobuf message).
[out]_msgRepOutput parameter (Protobuf message).
Returns
Service call result.

Implements IRepHandler.

References std::endl().

◆ SetCallback()

void SetCallback ( const std::function< bool(const Req &, Rep &)> &  _cb)
inline

Set the callback for this handler.

Parameters
[in]_cbThe callback with the following parameters:
  • _req Protobuf message containing the service request params
  • _rep Protobuf message containing the service response.
  • Returns true when the service response is considered successful or false otherwise.

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