ROS 2 rclcpp + rcl - humble  humble
ROS 2 C++ Client Library with ROS Client Library
node_topics_interface.hpp
1 // Copyright 2016 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_TOPICS_INTERFACE_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_TOPICS_INTERFACE_HPP_
17 
18 #include <functional>
19 #include <memory>
20 #include <string>
21 
22 #include "rcl/publisher.h"
23 #include "rcl/subscription.h"
24 
25 #include "rclcpp/callback_group.hpp"
26 #include "rclcpp/macros.hpp"
27 #include "rclcpp/node_interfaces/detail/node_interfaces_helpers.hpp"
28 #include "rclcpp/node_interfaces/node_base_interface.hpp"
29 #include "rclcpp/node_interfaces/node_timers_interface.hpp"
30 #include "rclcpp/publisher.hpp"
31 #include "rclcpp/publisher_factory.hpp"
32 #include "rclcpp/subscription.hpp"
33 #include "rclcpp/subscription_factory.hpp"
34 #include "rclcpp/visibility_control.hpp"
35 
36 namespace rclcpp
37 {
38 namespace node_interfaces
39 {
40 
43 {
44 public:
45  RCLCPP_SMART_PTR_ALIASES_ONLY(NodeTopicsInterface)
46 
47  RCLCPP_PUBLIC
48  virtual
49  ~NodeTopicsInterface() = default;
50 
51  RCLCPP_PUBLIC
52  virtual
53  rclcpp::PublisherBase::SharedPtr
54  create_publisher(
55  const std::string & topic_name,
56  const rclcpp::PublisherFactory & publisher_factory,
57  const rclcpp::QoS & qos) = 0;
58 
59  RCLCPP_PUBLIC
60  virtual
61  void
62  add_publisher(
63  rclcpp::PublisherBase::SharedPtr publisher,
64  rclcpp::CallbackGroup::SharedPtr callback_group) = 0;
65 
66  RCLCPP_PUBLIC
67  virtual
68  rclcpp::SubscriptionBase::SharedPtr
69  create_subscription(
70  const std::string & topic_name,
71  const rclcpp::SubscriptionFactory & subscription_factory,
72  const rclcpp::QoS & qos) = 0;
73 
74  RCLCPP_PUBLIC
75  virtual
76  void
77  add_subscription(
78  rclcpp::SubscriptionBase::SharedPtr subscription,
79  rclcpp::CallbackGroup::SharedPtr callback_group) = 0;
80 
81  RCLCPP_PUBLIC
82  virtual
84  get_node_base_interface() const = 0;
85 
86  RCLCPP_PUBLIC
87  virtual
89  get_node_timers_interface() const = 0;
90 
92  RCLCPP_PUBLIC
93  virtual
94  std::string
95  resolve_topic_name(const std::string & name, bool only_expand = false) const = 0;
96 };
97 
98 } // namespace node_interfaces
99 } // namespace rclcpp
100 
101 RCLCPP_NODE_INTERFACE_HELPERS_SUPPORT(rclcpp::node_interfaces::NodeTopicsInterface, topics)
102 
103 #endif // RCLCPP__NODE_INTERFACES__NODE_TOPICS_INTERFACE_HPP_
Encapsulation of Quality of Service settings.
Definition: qos.hpp:111
Pure virtual interface class for the NodeBase part of the Node API.
Pure virtual interface class for the NodeTimers part of the Node API.
Pure virtual interface class for the NodeTopics part of the Node API.
virtual RCLCPP_PUBLIC std::string resolve_topic_name(const std::string &name, bool only_expand=false) const =0
Get a remapped and expanded topic name given an input name.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Factory with functions used to create a MessageT specific PublisherT.
Factory containing a function used to create a Subscription<MessageT>.