rclcpp  master
C++ ROS Client Library API
subscription_callback_type_helper.hpp
Go to the documentation of this file.
1 // Copyright 2021 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef RCLCPP__DETAIL__SUBSCRIPTION_CALLBACK_TYPE_HELPER_HPP_
16 #define RCLCPP__DETAIL__SUBSCRIPTION_CALLBACK_TYPE_HELPER_HPP_
17 
18 #include <memory>
19 #include <type_traits>
20 
22 #include "rclcpp/message_info.hpp"
23 
24 namespace rclcpp
25 {
26 namespace detail
27 {
28 
30 
62 template<typename MessageT, typename CallbackT, typename Enable = void>
64 {
66 };
67 
68 template<typename MessageT, typename CallbackT>
70  MessageT,
71  CallbackT,
72  typename std::enable_if_t<
73  rclcpp::function_traits::same_arguments<
74  CallbackT,
75  std::function<void(std::shared_ptr<const MessageT>)>
76  >::value
77  >
78 >
79 {
81 };
82 
83 template<typename MessageT, typename CallbackT>
85  MessageT,
86  CallbackT,
87  typename std::enable_if_t<
88  rclcpp::function_traits::same_arguments<
89  CallbackT,
90  std::function<void(std::shared_ptr<const MessageT>, const rclcpp::MessageInfo &)>
91  >::value
92  >
93 >
94 {
95  using callback_type =
97 };
98 
99 template<typename MessageT, typename CallbackT>
101  MessageT,
102  CallbackT,
103  typename std::enable_if_t<
104  rclcpp::function_traits::same_arguments<
105  CallbackT,
106  std::function<void(const std::shared_ptr<const MessageT> &)>
107  >::value
108  >
109 >
110 {
112 };
113 
114 template<typename MessageT, typename CallbackT>
116  MessageT,
117  CallbackT,
118  typename std::enable_if_t<
119  rclcpp::function_traits::same_arguments<
120  CallbackT,
121  std::function<void(const std::shared_ptr<const MessageT> &, const rclcpp::MessageInfo &)>
122  >::value
123  >
124 >
125 {
126  using callback_type =
128 };
129 
130 template<typename MessageT, typename CallbackT>
132  MessageT,
133  CallbackT,
134  typename std::enable_if_t<
135  rclcpp::function_traits::same_arguments<
136  CallbackT,
137  std::function<void(std::shared_ptr<MessageT>)>
138  >::value
139  >
140 >
141 {
143 };
144 
145 template<typename MessageT, typename CallbackT>
147  MessageT,
148  CallbackT,
149  typename std::enable_if_t<
150  rclcpp::function_traits::same_arguments<
151  CallbackT,
152  std::function<void(std::shared_ptr<MessageT>, const rclcpp::MessageInfo &)>
153  >::value
154  >
155 >
156 {
157  using callback_type =
159 };
160 
161 } // namespace detail
162 } // namespace rclcpp
163 
164 #endif // RCLCPP__DETAIL__SUBSCRIPTION_CALLBACK_TYPE_HELPER_HPP_
rclcpp::function_traits::as_std_function::type
typename detail::as_std_function_helper< typename FunctionTraits::return_type, typename FunctionTraits::arguments >::type type
Definition: function_traits.hpp:188
std::shared_ptr
message_info.hpp
std::function
rclcpp
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
rclcpp::detail::SubscriptionCallbackTypeHelper
Template metaprogramming helper used to resolve the callback argument into a std::function.
Definition: subscription_callback_type_helper.hpp:63
function_traits.hpp
rclcpp::MessageInfo
Additional meta data about messages taken from subscriptions.
Definition: message_info.hpp:26
std
rclcpp::detail::SubscriptionCallbackTypeHelper::callback_type
typename rclcpp::function_traits::as_std_function< CallbackT >::type callback_type
Definition: subscription_callback_type_helper.hpp:65