15 #ifndef RCLCPP__NODE_INTERFACES__NODE_BASE_HPP_
16 #define RCLCPP__NODE_INTERFACES__NODE_BASE_HPP_
25 #include "rclcpp/callback_group.hpp"
26 #include "rclcpp/context.hpp"
27 #include "rclcpp/macros.hpp"
28 #include "rclcpp/node_interfaces/node_base_interface.hpp"
29 #include "rclcpp/visibility_control.hpp"
33 namespace node_interfaces
40 RCLCPP_SMART_PTR_ALIASES_ONLY(
NodeBase)
44 const std::string & node_name,
45 const std::string & namespace_,
46 rclcpp::Context::SharedPtr context,
48 bool use_intra_process_default,
49 bool enable_topic_statistics_default);
68 rclcpp::Context::SharedPtr
80 std::shared_ptr<rcl_node_t>
84 std::shared_ptr<const rcl_node_t>
88 rclcpp::CallbackGroup::SharedPtr
90 rclcpp::CallbackGroupType group_type,
91 bool automatically_add_to_executor_with_node =
true)
override;
94 rclcpp::CallbackGroup::SharedPtr
129 const std::string & name,
bool is_service,
bool only_expand =
false)
const override;
134 rclcpp::Context::SharedPtr context_;
135 bool use_intra_process_default_;
136 bool enable_topic_statistics_default_;
138 std::shared_ptr<rcl_node_t> node_handle_;
140 rclcpp::CallbackGroup::SharedPtr default_callback_group_;
141 std::mutex callback_groups_mutex_;
142 std::vector<rclcpp::CallbackGroup::WeakPtr> callback_groups_;
144 std::atomic_bool associated_with_executor_;
147 mutable std::recursive_mutex notify_guard_condition_mutex_;
149 bool notify_guard_condition_is_valid_;
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.
Implementation of the NodeBase part of the Node API.
RCLCPP_PUBLIC const char * get_name() const override
Return the name of the node.
bool get_enable_topic_statistics_default() const override
Return the default preference for enabling topic statistics collection.
RCLCPP_PUBLIC bool get_use_intra_process_default() const override
Return the default preference for using intra process communication.
RCLCPP_PUBLIC rclcpp::CallbackGroup::SharedPtr get_default_callback_group() override
Return the default callback group.
RCLCPP_PUBLIC rclcpp::CallbackGroup::SharedPtr create_callback_group(rclcpp::CallbackGroupType group_type, bool automatically_add_to_executor_with_node=true) override
Create and return a callback group.
RCLCPP_PUBLIC rcl_node_t * get_rcl_node_handle() override
Return the rcl_node_t node handle (non-const version).
std::string resolve_topic_or_service_name(const std::string &name, bool is_service, bool only_expand=false) const override
Expand and remap a given topic or service name.
RCLCPP_PUBLIC rclcpp::GuardCondition & get_notify_guard_condition() override
Return a guard condition that should be notified when the internal node state changes.
RCLCPP_PUBLIC const char * get_namespace() const override
Return the namespace of the node.
RCLCPP_PUBLIC std::shared_ptr< rcl_node_t > get_shared_rcl_node_handle() override
Return the rcl_node_t node handle in a std::shared_ptr.
RCLCPP_PUBLIC void for_each_callback_group(const CallbackGroupFunction &func) override
Iterate over the stored callback groups, calling the given function on each valid one.
RCLCPP_PUBLIC rclcpp::Context::SharedPtr get_context() override
Return the context of the node.
RCLCPP_PUBLIC bool callback_group_in_node(rclcpp::CallbackGroup::SharedPtr group) override
Return true if the given callback group is associated with this node.
RCLCPP_PUBLIC std::atomic_bool & get_associated_with_executor_atomic() override
Return the atomic bool which is used to ensure only one executor is used.
RCLCPP_PUBLIC const char * get_fully_qualified_name() const override
Return the fully qualified name of the node.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
Structure which encapsulates the options for creating a rcl_node_t.
Structure which encapsulates a ROS Node.