ROS 2 rclcpp + rcl - jazzy  jazzy
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 <string>
19 
20 #include "rcl/publisher.h"
21 #include "rcl/subscription.h"
22 
23 #include "rclcpp/callback_group.hpp"
24 #include "rclcpp/macros.hpp"
25 #include "rclcpp/node_interfaces/detail/node_interfaces_helpers.hpp"
26 #include "rclcpp/node_interfaces/node_base_interface.hpp"
27 #include "rclcpp/node_interfaces/node_timers_interface.hpp"
28 #include "rclcpp/publisher.hpp"
29 #include "rclcpp/publisher_factory.hpp"
30 #include "rclcpp/subscription.hpp"
31 #include "rclcpp/subscription_factory.hpp"
32 #include "rclcpp/visibility_control.hpp"
33 
34 namespace rclcpp
35 {
36 namespace node_interfaces
37 {
38 
41 {
42 public:
43  RCLCPP_SMART_PTR_ALIASES_ONLY(NodeTopicsInterface)
44 
45  RCLCPP_PUBLIC
46  virtual
47  ~NodeTopicsInterface() = default;
48 
49  RCLCPP_PUBLIC
50  virtual
51  rclcpp::PublisherBase::SharedPtr
52  create_publisher(
53  const std::string & topic_name,
54  const rclcpp::PublisherFactory & publisher_factory,
55  const rclcpp::QoS & qos) = 0;
56 
57  RCLCPP_PUBLIC
58  virtual
59  void
60  add_publisher(
61  rclcpp::PublisherBase::SharedPtr publisher,
62  rclcpp::CallbackGroup::SharedPtr callback_group) = 0;
63 
64  RCLCPP_PUBLIC
65  virtual
66  rclcpp::SubscriptionBase::SharedPtr
67  create_subscription(
68  const std::string & topic_name,
69  const rclcpp::SubscriptionFactory & subscription_factory,
70  const rclcpp::QoS & qos) = 0;
71 
72  RCLCPP_PUBLIC
73  virtual
74  void
75  add_subscription(
76  rclcpp::SubscriptionBase::SharedPtr subscription,
77  rclcpp::CallbackGroup::SharedPtr callback_group) = 0;
78 
79  RCLCPP_PUBLIC
80  virtual
82  get_node_base_interface() const = 0;
83 
84  RCLCPP_PUBLIC
85  virtual
87  get_node_timers_interface() const = 0;
88 
90  RCLCPP_PUBLIC
91  virtual
92  std::string
93  resolve_topic_name(const std::string & name, bool only_expand = false) const = 0;
94 };
95 
96 } // namespace node_interfaces
97 } // namespace rclcpp
98 
99 RCLCPP_NODE_INTERFACE_HELPERS_SUPPORT(rclcpp::node_interfaces::NodeTopicsInterface, topics)
100 
101 #endif // RCLCPP__NODE_INTERFACES__NODE_TOPICS_INTERFACE_HPP_
Encapsulation of Quality of Service settings.
Definition: qos.hpp:116
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>.