Skip to content

Commit

Permalink
Remove deprecated APIs (#1456)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
scpeters authored Jul 9, 2024
1 parent dcd0964 commit 1779253
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 132 deletions.
17 changes: 17 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 0 additions & 20 deletions include/sdf/Joint.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 0 additions & 5 deletions include/sdf/SDFImpl.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 0 additions & 20 deletions include/sdf/Types.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = "<data-string>";
Expand Down Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions include/sdf/parser.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 0 additions & 24 deletions src/Joint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
16 changes: 0 additions & 16 deletions src/Joint_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());

Expand Down
6 changes: 0 additions & 6 deletions src/SDF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
8 changes: 0 additions & 8 deletions src/SDF_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

////////////////////////////////////////////////////
Expand Down
8 changes: 0 additions & 8 deletions src/Types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,5 @@ std::string JoinName(
else
return _scopeName + std::string(kScopeDelimiter) + _localName;
}

/////////////////////////////////////////////////
const std::string &internal::SdfScopeDelimiter()
{
static const gz::utils::NeverDestroyed<std::string> delimiter{
kScopeDelimiter};
return delimiter.Access();
}
}
}
8 changes: 0 additions & 8 deletions src/Types_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 0 additions & 6 deletions src/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 1779253

Please sign in to comment.