rclcpp  master
C++ ROS Client Library API
Public Types | Public Member Functions | List of all members
rclcpp::Service< ServiceT > Class Template Reference

#include <service.hpp>

Inheritance diagram for rclcpp::Service< ServiceT >:
Inheritance graph
[legend]
Collaboration diagram for rclcpp::Service< ServiceT >:
Collaboration graph
[legend]

Public Types

using CallbackType = std::function< void(const std::shared_ptr< typename ServiceT::Request >, std::shared_ptr< typename ServiceT::Response >)>
 
using CallbackWithHeaderType = std::function< void(const std::shared_ptr< rmw_request_id_t >, const std::shared_ptr< typename ServiceT::Request >, std::shared_ptr< typename ServiceT::Response >)>
 

Public Member Functions

 Service (std::shared_ptr< rcl_node_t > node_handle, const std::string &service_name, AnyServiceCallback< ServiceT > any_callback, rcl_service_options_t &service_options)
 
 Service (std::shared_ptr< rcl_node_t > node_handle, std::shared_ptr< rcl_service_t > service_handle, AnyServiceCallback< ServiceT > any_callback)
 
 Service (std::shared_ptr< rcl_node_t > node_handle, rcl_service_t *service_handle, AnyServiceCallback< ServiceT > any_callback)
 
 Service ()=delete
 
virtual ~Service ()
 
std::shared_ptr< void > create_request ()
 
std::shared_ptr< rmw_request_id_tcreate_request_header ()
 
void handle_request (std::shared_ptr< rmw_request_id_t > request_header, std::shared_ptr< void > request)
 
void send_response (std::shared_ptr< rmw_request_id_t > req_id, std::shared_ptr< typename ServiceT::Response > response)
 
- Public Member Functions inherited from rclcpp::ServiceBase
 ServiceBase (std::shared_ptr< rcl_node_t > node_handle)
 
virtual ~ServiceBase ()
 
const char * get_service_name ()
 
std::shared_ptr< rcl_service_tget_service_handle ()
 
std::shared_ptr< const rcl_service_tget_service_handle () const
 

Additional Inherited Members

- Protected Member Functions inherited from rclcpp::ServiceBase
rcl_node_tget_rcl_node_handle ()
 
const rcl_node_tget_rcl_node_handle () const
 
- Protected Attributes inherited from rclcpp::ServiceBase
std::shared_ptr< rcl_node_tnode_handle_
 
std::shared_ptr< rcl_service_tservice_handle_
 
bool owns_rcl_handle_ = true
 

Member Typedef Documentation

◆ CallbackType

template<typename ServiceT>
using rclcpp::Service< ServiceT >::CallbackType = std::function< void ( const std::shared_ptr<typename ServiceT::Request>, std::shared_ptr<typename ServiceT::Response>)>

◆ CallbackWithHeaderType

template<typename ServiceT>
using rclcpp::Service< ServiceT >::CallbackWithHeaderType = std::function< void ( const std::shared_ptr<rmw_request_id_t>, const std::shared_ptr<typename ServiceT::Request>, std::shared_ptr<typename ServiceT::Response>)>

Constructor & Destructor Documentation

◆ Service() [1/4]

template<typename ServiceT>
rclcpp::Service< ServiceT >::Service ( std::shared_ptr< rcl_node_t node_handle,
const std::string service_name,
AnyServiceCallback< ServiceT >  any_callback,
rcl_service_options_t service_options 
)
inline

◆ Service() [2/4]

template<typename ServiceT>
rclcpp::Service< ServiceT >::Service ( std::shared_ptr< rcl_node_t node_handle,
std::shared_ptr< rcl_service_t service_handle,
AnyServiceCallback< ServiceT >  any_callback 
)
inline

◆ Service() [3/4]

template<typename ServiceT>
rclcpp::Service< ServiceT >::Service ( std::shared_ptr< rcl_node_t node_handle,
rcl_service_t service_handle,
AnyServiceCallback< ServiceT >  any_callback 
)
inline

◆ Service() [4/4]

template<typename ServiceT>
rclcpp::Service< ServiceT >::Service ( )
delete

◆ ~Service()

template<typename ServiceT>
virtual rclcpp::Service< ServiceT >::~Service ( )
inlinevirtual

Member Function Documentation

◆ create_request()

template<typename ServiceT>
std::shared_ptr<void> rclcpp::Service< ServiceT >::create_request ( )
inlinevirtual

Implements rclcpp::ServiceBase.

◆ create_request_header()

template<typename ServiceT>
std::shared_ptr<rmw_request_id_t> rclcpp::Service< ServiceT >::create_request_header ( )
inlinevirtual

Implements rclcpp::ServiceBase.

◆ handle_request()

template<typename ServiceT>
void rclcpp::Service< ServiceT >::handle_request ( std::shared_ptr< rmw_request_id_t request_header,
std::shared_ptr< void >  request 
)
inlinevirtual

Implements rclcpp::ServiceBase.

◆ send_response()

template<typename ServiceT>
void rclcpp::Service< ServiceT >::send_response ( std::shared_ptr< rmw_request_id_t req_id,
std::shared_ptr< typename ServiceT::Response >  response 
)
inline

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