Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Switch from tinyxml -> tinyxml2 #17

Closed
wants to merge 1 commit into from
Closed

Switch from tinyxml -> tinyxml2 #17

wants to merge 1 commit into from

Conversation

rotu
Copy link

@rotu rotu commented Apr 27, 2020

Fix ros#137

Copy link

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pointed out some things to fix in here. Most important looks to be the changes to the APIs; we'll have to tick-tock those.

@@ -0,0 +1,43 @@
/*********************************************************************

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this file to xml_helpers.hpp, please.

Comment on lines +35 to +36
#ifndef ROS2_MASTER_XML_HELPERS_HPP
#define ROS2_MASTER_XML_HELPERS_HPP

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#ifndef ROS2_MASTER_XML_HELPERS_HPP
#define ROS2_MASTER_XML_HELPERS_HPP
#ifndef URDF_PARSER__XML_HELPERS_HPP
#define URDF_PARSER__XML_HELPERS_HPP

Comment on lines +51 to +52
using TiXmlDocument = tinyxml2::XMLDocument;
using TiXmlElement = tinyxml2::XMLElement;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd really rather not pretend that tinyxml2 APIs are the same as the tinyxml ones; this is changing the API below, but in a sneaky way. Let's remove this, deprecate the tinyxml APIs, and also add in the tinyxml2 APIs.

dynamics_xml->SetAttribute("damping", urdf_export_helpers::values2str(jd.damping) );
dynamics_xml->SetAttribute("friction", urdf_export_helpers::values2str(jd.friction) );
xml->LinkEndChild(dynamics_xml);
auto * dynamics_xml = xmlAppendChild(xml, "dynamics");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really prefer not to use auto unless it is blindingly obvious from this line of code what the type is. It doesn't seem to be the case here, so I'd much prefer using tinyxml2::XMLElement* here. The same goes for most uses of auto below.

xml->LinkEndChild(limit_xml);
auto * limit_xml = xmlAppendChild(xml, "limit");
limit_xml->SetAttribute("effort", jl.effort);
limit_xml->SetAttribute("velocity", jl.velocity );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: no space before the closing parentheses. There are more instances of this below.

@rotu
Copy link
Author

rotu commented Sep 2, 2020

@clalancette, feel free to take this over.

@rotu rotu closed this Sep 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build fails with undefined reference to TiXmlElement::SetAttribute
2 participants