Skip to content

Commit

Permalink
parser_urdf.hh: remove deprecation macros
Browse files Browse the repository at this point in the history
Also remove deprecation warning suppression macros.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed May 11, 2020
1 parent 5f9de91 commit 5e99d80
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 33 deletions.
2 changes: 0 additions & 2 deletions src/SDFExtension.hh
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ namespace sdf
// blobs into body or robot
public: std::vector<std::shared_ptr<TiXmlElement> > blobs;

SDF_SUPPRESS_DEPRECATED_BEGIN
friend class URDF2SDF;
SDF_SUPPRESS_DEPRECATED_END
};
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ bool readFileInternal(const std::string &_filename, SDFPtr _sdf,
}

// Suppress deprecation for sdf::URDF2SDF
SDF_SUPPRESS_DEPRECATED_BEGIN
if (readDoc(&xmlDoc, _sdf, filename, _convert, _errors))
{
return true;
Expand All @@ -426,7 +425,6 @@ bool readFileInternal(const std::string &_filename, SDFPtr _sdf,
return false;
}
}
SDF_SUPPRESS_DEPRECATED_END

return false;
}
Expand Down Expand Up @@ -474,9 +472,7 @@ bool readStringInternal(const std::string &_xmlString, SDFPtr _sdf,
}
else
{
SDF_SUPPRESS_DEPRECATED_BEGIN
URDF2SDF u2g;
SDF_SUPPRESS_DEPRECATED_END
TiXmlDocument doc = u2g.InitModelString(_xmlString);
if (sdf::readDoc(&doc, _sdf, "urdf string", _convert, _errors))
{
Expand Down
2 changes: 1 addition & 1 deletion src/parser_urdf.hh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace sdf
/// This is now deprecated for external usage and will be removed in the next
/// major version of libsdformat. Instead, consider using `sdf::readFile` or
/// `sdf::readString`, which automatically convert URDF to SDF.
class SDFORMAT_VISIBLE SDF_DEPRECATED(9.2) URDF2SDF
class SDFORMAT_VISIBLE URDF2SDF
{
/// \brief constructor
public: URDF2SDF();
Expand Down
26 changes: 0 additions & 26 deletions src/parser_urdf_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ std::string getMinimalUrdfTxt()
/////////////////////////////////////////////////
std::string convertUrdfStrToSdfStr(const std::string &_urdf)
{
SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser_;
SDF_SUPPRESS_DEPRECATED_END
TiXmlDocument sdf_result = parser_.InitModelString(_urdf);
TiXmlPrinter printer;
sdf_result.Accept(&printer);
Expand All @@ -55,27 +53,23 @@ void convertUrdfStrToSdf(const std::string &_urdf, sdf::SDF &_sdf)
TEST(URDFParser, InitModelDoc_EmptyDoc_NoThrow)
{
// Suppress deprecation for sdf::URDF2SDF
SDF_SUPPRESS_DEPRECATED_BEGIN
ASSERT_NO_THROW(
TiXmlDocument doc = TiXmlDocument();
sdf::URDF2SDF parser_;
TiXmlDocument sdf_result = parser_.InitModelDoc(&doc);
); // NOLINT(whitespace/parens)
SDF_SUPPRESS_DEPRECATED_END
}

/////////////////////////////////////////////////
TEST(URDFParser, InitModelDoc_BasicModel_NoThrow)
{
// Suppress deprecation for sdf::URDF2SDF
SDF_SUPPRESS_DEPRECATED_BEGIN
ASSERT_NO_THROW(
TiXmlDocument doc;
doc.Parse(getMinimalUrdfTxt().c_str());
sdf::URDF2SDF parser_;
TiXmlDocument sdf_result = parser_.InitModelDoc(&doc);
); // NOLINT(whitespace/parens)
SDF_SUPPRESS_DEPRECATED_END
}

/////////////////////////////////////////////////
Expand All @@ -84,9 +78,7 @@ TEST(URDFParser, ParseResults_BasicModel_ParseEqualToModel)
// URDF -> SDF
TiXmlDocument doc;
doc.Parse(getMinimalUrdfTxt().c_str());
SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser_;
SDF_SUPPRESS_DEPRECATED_END
TiXmlDocument sdf_result = parser_.InitModelDoc(&doc);
std::string sdf_result_str;
sdf_result_str << sdf_result;
Expand Down Expand Up @@ -115,9 +107,7 @@ TEST(URDFParser, ParseRobotOriginXYZBlank)
<< "</robot>";
TiXmlDocument doc;
doc.Parse(stream.str().c_str());
SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser_;
SDF_SUPPRESS_DEPRECATED_END
TiXmlDocument sdf_result = parser_.InitModelDoc(&doc);
TiXmlElement *sdf = sdf_result.FirstChildElement("sdf");
ASSERT_NE(nullptr, sdf);
Expand All @@ -136,9 +126,7 @@ TEST(URDFParser, ParseRobotOriginRPYBlank)
<< " <link name=\"link\" />"
<< "</robot>";
TiXmlDocument doc;
SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser_;
SDF_SUPPRESS_DEPRECATED_END
doc.Parse(stream.str().c_str());
TiXmlDocument sdf_result = parser_.InitModelDoc(&doc);
TiXmlElement *sdf = sdf_result.FirstChildElement("sdf");
Expand Down Expand Up @@ -172,9 +160,7 @@ TEST(URDFParser, ParseRobotMaterialBlank)
<< "</robot>";
TiXmlDocument doc;
doc.Parse(stream.str().c_str());
SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser;
SDF_SUPPRESS_DEPRECATED_END
auto sdfXml = parser.InitModelDoc(&doc);
auto sdfElem = sdfXml.FirstChildElement("sdf");
ASSERT_NE(nullptr, sdfElem);
Expand Down Expand Up @@ -212,9 +198,7 @@ TEST(URDFParser, ParseRobotMaterialName)
<< "</robot>";
TiXmlDocument doc;
doc.Parse(stream.str().c_str());
SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser;
SDF_SUPPRESS_DEPRECATED_END
auto sdfXml = parser.InitModelDoc(&doc);
auto sdfElem = sdfXml.FirstChildElement("sdf");
ASSERT_NE(nullptr, sdfElem);
Expand Down Expand Up @@ -247,9 +231,7 @@ TEST(URDFParser, ParseRobotOriginInvalidXYZ)
<< " <link name=\"link\" />"
<< "</robot>";
TiXmlDocument doc;
SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser_;
SDF_SUPPRESS_DEPRECATED_END
doc.Parse(stream.str().c_str());
TiXmlDocument sdf_result = parser_.InitModelDoc(&doc);
TiXmlElement *sdf = sdf_result.FirstChildElement("sdf");
Expand Down Expand Up @@ -310,9 +292,7 @@ TEST(URDFParser, ParseGazeboLinkFactors)
<< "</robot>";

TiXmlDocument doc;
SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser_;
SDF_SUPPRESS_DEPRECATED_END
doc.Parse(stream.str().c_str());
TiXmlDocument sdf_result = parser_.InitModelDoc(&doc);

Expand Down Expand Up @@ -348,9 +328,7 @@ TEST(URDFParser, ParseGazeboInvalidDampingFactor)
<< " </gazebo>"
<< "</robot>";
TiXmlDocument doc;
SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser_;
SDF_SUPPRESS_DEPRECATED_END
doc.Parse(stream.str().c_str());
ASSERT_THROW(TiXmlDocument sdf_result = parser_.InitModelDoc(&doc),
std::invalid_argument);
Expand Down Expand Up @@ -419,9 +397,7 @@ TEST(URDFParser, ParseGazeboJointElements)
<< "</robot>";

TiXmlDocument doc;
SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser_;
SDF_SUPPRESS_DEPRECATED_END
doc.Parse(stream.str().c_str());
TiXmlDocument sdf_result = parser_.InitModelDoc(&doc);

Expand Down Expand Up @@ -807,9 +783,7 @@ TEST(URDFParser, OutputPrecision)
</link>
</robot>)";

SDF_SUPPRESS_DEPRECATED_BEGIN
sdf::URDF2SDF parser;
SDF_SUPPRESS_DEPRECATED_END
TiXmlDocument sdfResult = parser.InitModelString(str);

auto root = sdfResult.RootElement();
Expand Down

0 comments on commit 5e99d80

Please sign in to comment.