From f4ada8c8751dc7d2d86072a01c6ac09b372ea138 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 8 Jul 2024 12:11:38 -0700 Subject: [PATCH] Remove deprecated APIs * Joint.hh: *LinkName setters and getters * parser.hh: checkJointParentChildLinkNames(const sdf::Root *) * SDFImpl.hh: Root(const ElementPtr) * Types.hh: kSdfScopeDelimiter, SdfScopeDelimiter(), Inertia Signed-off-by: Steve Peters --- Migration.md | 17 +++++++++++++++++ include/sdf/Joint.hh | 20 -------------------- include/sdf/SDFImpl.hh | 5 ----- include/sdf/Types.hh | 20 -------------------- include/sdf/parser.hh | 11 ----------- src/Joint.cc | 24 ------------------------ src/Joint_TEST.cc | 16 ---------------- src/SDF.cc | 6 ------ src/SDF_TEST.cc | 8 -------- src/Types.cc | 8 -------- src/Types_TEST.cc | 8 -------- src/parser.cc | 6 ------ 12 files changed, 17 insertions(+), 132 deletions(-) diff --git a/Migration.md b/Migration.md index 0976e95f0..f339080fa 100644 --- a/Migration.md +++ b/Migration.md @@ -41,6 +41,23 @@ but with improved human-readability.. + ***Deprecation:*** void SetOpticalFrameId(const std::string &) + ***Replacement:*** void Sensor::SetFrameId(const std::string &) +### Removals + +- **sdf/Joint.hh**: + + `const std::string &ChildLinkName() const` (use `ChildName()` instead) + + `const std::string &ParentLinkName() const` (use `ParentName()` instead) + + `void SetChildLinkName(const std::string &)` (use `SetChildName()` instead) + + `void SetParentLinkName(const std::string &)` (use `SetParentName()` instead) + +- **sdf/SDFImpl.hh**: + + `void Root(const ElementPtr)` (use `SetRoot(const ElementPtr)` instead) + +- **sdf/Types.hh**: + + `const std::string &kSdfScopeDelimiter` (use `kScopeDelimiter` instead) + + `const std::string &SdfScopeDelimiter()` (use `kScopeDelimiter` instead) + +- **sdf/parser.hh**: + + `bool checkJointParentChildLinkNames(const sdf::Root *)` (use `checkJointParentChildNames(const sdf::Root *)` instead) ## libsdformat 13.x to 14.x diff --git a/include/sdf/Joint.hh b/include/sdf/Joint.hh index 26c4b226f..596e0a398 100644 --- a/include/sdf/Joint.hh +++ b/include/sdf/Joint.hh @@ -129,26 +129,6 @@ namespace sdf /// \param[in] _name Name of the child frame. public: void SetChildName(const std::string &_name); - /// \brief Get the name of this joint's parent link. - /// \return The name of the parent link. - /// \deprecated Use ParentName. - public: GZ_DEPRECATED(13) const std::string &ParentLinkName() const; - - /// \brief Set the name of the parent link. - /// \param[in] _name Name of the parent link. - /// \deprecated Use SetParentName. - public: GZ_DEPRECATED(13) void SetParentLinkName(const std::string &_name); - - /// \brief Get the name of this joint's child link. - /// \return The name of the child link. - /// \deprecated Use ChildName. - public: GZ_DEPRECATED(13) const std::string &ChildLinkName() const; - - /// \brief Set the name of the child link. - /// \param[in] _name Name of the child link. - /// \deprecated Use SetChildName. - public: GZ_DEPRECATED(13) void SetChildLinkName(const std::string &_name); - /// \brief Resolve the name of the child link from the /// FrameAttachedToGraph. /// \param[out] _body Name of child link of this joint. diff --git a/include/sdf/SDFImpl.hh b/include/sdf/SDFImpl.hh index 20e1ec19f..a868b4b4a 100644 --- a/include/sdf/SDFImpl.hh +++ b/include/sdf/SDFImpl.hh @@ -148,11 +148,6 @@ namespace sdf /// \param[in] _root Root element public: void SetRoot(const ElementPtr _root); - /// \brief Set the root pointer - /// \param[in] _root Root element - /// \deprecated Use SetRoot - public: GZ_DEPRECATED(13) void Root(const ElementPtr _root); - /// \brief Get the path to the SDF document on disk. /// \return The full path to the SDF document. public: std::string FilePath() const; diff --git a/include/sdf/Types.hh b/include/sdf/Types.hh index f2f19248c..26e25cdac 100644 --- a/include/sdf/Types.hh +++ b/include/sdf/Types.hh @@ -36,22 +36,8 @@ namespace sdf inline namespace SDF_VERSION_NAMESPACE { // - namespace internal - { - /// \brief Initializes the scope delimiter as a function-local static - /// variable so it can be used to initialize kSdfScopeDelimiter. - /// \note This should not be used directly in user code. It will likely be - /// removed in libsdformat 15 with kSdfScopeDelimiter. - SDFORMAT_VISIBLE const std::string &SdfScopeDelimiter(); - } // namespace internal - constexpr std::string_view kScopeDelimiter{"::"}; - // Deprecated because it violates the Google Style Guide as it is not - // trivially destructible. Please use sdf::kScopeDelimiter instead. - GZ_DEPRECATED(14) - inline const std::string &kSdfScopeDelimiter = internal::SdfScopeDelimiter(); - /// \brief The source path replacement if it was parsed from a string, /// instead of a file. constexpr char kSdfStringSource[] = ""; @@ -158,12 +144,6 @@ namespace sdf public: int32_t nsec; }; - /// \brief A class for inertial information about a link. - class SDFORMAT_VISIBLE GZ_DEPRECATED(13) Inertia - { - public: double mass; - }; - /// \brief Transforms a string to its lowercase equivalent /// \param[in] _in String to convert to lowercase /// \return Lowercase equilvalent of _in. diff --git a/include/sdf/parser.hh b/include/sdf/parser.hh index a7dee740a..a96b484e3 100644 --- a/include/sdf/parser.hh +++ b/include/sdf/parser.hh @@ -503,17 +503,6 @@ namespace sdf SDFORMAT_VISIBLE bool checkJointParentChildNames(const sdf::Root *_root); - /// \brief Check that all joints in contained models specify parent - /// and child link names that match the names of sibling links. - /// This checks recursively and should check the files exhaustively - /// rather than terminating early when the first error is found. - /// \param[in] _root SDF Root object to check recursively. - /// \return True if all models have joints with valid parent and child - /// link names. - /// \deprecated Use checkJointParentChildNames. - SDFORMAT_VISIBLE GZ_DEPRECATED(13) - bool checkJointParentChildLinkNames(const sdf::Root *_root); - /// \brief Check that all joints in contained models specify parent /// and child names that match the names of sibling links, joints, /// models, or frames. diff --git a/src/Joint.cc b/src/Joint.cc index 2b8fd8282..93cc5900c 100644 --- a/src/Joint.cc +++ b/src/Joint.cc @@ -306,30 +306,6 @@ void Joint::SetChildName(const std::string &_name) this->dataPtr->childName = _name; } -///////////////////////////////////////////////// -const std::string &Joint::ParentLinkName() const -{ - return this->ParentName(); -} - -///////////////////////////////////////////////// -void Joint::SetParentLinkName(const std::string &_name) -{ - this->SetParentName(_name); -} - -///////////////////////////////////////////////// -const std::string &Joint::ChildLinkName() const -{ - return this->ChildName(); -} - -///////////////////////////////////////////////// -void Joint::SetChildLinkName(const std::string &_name) -{ - this->SetChildName(_name); -} - ///////////////////////////////////////////////// const JointAxis *Joint::Axis(const unsigned int _index) const { diff --git a/src/Joint_TEST.cc b/src/Joint_TEST.cc index f4c23abf9..83217b744 100644 --- a/src/Joint_TEST.cc +++ b/src/Joint_TEST.cc @@ -30,10 +30,6 @@ TEST(DOMJoint, Construction) EXPECT_TRUE(joint.ParentName().empty()); EXPECT_TRUE(joint.ChildName().empty()); - GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION - EXPECT_TRUE(joint.ParentLinkName().empty()); - EXPECT_TRUE(joint.ChildLinkName().empty()); - GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION EXPECT_EQ(gz::math::Pose3d::Zero, joint.RawPose()); EXPECT_TRUE(joint.PoseRelativeTo().empty()); @@ -65,18 +61,6 @@ TEST(DOMJoint, Construction) joint.SetName("test_joint"); EXPECT_EQ("test_joint", joint.Name()); - GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION - joint.SetParentLinkName("parent"); - EXPECT_EQ("parent", joint.ParentLinkName()); - GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION - EXPECT_EQ("parent", joint.ParentName()); - - GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION - joint.SetChildLinkName("child"); - EXPECT_EQ("child", joint.ChildLinkName()); - GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION - EXPECT_EQ("child", joint.ChildName()); - joint.SetParentName("parent2"); EXPECT_EQ("parent2", joint.ParentName()); diff --git a/src/SDF.cc b/src/SDF.cc index 7a43d0f9a..22fcaef3d 100644 --- a/src/SDF.cc +++ b/src/SDF.cc @@ -383,12 +383,6 @@ void SDF::SetRoot(const ElementPtr _root) this->dataPtr->root = _root; } -///////////////////////////////////////////////// -void SDF::Root(const ElementPtr _root) -{ - this->SetRoot(_root); -} - ///////////////////////////////////////////////// std::string SDF::FilePath() const { diff --git a/src/SDF_TEST.cc b/src/SDF_TEST.cc index 44bb9f284..5538406d3 100644 --- a/src/SDF_TEST.cc +++ b/src/SDF_TEST.cc @@ -290,14 +290,6 @@ TEST(SDF, SetRoot) elem->AddValue("bool", "true", false, "description"); s.SetRoot(elem); EXPECT_EQ(elem, s.Root()); - - // Test deprecated setter, remove in libsdformat14 - s.SetRoot(nullptr); - EXPECT_EQ(nullptr, s.Root()); - GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION - s.Root(elem); - GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION - EXPECT_EQ(elem, s.Root()); } //////////////////////////////////////////////////// diff --git a/src/Types.cc b/src/Types.cc index 6e202b936..5b363a383 100644 --- a/src/Types.cc +++ b/src/Types.cc @@ -144,13 +144,5 @@ std::string JoinName( else return _scopeName + std::string(kScopeDelimiter) + _localName; } - -///////////////////////////////////////////////// -const std::string &internal::SdfScopeDelimiter() -{ - static const gz::utils::NeverDestroyed delimiter{ - kScopeDelimiter}; - return delimiter.Access(); -} } } diff --git a/src/Types_TEST.cc b/src/Types_TEST.cc index 37b951739..3d04947be 100644 --- a/src/Types_TEST.cc +++ b/src/Types_TEST.cc @@ -200,11 +200,3 @@ TEST(Types, JoinName) EXPECT_EQ(joinedName, ""); } } - -///////////////////////////////////////////////// -TEST(Types, ScopeDelimiters) -{ - GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION - EXPECT_EQ(sdf::kScopeDelimiter, sdf::kSdfScopeDelimiter); - GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION -} diff --git a/src/parser.cc b/src/parser.cc index 84a7593d6..97603cfa1 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -2724,12 +2724,6 @@ bool checkPoseRelativeToGraph(sdf::Errors &_errors, const sdf::Root *_root) return result; } -////////////////////////////////////////////////// -bool checkJointParentChildLinkNames(const sdf::Root *_root) -{ - return checkJointParentChildNames(_root); -} - ////////////////////////////////////////////////// bool checkJointParentChildNames(const sdf::Root *_root) {