.. _program_listing_file_include_rclcpp_detail_subscription_callback_type_helper.hpp: Program Listing for File subscription_callback_type_helper.hpp ============================================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/rclcpp/detail/subscription_callback_type_helper.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2021 Open Source Robotics Foundation, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef RCLCPP__DETAIL__SUBSCRIPTION_CALLBACK_TYPE_HELPER_HPP_ #define RCLCPP__DETAIL__SUBSCRIPTION_CALLBACK_TYPE_HELPER_HPP_ #include #include #include "rclcpp/function_traits.hpp" #include "rclcpp/message_info.hpp" namespace rclcpp { namespace detail { template struct SubscriptionCallbackTypeHelper { using callback_type = typename rclcpp::function_traits::as_std_function::type; }; template struct SubscriptionCallbackTypeHelper< MessageT, CallbackT, typename std::enable_if_t< rclcpp::function_traits::same_arguments< CallbackT, std::function)> >::value > > { using callback_type = std::function)>; }; template struct SubscriptionCallbackTypeHelper< MessageT, CallbackT, typename std::enable_if_t< rclcpp::function_traits::same_arguments< CallbackT, std::function, const rclcpp::MessageInfo &)> >::value > > { using callback_type = std::function, const rclcpp::MessageInfo &)>; }; template struct SubscriptionCallbackTypeHelper< MessageT, CallbackT, typename std::enable_if_t< rclcpp::function_traits::same_arguments< CallbackT, std::function &)> >::value > > { using callback_type = std::function &)>; }; template struct SubscriptionCallbackTypeHelper< MessageT, CallbackT, typename std::enable_if_t< rclcpp::function_traits::same_arguments< CallbackT, std::function &, const rclcpp::MessageInfo &)> >::value > > { using callback_type = std::function &, const rclcpp::MessageInfo &)>; }; template struct SubscriptionCallbackTypeHelper< MessageT, CallbackT, typename std::enable_if_t< rclcpp::function_traits::same_arguments< CallbackT, std::function)> >::value > > { using callback_type = std::function)>; }; template struct SubscriptionCallbackTypeHelper< MessageT, CallbackT, typename std::enable_if_t< rclcpp::function_traits::same_arguments< CallbackT, std::function, const rclcpp::MessageInfo &)> >::value > > { using callback_type = std::function, const rclcpp::MessageInfo &)>; }; } // namespace detail } // namespace rclcpp #endif // RCLCPP__DETAIL__SUBSCRIPTION_CALLBACK_TYPE_HELPER_HPP_