Gazebo Transport

API Reference

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

Additional Inherited Members

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

Detailed Description

template<typename Req, typename Rep>
class gz::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()

template<typename Req , typename Rep >
RepHandler ( )
default

Member Function Documentation

◆ RepTypeName()

template<typename Req , typename Rep >
virtual std::string RepTypeName ( ) const
inlinevirtual

Get the message type name used in the service response.

Returns
Message type name.

Implements IRepHandler.

◆ ReqTypeName()

template<typename Req , typename Rep >
virtual std::string ReqTypeName ( ) const
inlinevirtual

Get the message type name used in the service request.

Returns
Message type name.

Implements IRepHandler.

◆ RunCallback()

template<typename Req , typename Rep >
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()

template<typename Req , typename Rep >
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()

template<typename Req , typename Rep >
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: