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 
42  virtual
43  ~NodeBaseInterface() = default;
44 
46 
48  virtual
49  const char *
50  get_name() const = 0;
51 
53 
55  virtual
56  const char *
57  get_namespace() const = 0;
58 
60 
62  virtual
63  const char *
64  get_fully_qualified_name() const = 0;
65 
67 
69  virtual
70  rclcpp::Context::SharedPtr
71  get_context() = 0;
72 
75  virtual
76  rcl_node_t *
77  get_rcl_node_handle() = 0;
78 
81  virtual
82  const rcl_node_t *
83  get_rcl_node_handle() const = 0;
84 
86 
91  virtual
94 
96 
101  virtual
103  get_shared_rcl_node_handle() const = 0;
104 
107  virtual
108  rclcpp::CallbackGroup::SharedPtr
110  rclcpp::CallbackGroupType group_type,
111  bool automatically_add_to_executor_with_node = true) = 0;
112 
115  virtual
116  rclcpp::CallbackGroup::SharedPtr
118 
121  virtual
122  bool
123  callback_group_in_node(rclcpp::CallbackGroup::SharedPtr group) = 0;
124 
127  virtual
129  get_callback_groups() const = 0;
130 
133  virtual
134  std::atomic_bool &
136 
138 
144  virtual
147 
149 
151  virtual
154 
157  virtual
158  bool
159  get_use_intra_process_default() const = 0;
160 
163  virtual
164  bool
166 
169  virtual
172  const std::string & name, bool is_service, bool only_expand = false) const = 0;
173 };
174 
175 } // namespace node_interfaces
176 } // namespace rclcpp
177 
178 #endif // RCLCPP__NODE_INTERFACES__NODE_BASE_INTERFACE_HPP_
rcl_node_t
rclcpp::node_interfaces::NodeBaseInterface::callback_group_in_node
virtual bool callback_group_in_node(rclcpp::CallbackGroup::SharedPtr group)=0
Return true if the given callback group is associated with this node.
callback_group.hpp
std::string
std::shared_ptr< rcl_node_t >
rclcpp::node_interfaces::NodeBaseInterface::get_context
virtual rclcpp::Context::SharedPtr get_context()=0
Return the context of the node.
std::vector< rclcpp::CallbackGroup::WeakPtr >
context.hpp
RCLCPP_SMART_PTR_ALIASES_ONLY
#define RCLCPP_SMART_PTR_ALIASES_ONLY(...)
Definition: macros.hpp:66
rclcpp::node_interfaces::NodeBaseInterface::get_shared_rcl_node_handle
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.
rclcpp::node_interfaces::NodeBaseInterface::get_callback_groups
virtual const std::vector< rclcpp::CallbackGroup::WeakPtr > & get_callback_groups() const =0
Return list of callback groups associated with this node.
rcl_guard_condition_t
rclcpp::node_interfaces::NodeBaseInterface::get_name
virtual const char * get_name() const =0
Return the name of the node.
rclcpp::node_interfaces::NodeBaseInterface::get_default_callback_group
virtual rclcpp::CallbackGroup::SharedPtr get_default_callback_group()=0
Return the default callback group.
rclcpp::CallbackGroupType
CallbackGroupType
Definition: callback_group.hpp:43
rclcpp
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
RCLCPP_PUBLIC
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
rclcpp::node_interfaces::NodeBaseInterface
Pure virtual interface class for the NodeBase part of the Node API.
Definition: node_base_interface.hpp:36
rclcpp::node_interfaces::NodeBaseInterface::resolve_topic_or_service_name
virtual 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.
macros.hpp
rclcpp::node_interfaces::NodeBaseInterface::get_use_intra_process_default
virtual bool get_use_intra_process_default() const =0
Return the default preference for using intra process communication.
rclcpp::node_interfaces::NodeBaseInterface::create_callback_group
virtual 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.
rclcpp::node_interfaces::NodeBaseInterface::get_enable_topic_statistics_default
virtual bool get_enable_topic_statistics_default() const =0
Return the default preference for enabling topic statistics collection.
std::unique_lock
rclcpp::node_interfaces::NodeBaseInterface::get_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.
rclcpp::node_interfaces::NodeBaseInterface::acquire_notify_guard_condition_lock
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.
rclcpp::node_interfaces::NodeBaseInterface::get_rcl_node_handle
virtual rcl_node_t * get_rcl_node_handle()=0
Return the rcl_node_t node handle (non-const version).
rclcpp::node_interfaces::NodeBaseInterface::~NodeBaseInterface
virtual ~NodeBaseInterface()=default
rclcpp::node_interfaces::NodeBaseInterface::get_associated_with_executor_atomic
virtual std::atomic_bool & get_associated_with_executor_atomic()=0
Return the atomic bool which is used to ensure only one executor is used.
rclcpp::node_interfaces::NodeBaseInterface::get_fully_qualified_name
virtual const char * get_fully_qualified_name() const =0
Return the fully qualified name of the node.
visibility_control.hpp
node.h
rclcpp::node_interfaces::NodeBaseInterface::get_namespace
virtual const char * get_namespace() const =0
Return the namespace of the node.