Go to the documentation of this file.
29 #ifndef ROSCPP_SERVICE_MESSAGE_HELPER_H
30 #define ROSCPP_SERVICE_MESSAGE_HELPER_H
32 #include "ros/forwards.h"
33 #include "ros/common.h"
34 #include "ros/message.h"
35 #include "ros/message_traits.h"
36 #include "ros/service_traits.h"
37 #include "ros/serialization.h"
54 return std::make_shared<M>();
57 template<
typename MReq,
typename MRes>
70 template<
typename MReq,
typename MRes>
86 ServiceEvent(
const std::shared_ptr<MReq const>& req,
const std::shared_ptr<MRes>& res,
const std::shared_ptr<M_string>& connection_header)
115 template<
typename MReq,
typename MRes>
146 template<
typename Spec>
162 static_cast<RequestPtr(*)()
>(defaultServiceCreateFunction<RequestType>),
164 static_cast<ResponsePtr(*)()
>(defaultServiceCreateFunction<ResponseType>))
173 namespace ser = serialization;
177 ser::deserializeMessage(params.
request, *req);
184 params.
response = ser::serializeServiceResponse(
ok, *res);
196 #endif // ROSCPP_SERVICE_MESSAGE_HELPER_H
Concrete generic implementation of ServiceCallbackHelper for any normal service type.
std::shared_ptr< MRes > response
std::shared_ptr< RequestType > RequestPtr
Spec::ResponsePtr ResponsePtr
std::shared_ptr< RequestType > RequestPtr
std::shared_ptr< M > defaultServiceCreateFunction()
std::shared_ptr< M_string > connection_header
const RequestType & getRequest() const
Returns a const-reference to the request.
std::map< std::string, std::string > M_string
ReqCreateFunction create_req_
SerializedMessage request
const std::string & getCallerName() const
Returns the name of the node which called this service.
std::shared_ptr< M_string > connection_header_
Abstract base class used by service servers to deal with concrete message types through a common inte...
Event type for services, ros::ServiceEvent<MReq, MRes>& can be used in your callback instead of MReq&...
static bool call(const CallbackType &cb, ServiceSpecCallParams< RequestType, ResponseType > ¶ms)
std::function< bool(ServiceEvent< RequestType, ResponseType > &)> CallbackType
std::function< bool(RequestType &, ResponseType &)> CallbackType
Spec::ResponseType ResponseType
std::shared_ptr< MReq > request
std::shared_ptr< ResponseType > ResponsePtr
Spec::RequestType RequestType
static bool call(const CallbackType &cb, ServiceSpecCallParams< RequestType, ResponseType > ¶ms)
std::shared_ptr< ResponseType > ResponsePtr
std::shared_ptr< RequestType const > request_
ResponseType & getResponse() const
Returns a non-const reference to the response.
ServiceEvent(const std::shared_ptr< MReq const > &req, const std::shared_ptr< MRes > &res, const std::shared_ptr< M_string > &connection_header)
SerializedMessage response
std::function< ResponsePtr()> ResCreateFunction
virtual ~ServiceCallbackHelper()
std::shared_ptr< ServiceCallbackHelper > ServiceCallbackHelperPtr
std::shared_ptr< M_string > connection_header
Spec::RequestPtr RequestPtr
ServiceCallbackHelperT(const Callback &callback, const ReqCreateFunction &create_req=static_cast< RequestPtr(*)()>(defaultServiceCreateFunction< RequestType >), const ResCreateFunction &create_res=static_cast< ResponsePtr(*)()>(defaultServiceCreateFunction< ResponseType >))
M_string & getConnectionHeader() const
Returns a reference to the connection header.
ResCreateFunction create_res_
Spec::CallbackType Callback
ROSCPP_DECL bool ok()
Check whether it's time to exit.
bool call(const std::string &service_name, MReq &req, MRes &res)
Invoke an RPC service.
virtual bool call(ServiceCallbackHelperCallParams ¶ms)
std::shared_ptr< ResponseType > response_
void callback(const sick_scan_xd::RadarScan::ConstPtr &oa)
std::function< RequestPtr()> ReqCreateFunction
sick_scan_xd
Author(s): Michael Lehning
, Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:10