From fd572b621d497b85c018f2a3baa2e81fec63b70a Mon Sep 17 00:00:00 2001 From: Emerson Knapp Date: Tue, 27 Jun 2023 08:38:49 -0700 Subject: [PATCH 1/2] Add a pimpl inside rclcpp::Node for future distro backports Signed-off-by: Emerson Knapp --- rclcpp/include/rclcpp/node.hpp | 3 +++ rclcpp/src/rclcpp/node.cpp | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/rclcpp/include/rclcpp/node.hpp b/rclcpp/include/rclcpp/node.hpp index 50bd9da6a0..ed4ae3db2b 100644 --- a/rclcpp/include/rclcpp/node.hpp +++ b/rclcpp/include/rclcpp/node.hpp @@ -1600,6 +1600,9 @@ class Node : public std::enable_shared_from_this const rclcpp::NodeOptions node_options_; const std::string sub_namespace_; const std::string effective_namespace_; + + class NodeImpl; + std::shared_ptr hidden_impl_; }; } // namespace rclcpp diff --git a/rclcpp/src/rclcpp/node.cpp b/rclcpp/src/rclcpp/node.cpp index 52012439e8..c31f4ee1f0 100644 --- a/rclcpp/src/rclcpp/node.cpp +++ b/rclcpp/src/rclcpp/node.cpp @@ -110,6 +110,22 @@ create_effective_namespace(const std::string & node_namespace, const std::string } // namespace +/// Internal implementation to provide hidden and API/ABI stable changes to the Node. +/** + * This class is intended to be an "escape hatch" within a stable distribution, so that certain + * smaller features and bugfixes can be backported, having a place to put new members, while + * maintaining the ABI. + * + * This is not intended to be a parking place for new features, it should be used for backports + * only, left empty and unallocated in Rolling. + */ +class Node::NodeImpl +{ +public: + NodeImpl() = default; + ~NodeImpl() = default; +}; + Node::Node( const std::string & node_name, const NodeOptions & options) @@ -253,7 +269,8 @@ Node::Node( node_waitables_(other.node_waitables_), node_options_(other.node_options_), sub_namespace_(extend_sub_namespace(other.get_sub_namespace(), sub_namespace)), - effective_namespace_(create_effective_namespace(other.get_namespace(), sub_namespace_)) + effective_namespace_(create_effective_namespace(other.get_namespace(), sub_namespace_)), + hidden_impl_(other.hidden_impl_) { // Validate new effective namespace. int validation_result; From cee7c6c949854eb44938115186dc08a04290b92a Mon Sep 17 00:00:00 2001 From: Emerson Knapp <537409+emersonknapp@users.noreply.github.com> Date: Mon, 10 Jul 2023 11:43:47 -0700 Subject: [PATCH 2/2] Update rclcpp/include/rclcpp/node.hpp Co-authored-by: Chris Lalancette Signed-off-by: Emerson Knapp --- rclcpp/include/rclcpp/node.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rclcpp/include/rclcpp/node.hpp b/rclcpp/include/rclcpp/node.hpp index ed4ae3db2b..19abf4a602 100644 --- a/rclcpp/include/rclcpp/node.hpp +++ b/rclcpp/include/rclcpp/node.hpp @@ -1602,7 +1602,10 @@ class Node : public std::enable_shared_from_this const std::string effective_namespace_; class NodeImpl; - std::shared_ptr hidden_impl_; + // This member is meant to be a place to backport features into stable distributions, + // and new features targeting Rolling should not use this. + // See the comment in node.cpp for more information. + std::shared_ptr hidden_impl_{nullptr}; }; } // namespace rclcpp