ROS 2 rclcpp + rcl - kilted  kilted
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 <atomic>
19 #include <functional>
20 #include <memory>
21 #include <string>
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/node_interfaces/detail/node_interfaces_helpers.hpp"
30 #include "rclcpp/visibility_control.hpp"
31 
32 namespace rclcpp
33 {
34 namespace node_interfaces
35 {
36 
39 {
40 public:
41  RCLCPP_SMART_PTR_ALIASES_ONLY(NodeBaseInterface)
42 
43  RCLCPP_PUBLIC
44  virtual
45  ~NodeBaseInterface() = default;
46 
48 
49  RCLCPP_PUBLIC
50  virtual
51  const char *
52  get_name() const = 0;
53 
55 
56  RCLCPP_PUBLIC
57  virtual
58  const char *
59  get_namespace() const = 0;
60 
62 
63  RCLCPP_PUBLIC
64  virtual
65  const char *
67 
69 
70  RCLCPP_PUBLIC
71  virtual
72  rclcpp::Context::SharedPtr
73  get_context() = 0;
74 
76  RCLCPP_PUBLIC
77  virtual
78  rcl_node_t *
80 
82  RCLCPP_PUBLIC
83  virtual
84  const rcl_node_t *
85  get_rcl_node_handle() const = 0;
86 
88 
92  RCLCPP_PUBLIC
93  virtual
94  std::shared_ptr<rcl_node_t>
96 
98 
102  RCLCPP_PUBLIC
103  virtual
104  std::shared_ptr<const rcl_node_t>
106 
108  RCLCPP_PUBLIC
109  virtual
110  rclcpp::CallbackGroup::SharedPtr
112  rclcpp::CallbackGroupType group_type,
113  bool automatically_add_to_executor_with_node = true) = 0;
114 
116  RCLCPP_PUBLIC
117  virtual
118  rclcpp::CallbackGroup::SharedPtr
120 
122  RCLCPP_PUBLIC
123  virtual
124  bool
125  callback_group_in_node(rclcpp::CallbackGroup::SharedPtr group) = 0;
126 
127  using CallbackGroupFunction = std::function<void (rclcpp::CallbackGroup::SharedPtr)>;
128 
130 
136  RCLCPP_PUBLIC
137  virtual
138  void
139  for_each_callback_group(const CallbackGroupFunction & func) = 0;
140 
142  RCLCPP_PUBLIC
143  virtual
144  std::atomic_bool &
146 
148 
153  RCLCPP_PUBLIC
154  virtual
157 
159 
164  RCLCPP_PUBLIC
165  virtual
166  rclcpp::GuardCondition::SharedPtr
168 
170 
173  RCLCPP_PUBLIC
174  virtual
175  void
177 
179  RCLCPP_PUBLIC
180  virtual
181  bool
183 
185  RCLCPP_PUBLIC
186  virtual
187  bool
189 
191  RCLCPP_PUBLIC
192  virtual
193  std::string
195  const std::string & name, bool is_service, bool only_expand = false) const = 0;
196 };
197 
198 } // namespace node_interfaces
199 } // namespace rclcpp
200 
201 RCLCPP_NODE_INTERFACE_HELPERS_SUPPORT(rclcpp::node_interfaces::NodeBaseInterface, base)
202 
203 #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 void trigger_notify_guard_condition()=0
Trigger the guard condition that notifies of internal node state changes.
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.
virtual RCLCPP_PUBLIC rclcpp::GuardCondition::SharedPtr get_shared_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:45