rclcpp  master
C++ ROS Client Library API
node_base_interface.hpp
Go to the documentation of this file.
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 
26 #include "rclcpp/context.hpp"
27 #include "rclcpp/macros.hpp"
29 
30 namespace rclcpp
31 {
32 namespace node_interfaces
33 {
34 
37 {
38 public:
40 
41 
42 
44  virtual
45  const char *
46  get_name() const = 0;
47 
49 
51  virtual
52  const char *
53  get_namespace() const = 0;
54 
56 
58  virtual
59  rclcpp::Context::SharedPtr
60  get_context() = 0;
61 
64  virtual
65  rcl_node_t *
66  get_rcl_node_handle() = 0;
67 
70  virtual
71  const rcl_node_t *
72  get_rcl_node_handle() const = 0;
73 
75 
80  virtual
83 
85 
90  virtual
92  get_shared_rcl_node_handle() const = 0;
93 
96  virtual
97  rclcpp::callback_group::CallbackGroup::SharedPtr
99 
102  virtual
103  rclcpp::callback_group::CallbackGroup::SharedPtr
105 
108  virtual
109  bool
110  callback_group_in_node(rclcpp::callback_group::CallbackGroup::SharedPtr group) = 0;
111 
114  virtual
116  get_callback_groups() const = 0;
117 
120  virtual
121  std::atomic_bool &
123 
125 
131  virtual
134 
136 
138  virtual
141 };
142 
143 } // namespace node_interfaces
144 } // namespace rclcpp
145 
146 #endif // RCLCPP__NODE_INTERFACES__NODE_BASE_INTERFACE_HPP_
#define RCLCPP_SMART_PTR_ALIASES_ONLY(...)
Definition: macros.hpp:66
CallbackGroupType
Definition: callback_group.hpp:43
Definition: allocator_common.hpp:24
virtual const char * get_name() const =0
Return the name of the node.
virtual const std::vector< rclcpp::callback_group::CallbackGroup::WeakPtr > & get_callback_groups() const =0
Return list of callback groups associated with this node.
virtual std::unique_lock< std::recursive_mutex > acquire_notify_guard_condition_lock() const =0
Acquire and return a scoped lock that protects the notify guard condition.
virtual rcl_guard_condition_t * get_notify_guard_condition()=0
Return guard condition that should be notified when the internal node state changes.
virtual rclcpp::callback_group::CallbackGroup::SharedPtr create_callback_group(rclcpp::callback_group::CallbackGroupType group_type)=0
Create and return a callback group.
virtual 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 std::atomic_bool & get_associated_with_executor_atomic()=0
Return the atomic bool which is used to ensure only one executor is used.
virtual rcl_node_t * get_rcl_node_handle()=0
Return the rcl_node_t node handle (non-const version).
virtual bool callback_group_in_node(rclcpp::callback_group::CallbackGroup::SharedPtr group)=0
Return true if the given callback group is associated with this node.
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
virtual rclcpp::Context::SharedPtr get_context()=0
Return the context of the node.
virtual rclcpp::callback_group::CallbackGroup::SharedPtr get_default_callback_group()=0
Return the default callback group.
Pure virtual interface class for the NodeBase part of the Node API.
Definition: node_base_interface.hpp:36
virtual const char * get_namespace() const =0
Return the namespace of the node.