ROS 2 rclcpp + rcl - jazzy  jazzy
ROS 2 C++ Client Library with ROS Client Library
node_topics.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_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_TOPICS_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/node_base_interface.hpp"
26 #include "rclcpp/node_interfaces/node_timers_interface.hpp"
27 #include "rclcpp/node_interfaces/node_topics_interface.hpp"
28 #include "rclcpp/publisher_base.hpp"
29 #include "rclcpp/publisher_factory.hpp"
30 #include "rclcpp/qos.hpp"
31 #include "rclcpp/subscription_base.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  NodeTopics(
50 
51  RCLCPP_PUBLIC
52  ~NodeTopics() override;
53 
54  RCLCPP_PUBLIC
55  rclcpp::PublisherBase::SharedPtr
56  create_publisher(
57  const std::string & topic_name,
58  const rclcpp::PublisherFactory & publisher_factory,
59  const rclcpp::QoS & qos) override;
60 
61  RCLCPP_PUBLIC
62  void
63  add_publisher(
64  rclcpp::PublisherBase::SharedPtr publisher,
65  rclcpp::CallbackGroup::SharedPtr callback_group) override;
66 
67  RCLCPP_PUBLIC
68  rclcpp::SubscriptionBase::SharedPtr
69  create_subscription(
70  const std::string & topic_name,
71  const rclcpp::SubscriptionFactory & subscription_factory,
72  const rclcpp::QoS & qos) override;
73 
74  RCLCPP_PUBLIC
75  void
76  add_subscription(
77  rclcpp::SubscriptionBase::SharedPtr subscription,
78  rclcpp::CallbackGroup::SharedPtr callback_group) override;
79 
80  RCLCPP_PUBLIC
82  get_node_base_interface() const override;
83 
84  RCLCPP_PUBLIC
86  get_node_timers_interface() const override;
87 
88  RCLCPP_PUBLIC
89  std::string
90  resolve_topic_name(const std::string & name, bool only_expand = false) const override;
91 
92 private:
93  RCLCPP_DISABLE_COPY(NodeTopics)
94 
97 };
98 
99 } // namespace node_interfaces
100 } // namespace rclcpp
101 
102 #endif // RCLCPP__NODE_INTERFACES__NODE_TOPICS_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.
Implementation of the NodeTopics part of the Node API.
Definition: node_topics.hpp:42
RCLCPP_PUBLIC std::string resolve_topic_name(const std::string &name, bool only_expand=false) const override
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>.