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/node_base_interface.hpp"
28 #include "rclcpp/node_interfaces/node_timers_interface.hpp"
29 #include "rclcpp/publisher.hpp"
30 #include "rclcpp/publisher_factory.hpp"
31 #include "rclcpp/subscription.hpp"
32 #include "rclcpp/subscription_factory.hpp"
33 #include "rclcpp/visibility_control.hpp"
34 
35 namespace rclcpp
36 {
37 namespace node_interfaces
38 {
39 
42 {
43 public:
44  RCLCPP_SMART_PTR_ALIASES_ONLY(NodeTopicsInterface)
45 
46  RCLCPP_PUBLIC
47  virtual
48  ~NodeTopicsInterface() = default;
49 
50  RCLCPP_PUBLIC
51  virtual
52  rclcpp::PublisherBase::SharedPtr
53  create_publisher(
54  const std::string & topic_name,
55  const rclcpp::PublisherFactory & publisher_factory,
56  const rclcpp::QoS & qos) = 0;
57 
58  RCLCPP_PUBLIC
59  virtual
60  void
61  add_publisher(
62  rclcpp::PublisherBase::SharedPtr publisher,
63  rclcpp::CallbackGroup::SharedPtr callback_group) = 0;
64 
65  RCLCPP_PUBLIC
66  virtual
67  rclcpp::SubscriptionBase::SharedPtr
68  create_subscription(
69  const std::string & topic_name,
70  const rclcpp::SubscriptionFactory & subscription_factory,
71  const rclcpp::QoS & qos) = 0;
72 
73  RCLCPP_PUBLIC
74  virtual
75  void
76  add_subscription(
77  rclcpp::SubscriptionBase::SharedPtr subscription,
78  rclcpp::CallbackGroup::SharedPtr callback_group) = 0;
79 
80  RCLCPP_PUBLIC
81  virtual
83  get_node_base_interface() const = 0;
84 
85  RCLCPP_PUBLIC
86  virtual
88  get_node_timers_interface() const = 0;
89 
91  RCLCPP_PUBLIC
92  virtual
93  std::string
94  resolve_topic_name(const std::string & name, bool only_expand = false) const = 0;
95 };
96 
97 } // namespace node_interfaces
98 } // namespace rclcpp
99 
100 #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>.