Skip to content
Snippets Groups Projects
Commit 1757e7c6 authored by Fabian Tërnava's avatar Fabian Tërnava
Browse files

added new aliases for vectors and matrices in aron

parent f0f746d5
No related branches found
No related tags found
No related merge requests found
......@@ -24,12 +24,13 @@
#pragma once
// STD/STL
#include <memory>
#include <map>
#include <memory>
#include <optional>
// ArmarX
#include <SimoxUtility/xml.h>
#include <ArmarXCore/core/rapidxml/wrapper/RapidXmlReader.h>
/**
......@@ -116,36 +117,80 @@ namespace armarx::aron::typereader::xml
};
// Replacements ({tagName, {replacementsTag, additionalAronDTOXMLIncludePackagePath}, deprecationwarning})
const std::map<std::string, Replacement> REPLACEMENTS =
{
{"int", {"<int32 />", {}, "The <int />-tag is deprecated. Please use <int32 /> instead."}},
{"long", {"<int64 />", {}, "The <long />-tag is deprecated. Please use <int64 /> instead."}},
{"float", {"<float32 />", {}, "The <float />-tag is deprecated. Please use <float32 /> instead."}},
{"double", {"<float64 />", {}, "The <double />-tag is deprecated. Please use <float64 /> instead."}},
{"position", {"<matrix rows='3' cols='1' type='float32' />", {}, ""}},
{"pose", {"<matrix rows='4' cols='4' type='float32' />", {}, ""}},
{"orientation", {"<quaternion type='float32' />", {}, ""}},
const std::map<std::string, Replacement> REPLACEMENTS = {
{"int",
{"<int32 />", {}, "The <int />-tag is deprecated. Please use <int32 /> instead."}},
{"long",
{"<int64 />", {}, "The <long />-tag is deprecated. Please use <int64 /> instead."}},
{"float",
{"<float32 />",
{},
"The <float />-tag is deprecated. Please use <float32 /> instead."}},
{"double",
{"<float64 />",
{},
"The <double />-tag is deprecated. Please use <float64 /> instead."}},
// should that be deprecated?
{"position", {"<matrix rows='3' cols='1' type='float32' />", {}, ""}},
{"pose", {"<matrix rows='4' cols='4' type='float32' />", {}, ""}},
{"orientation", {"<quaternion type='float32' />", {}, ""}},
// values similar to eigen
{"quaternionf", {"<quaternion type='float32' />", {}, ""}},
{"quaterniond", {"<quaternion type='float64' />", {}, ""}},
{"vector2f", {"<matrix rows='2' cols='1' type='float32' />", {}, ""}},
{"vector2d", {"<matrix rows='2' cols='1' type='float64' />", {}, ""}},
{"vector3f", {"<matrix rows='3' cols='1' type='float32' />", {}, ""}},
{"vector3d", {"<matrix rows='3' cols='1' type='float64' />", {}, ""}},
{"vector4f", {"<matrix rows='4' cols='1' type='float32' />", {}, ""}},
{"vector4d", {"<matrix rows='4' cols='1' type='float64' />", {}, ""}},
{"matrix2f", {"<matrix rows='2' cols='2' type='float32' />", {}, ""}},
{"matrix2d", {"<matrix rows='2' cols='2' type='float64' />", {}, ""}},
{"matrix3f", {"<matrix rows='3' cols='3' type='float32' />", {}, ""}},
{"matrix3d", {"<matrix rows='3' cols='3' type='float64' />", {}, ""}},
{"matrix4f", {"<matrix rows='4' cols='4' type='float32' />", {}, ""}},
{"matrix4d", {"<matrix rows='4' cols='4' type='float64' />", {}, ""}},
// You can also add replacements for arondtos here!
// structure: {xml-identifier, {replacement, auto-include}, deprecationwarning}
{"datetime", {"<armarx::arondto::DateTime />", {"RobotAPI", "libraries/aron/common/aron/time.xml"}, ""}},
{"time", {"<armarx::arondto::DateTime />", {"RobotAPI", "libraries/aron/common/aron/time.xml"}, ""}},
{"duration", {"<armarx::arondto::Duration />", {"RobotAPI", "libraries/aron/common/aron/time.xml"}, ""}},
{"framedposition", {"<armarx::arondto::FramedPosition />", {"RobotAPI", "libraries/aron/common/aron/framed.xml"}, ""}},
{"framedorientation", {"<armarx::arondto::FramedOrientation />", {"RobotAPI", "libraries/aron/common/aron/framed.xml"}, ""}},
{"framedpose", {"<armarx::arondto::FramedPose />", {"RobotAPI", "libraries/aron/common/aron/framed.xml"}, ""}}
};
}
{"datetime",
{"<armarx::arondto::DateTime />",
{"RobotAPI", "libraries/aron/common/aron/time.xml"},
""}},
{"time",
{"<armarx::arondto::DateTime />",
{"RobotAPI", "libraries/aron/common/aron/time.xml"},
""}},
{"duration",
{"<armarx::arondto::Duration />",
{"RobotAPI", "libraries/aron/common/aron/time.xml"},
""}},
{"framedposition",
{"<armarx::arondto::FramedPosition />",
{"RobotAPI", "libraries/aron/common/aron/framed.xml"},
""}},
{"framedorientation",
{"<armarx::arondto::FramedOrientation />",
{"RobotAPI", "libraries/aron/common/aron/framed.xml"},
""}},
{"framedpose",
{"<armarx::arondto::FramedPose />",
{"RobotAPI", "libraries/aron/common/aron/framed.xml"},
""}}};
} // namespace constantes
namespace util
{
std::optional<RapidXmlReaderNode> GetFirstNodeWithTag(const RapidXmlReaderNode& node, const std::string& name);
std::optional<RapidXmlReaderNode> GetFirstNodeWithTag(const RapidXmlReaderNode& node,
const std::string& name);
void EnforceAttribute(const RapidXmlReaderNode& node, const std::string& att);
bool HasAttribute(const RapidXmlReaderNode& node, const std::string& att);
std::string GetAttribute(const RapidXmlReaderNode& node, const std::string& att);
std::string GetAttributeWithDefault(const RapidXmlReaderNode& node, const std::string& att, const std::string& def);
std::string GetAttributeWithDefault(const RapidXmlReaderNode& node,
const std::string& att,
const std::string& def);
bool AttributeIsTrue(const RapidXmlReaderNode& node, const std::string& att);
bool HasTagName(const RapidXmlReaderNode& node, const std::string& name);
......@@ -158,5 +203,5 @@ namespace armarx::aron::typereader::xml
void EnforceChildSize(const RapidXmlReaderNode& node, const size_t size);
void EnforceChildSizeGreaterEqual(const RapidXmlReaderNode& node, const size_t size);
void EnforceChildSizeGreater(const RapidXmlReaderNode& node, const size_t size);
}
}
} // namespace util
} // namespace armarx::aron::typereader::xml
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment