ROS 2 rclcpp + rcl - humble  humble
ROS 2 C++ Client Library with ROS Client Library
node_base_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_BASE_INTERFACE_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_BASE_INTERFACE_HPP_
17 
18 #include <memory>
19 #include <mutex>
20 #include <string>
21 #include <vector>
22 
23 #include "rcl/node.h"
24 
25 #include "rclcpp/callback_group.hpp"
26 #include "rclcpp/context.hpp"
27 #include "rclcpp/guard_condition.hpp"
28 #include "rclcpp/macros.hpp"
29 #include "rclcpp/visibility_control.hpp"
30 
31 namespace rclcpp
32 {
33 namespace node_interfaces
34 {
35 
38 {
39 public:
40  RCLCPP_SMART_PTR_ALIASES_ONLY(NodeBaseInterface)
41 
42  RCLCPP_PUBLIC
43  virtual
44  ~NodeBaseInterface() = default;
45 
47 
48  RCLCPP_PUBLIC
49  virtual
50  const char *
51  get_name() const = 0;
52 
54 
55  RCLCPP_PUBLIC
56  virtual
57  const char *
58  get_namespace() const = 0;
59 
61 
62  RCLCPP_PUBLIC
63  virtual
64  const char *
66 
68 
69  RCLCPP_PUBLIC
70  virtual
71  rclcpp::Context::SharedPtr
72  get_context() = 0;
73 
75  RCLCPP_PUBLIC
76  virtual
77  rcl_node_t *
79 
81  RCLCPP_PUBLIC
82  virtual
83  const rcl_node_t *
84  get_rcl_node_handle() const = 0;
85 
87 
91  RCLCPP_PUBLIC
92  virtual
93  std::shared_ptr<rcl_node_t>
95 
97 
101  RCLCPP_PUBLIC
102  virtual
103  std::shared_ptr<const rcl_node_t>
105 
107  RCLCPP_PUBLIC
108  virtual
109  rclcpp::CallbackGroup::SharedPtr
111  rclcpp::CallbackGroupType group_type,
112  bool automatically_add_to_executor_with_node = true) = 0;
113 
115  RCLCPP_PUBLIC
116  virtual
117  rclcpp::CallbackGroup::SharedPtr
119 
121  RCLCPP_PUBLIC
122  virtual
123  bool
124  callback_group_in_node(rclcpp::CallbackGroup::SharedPtr group) = 0;
125 
126  using CallbackGroupFunction = std::function<void (rclcpp::CallbackGroup::SharedPtr)>;
127 
129 
135  RCLCPP_PUBLIC
136  virtual
137  void
138  for_each_callback_group(const CallbackGroupFunction & func) = 0;
139 
141  RCLCPP_PUBLIC
142  virtual
143  std::atomic_bool &
145 
147 
152  RCLCPP_PUBLIC
153  virtual
156 
158  RCLCPP_PUBLIC
159  virtual
160  bool
162 
164  RCLCPP_PUBLIC
165  virtual
166  bool
168 
170  RCLCPP_PUBLIC
171  virtual
172  std::string
174  const std::string & name, bool is_service, bool only_expand = false) const = 0;
175 };
176 
177 } // namespace node_interfaces
178 } // namespace rclcpp
179 
180 #endif // RCLCPP__NODE_INTERFACES__NODE_BASE_INTERFACE_HPP_
A condition that can be waited on in a single wait set and asynchronously triggered.
Pure virtual interface class for the NodeBase part of the Node API.
virtual RCLCPP_PUBLIC std::shared_ptr< const rcl_node_t > get_shared_rcl_node_handle() const =0
Return the rcl_node_t node handle in a std::shared_ptr.
virtual RCLCPP_PUBLIC bool get_enable_topic_statistics_default() const =0
Return the default preference for enabling topic statistics collection.
virtual RCLCPP_PUBLIC bool callback_group_in_node(rclcpp::CallbackGroup::SharedPtr group)=0
Return true if the given callback group is associated with this node.
virtual RCLCPP_PUBLIC const char * get_namespace() const =0
Return the namespace of the node.
virtual RCLCPP_PUBLIC rclcpp::CallbackGroup::SharedPtr create_callback_group(rclcpp::CallbackGroupType group_type, bool automatically_add_to_executor_with_node=true)=0
Create and return a callback group.
virtual RCLCPP_PUBLIC rclcpp::CallbackGroup::SharedPtr get_default_callback_group()=0
Return the default callback group.
virtual RCLCPP_PUBLIC std::atomic_bool & get_associated_with_executor_atomic()=0
Return the atomic bool which is used to ensure only one executor is used.
virtual RCLCPP_PUBLIC std::string resolve_topic_or_service_name(const std::string &name, bool is_service, bool only_expand=false) const =0
Expand and remap a given topic or service name.
virtual RCLCPP_PUBLIC bool get_use_intra_process_default() const =0
Return the default preference for using intra process communication.
virtual RCLCPP_PUBLIC void for_each_callback_group(const CallbackGroupFunction &func)=0
Iterate over the stored callback groups, calling the given function on each valid one.
virtual RCLCPP_PUBLIC rcl_node_t * get_rcl_node_handle()=0
Return the rcl_node_t node handle (non-const version).
virtual RCLCPP_PUBLIC const char * get_fully_qualified_name() const =0
Return the fully qualified name of the node.
virtual RCLCPP_PUBLIC const char * get_name() const =0
Return the name of the node.
virtual RCLCPP_PUBLIC rclcpp::Context::SharedPtr get_context()=0
Return the context of the node.
virtual RCLCPP_PUBLIC std::shared_ptr< rcl_node_t > get_shared_rcl_node_handle()=0
Return the rcl_node_t node handle in a std::shared_ptr.
virtual RCLCPP_PUBLIC const rcl_node_t * get_rcl_node_handle() const =0
Return the rcl_node_t node handle (const version).
virtual RCLCPP_PUBLIC rclcpp::GuardCondition & get_notify_guard_condition()=0
Return a guard condition that should be notified when the internal node state changes.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Structure which encapsulates a ROS Node.
Definition: node.h:42