From e2e56a87ae22d32504e0fcf2138cc70842128848 Mon Sep 17 00:00:00 2001 From: Takashi Sato Date: Tue, 17 Dec 2024 19:14:38 +0900 Subject: [PATCH 1/2] Refactor get_name methods to return const references for improved performance --- .../include/hardware_interface/loaned_command_interface.hpp | 4 ++-- .../include/hardware_interface/loaned_state_interface.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hardware_interface/include/hardware_interface/loaned_command_interface.hpp b/hardware_interface/include/hardware_interface/loaned_command_interface.hpp index 6013dea778..fb2cfb4e52 100644 --- a/hardware_interface/include/hardware_interface/loaned_command_interface.hpp +++ b/hardware_interface/include/hardware_interface/loaned_command_interface.hpp @@ -81,12 +81,12 @@ class LoanedCommandInterface } } - const std::string get_name() const { return command_interface_.get_name(); } + const std::string & get_name() const { return command_interface_.get_name(); } const std::string & get_interface_name() const { return command_interface_.get_interface_name(); } [[deprecated( - "Replaced by get_name method, which is semantically more correct")]] const std::string + "Replaced by get_name method, which is semantically more correct")]] const std::string & get_full_name() const { return command_interface_.get_name(); diff --git a/hardware_interface/include/hardware_interface/loaned_state_interface.hpp b/hardware_interface/include/hardware_interface/loaned_state_interface.hpp index 3ebc8c7ca0..89b1207415 100644 --- a/hardware_interface/include/hardware_interface/loaned_state_interface.hpp +++ b/hardware_interface/include/hardware_interface/loaned_state_interface.hpp @@ -75,12 +75,12 @@ class LoanedStateInterface } } - const std::string get_name() const { return state_interface_.get_name(); } + const std::string & get_name() const { return state_interface_.get_name(); } const std::string & get_interface_name() const { return state_interface_.get_interface_name(); } [[deprecated( - "Replaced by get_name method, which is semantically more correct")]] const std::string + "Replaced by get_name method, which is semantically more correct")]] const std::string & get_full_name() const { return state_interface_.get_name(); From 57bde07e1476b36620207436f6cc352cbf448df3 Mon Sep 17 00:00:00 2001 From: Takashi Sato Date: Wed, 18 Dec 2024 11:03:26 +0900 Subject: [PATCH 2/2] revert changes for deprecated methods --- .../include/hardware_interface/loaned_command_interface.hpp | 2 +- .../include/hardware_interface/loaned_state_interface.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware_interface/include/hardware_interface/loaned_command_interface.hpp b/hardware_interface/include/hardware_interface/loaned_command_interface.hpp index fb2cfb4e52..7bb4d3a0ef 100644 --- a/hardware_interface/include/hardware_interface/loaned_command_interface.hpp +++ b/hardware_interface/include/hardware_interface/loaned_command_interface.hpp @@ -86,7 +86,7 @@ class LoanedCommandInterface const std::string & get_interface_name() const { return command_interface_.get_interface_name(); } [[deprecated( - "Replaced by get_name method, which is semantically more correct")]] const std::string & + "Replaced by get_name method, which is semantically more correct")]] const std::string get_full_name() const { return command_interface_.get_name(); diff --git a/hardware_interface/include/hardware_interface/loaned_state_interface.hpp b/hardware_interface/include/hardware_interface/loaned_state_interface.hpp index 89b1207415..27b3da813e 100644 --- a/hardware_interface/include/hardware_interface/loaned_state_interface.hpp +++ b/hardware_interface/include/hardware_interface/loaned_state_interface.hpp @@ -80,7 +80,7 @@ class LoanedStateInterface const std::string & get_interface_name() const { return state_interface_.get_interface_name(); } [[deprecated( - "Replaced by get_name method, which is semantically more correct")]] const std::string & + "Replaced by get_name method, which is semantically more correct")]] const std::string get_full_name() const { return state_interface_.get_name();