ROS 2 rclcpp + rcl - rolling  rolling-a919a6e5
ROS 2 C++ Client Library with ROS Client Library
node_interfaces.hpp
1 // Copyright 2022 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__NODE_INTERFACES__NODE_INTERFACES_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_INTERFACES_HPP_
17 
18 #include <memory>
19 
20 #include "rclcpp/detail/template_unique.hpp"
21 #include "rclcpp/node_interfaces/detail/node_interfaces_helpers.hpp"
22 
23 #define ALL_RCLCPP_NODE_INTERFACES \
24  rclcpp::node_interfaces::NodeBaseInterface, \
25  rclcpp::node_interfaces::NodeClockInterface, \
26  rclcpp::node_interfaces::NodeGraphInterface, \
27  rclcpp::node_interfaces::NodeLoggingInterface, \
28  rclcpp::node_interfaces::NodeParametersInterface, \
29  rclcpp::node_interfaces::NodeServicesInterface, \
30  rclcpp::node_interfaces::NodeTimeSourceInterface, \
31  rclcpp::node_interfaces::NodeTimersInterface, \
32  rclcpp::node_interfaces::NodeTopicsInterface, \
33  rclcpp::node_interfaces::NodeTypeDescriptionsInterface, \
34  rclcpp::node_interfaces::NodeWaitablesInterface
35 
36 
37 namespace rclcpp
38 {
39 namespace node_interfaces
40 {
41 
42 
44 template<typename ... InterfaceTs>
47  detail::NodeInterfacesStorage<InterfaceTs ...>,
48  InterfaceTs ...
49  >,
51  detail::NodeInterfacesStorage<InterfaceTs ...>,
52  InterfaceTs ...
53  >
54 {
55  static_assert(
56  0 != sizeof ...(InterfaceTs),
57  "must provide at least one interface as a template argument");
58  static_assert(
59  rclcpp::detail::template_unique_v<InterfaceTs ...>,
60  "must provide unique template parameters");
61 
63  detail::NodeInterfacesStorage<InterfaceTs ...>,
64  InterfaceTs ...
65  >;
66 
67 public:
69 
149  template<typename NodeT>
150  NodeInterfaces(NodeT & node) // NOLINT(runtime/explicit)
152  {}
153 
154  // Create a NodeInterfaces object with no bound interfaces
156  : NodeInterfacesSupportsT()
157  {}
158 
159  explicit NodeInterfaces(std::shared_ptr<InterfaceTs>... args)
160  : NodeInterfacesSupportsT(args ...)
161  {}
162 };
163 
164 
165 } // namespace node_interfaces
166 } // namespace rclcpp
167 
168 #endif // RCLCPP__NODE_INTERFACES__NODE_INTERFACES_HPP_
A helper class for aggregating node interfaces.
NodeInterfaces(NodeT &node)
Create a new NodeInterfaces object using the given node-like object's interfaces.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Stores the interfaces in a tuple, provides constructors, and getters.
Prototype of NodeInterfacesSupportCheck template meta-function.