15 #ifndef RCLCPP__ANY_SERVICE_CALLBACK_HPP_ 16 #define RCLCPP__ANY_SERVICE_CALLBACK_HPP_ 21 #include <type_traits> 30 namespace any_service_callback
33 template<
typename ServiceT>
52 : shared_ptr_callback_(nullptr), shared_ptr_with_request_header_callback_(nullptr)
66 void set(CallbackT callback)
68 shared_ptr_callback_ = callback;
80 void set(CallbackT callback)
82 shared_ptr_with_request_header_callback_ = callback;
90 if (shared_ptr_callback_ !=
nullptr) {
92 shared_ptr_callback_(request, response);
93 }
else if (shared_ptr_with_request_header_callback_ !=
nullptr) {
94 shared_ptr_with_request_header_callback_(request_header, request, response);
104 #endif // RCLCPP__ANY_SERVICE_CALLBACK_HPP_ void dispatch(std::shared_ptr< rmw_request_id_t > request_header, std::shared_ptr< typename ServiceT::Request > request, std::shared_ptr< typename ServiceT::Response > response)
Definition: any_service_callback.hpp:85
AnyServiceCallback()
Definition: any_service_callback.hpp:51
Definition: allocator_common.hpp:24
Definition: function_traits.hpp:141
Definition: any_service_callback.hpp:34