15 #ifndef RCLCPP__ANY_SERVICE_CALLBACK_HPP_ 16 #define RCLCPP__ANY_SERVICE_CALLBACK_HPP_ 21 #include <type_traits> 30 template<
typename ServiceT>
51 : shared_ptr_callback_(nullptr), shared_ptr_with_request_header_callback_(nullptr)
65 void set(CallbackT callback)
67 shared_ptr_callback_ = callback;
75 SharedPtrWithRequestHeaderCallback
79 void set(CallbackT callback)
81 shared_ptr_with_request_header_callback_ = callback;
89 if (shared_ptr_callback_ !=
nullptr) {
91 shared_ptr_callback_(request, response);
92 }
else if (shared_ptr_with_request_header_callback_ !=
nullptr) {
93 shared_ptr_with_request_header_callback_(request_header, request, response);
102 #endif // RCLCPP__ANY_SERVICE_CALLBACK_HPP_
Definition: allocator_common.hpp:24
AnyServiceCallback()
Definition: any_service_callback.hpp:50
Definition: function_traits.hpp:143
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:84
Definition: any_service_callback.hpp:31