From e1976421e7673c61268a61d83a009098a98ddf26 Mon Sep 17 00:00:00 2001 From: "fabian.peller-konrad@kit.edu" <fabian.peller-konrad@kit.edu> Date: Wed, 5 May 2021 09:20:08 +0200 Subject: [PATCH] optional updates --- .../components/armem/server/CMakeLists.txt | 2 +- source/RobotAPI/interface/aron/Aron.ice | 4 +- .../cpp/serializer/ndarray/EigenMatrix.cpp | 16 +-- .../serializer/ndarray/EigenQuaternion.cpp | 12 +-- .../cpp/serializer/ndarray/Orientation.cpp | 2 +- .../cpp/serializer/ndarray/Pose.cpp | 4 +- .../cpp/serializer/ndarray/Position.cpp | 4 +- .../cpp/serializer/primitive/Primitive.cpp | 7 +- .../typeReader/xml/ReaderFactory.cpp | 25 ++--- .../libraries/aron/core/io/typeIO/Reader.h | 28 +++--- .../libraries/aron/core/io/typeIO/Writer.h | 28 +++--- .../core/io/typeIO/converter/Converter.cpp | 38 ++++---- .../aron/core/io/typeIO/visitor/Visitor.cpp | 41 ++++---- .../writer/navigator/NavigatorWriter.cpp | 40 ++++---- .../nlohmannJSON/NlohmannJSONWriter.cpp | 40 ++++---- .../core/navigator/type/container/Dict.cpp | 4 +- .../core/navigator/type/container/List.cpp | 4 +- .../core/navigator/type/container/Object.cpp | 4 +- .../core/navigator/type/container/Pair.cpp | 4 +- .../core/navigator/type/container/Tuple.cpp | 4 +- .../aron/core/navigator/type/enum/IntEnum.cpp | 4 +- .../navigator/type/ndarray/EigenMatrix.cpp | 97 ++++++++++++------- .../core/navigator/type/ndarray/EigenMatrix.h | 9 +- .../type/ndarray/EigenQuaternion.cpp | 21 ++-- .../navigator/type/ndarray/IVTCByteImage.cpp | 13 ++- .../core/navigator/type/ndarray/NDArray.cpp | 6 +- .../core/navigator/type/ndarray/OpenCVMat.cpp | 6 +- .../navigator/type/ndarray/Orientation.cpp | 6 +- .../navigator/type/ndarray/PCLPointCloud.cpp | 6 +- .../aron/core/navigator/type/ndarray/Pose.cpp | 6 +- .../core/navigator/type/ndarray/Position.cpp | 6 +- .../navigator/type/primitive/Primitive.cpp | 4 +- 32 files changed, 268 insertions(+), 227 deletions(-) diff --git a/source/RobotAPI/components/armem/server/CMakeLists.txt b/source/RobotAPI/components/armem/server/CMakeLists.txt index 83fd40e2d..48313a312 100644 --- a/source/RobotAPI/components/armem/server/CMakeLists.txt +++ b/source/RobotAPI/components/armem/server/CMakeLists.txt @@ -1,5 +1,5 @@ add_subdirectory(ExampleMemory) add_subdirectory(GeneralPurposeMemory) add_subdirectory(ObjectMemory) -add_subdirectory(RobotSensorMemory) +add_subdirectory(RobotStateMemory) add_subdirectory(SkillsMemory) diff --git a/source/RobotAPI/interface/aron/Aron.ice b/source/RobotAPI/interface/aron/Aron.ice index 9b5e96712..2e7053efc 100644 --- a/source/RobotAPI/interface/aron/Aron.ice +++ b/source/RobotAPI/interface/aron/Aron.ice @@ -44,7 +44,7 @@ module armarx module type { class AronType { - bool is_optional = false; // Every type can be optional or not + bool isOptional = true; // Every type can be optional or not } sequence<AronType> AronTypeList; dictionary<string, AronType> AronTypeDict; @@ -58,7 +58,7 @@ module armarx // Complex Types (serialize to ndarray) class AronNDArray extends AronType { AronIntSequence dimensions; string typeName; } - class AronEigenMatrix extends AronType { AronIntSequence dimensions; string typeName; } + class AronEigenMatrix extends AronType { int rows; int cols; AronIntSequence otherDimensions; string typeName; } class AronEigenQuaternion extends AronType { string typeName; } class AronIVTCByteImage extends AronType { int width; int height; string typeName; } class AronOpenCVMat extends AronType { AronIntSequence dimensions; string typeName; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenMatrix.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenMatrix.cpp index b2bd6844f..e6c93e450 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenMatrix.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenMatrix.cpp @@ -65,31 +65,31 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr EigenMatrixSerializer::getResetBlock(const std::string& accessor) const + CppBlockPtr EigenMatrixSerializer::getInitializeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = {};"); + b->addLine(accessor + " = " + getFullCppTypename() + "();"); return b; } - CppBlockPtr EigenMatrixSerializer::getWriteInitialTypeBlock(const std::string&) const + CppBlockPtr EigenMatrixSerializer::getResetBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeEigenMatrix({{" + simox::alg::to_string<int>(typenavigator->getDimensions(), ", ") + "}, \"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); + b->addLine(accessor + " = " + getFullCppTypename() + "();"); return b; } - CppBlockPtr EigenMatrixSerializer::getWriteCurrentTypeBlock(const std::string& accessor) const + CppBlockPtr EigenMatrixSerializer::getWriteInitialTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeEigenMatrix({{" + accessor + nextEl() + "rows(), " + accessor + nextEl() + "cols()}, \"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); + b->addLine("w.writeEigenMatrix({{" + simox::alg::to_string<int>(typenavigator->getDimensions(), ", ") + "}, \"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); return b; } - CppBlockPtr EigenMatrixSerializer::getInitializeBlock(const std::string& accessor) const + CppBlockPtr EigenMatrixSerializer::getWriteCurrentTypeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = {};"); + b->addLine("w.writeEigenMatrix({{" + accessor + nextEl() + "rows(), " + accessor + nextEl() + "cols()}, \"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenQuaternion.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenQuaternion.cpp index b9e1d3ced..20c0cbeaa 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenQuaternion.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenQuaternion.cpp @@ -63,28 +63,28 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr EigenQuaternionSerializer::getResetBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = {};"); + b->addLine(accessor + " = " + getFullCppTypename() + "();"); return b; } - CppBlockPtr EigenQuaternionSerializer::getWriteInitialTypeBlock(const std::string&) const + CppBlockPtr EigenQuaternionSerializer::getInitializeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeEigenQuaternion({\"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); + b->addLine(accessor + " = " + getFullCppTypename() + "();"); return b; } - CppBlockPtr EigenQuaternionSerializer::getWriteCurrentTypeBlock(const std::string&) const + CppBlockPtr EigenQuaternionSerializer::getWriteInitialTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); b->addLine("w.writeEigenQuaternion({\"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); return b; } - CppBlockPtr EigenQuaternionSerializer::getInitializeBlock(const std::string& accessor) const + CppBlockPtr EigenQuaternionSerializer::getWriteCurrentTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = " + getFullCppTypename() + "();"); + b->addLine("w.writeEigenQuaternion({\"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Orientation.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Orientation.cpp index 9aaddd388..992d169ce 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Orientation.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Orientation.cpp @@ -56,7 +56,7 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr OrientationSerializer::getResetBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = {};"); + b->addLine(accessor + " = " + getFullCppTypename() + "();"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Pose.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Pose.cpp index 135379e92..3cc08abf3 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Pose.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Pose.cpp @@ -56,14 +56,14 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr PoseSerializer::getResetBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = {};"); + b->addLine(accessor + " = " + getFullCppTypename() + "();"); return b; } CppBlockPtr PoseSerializer::getInitializeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = {};"); + b->addLine(accessor + " = " + getFullCppTypename() + "();"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Position.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Position.cpp index c87defd2c..9369718a0 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Position.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Position.cpp @@ -56,14 +56,14 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr PositionSerializer::getResetBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = {};"); + b->addLine(accessor + " = " + getFullCppTypename() + "();"); return b; } CppBlockPtr PositionSerializer::getInitializeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = {};"); + b->addLine(accessor + " = " + getFullCppTypename() + "();"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/primitive/Primitive.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/primitive/Primitive.cpp index 323414fbb..a7f8b33b4 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/primitive/Primitive.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/primitive/Primitive.cpp @@ -104,7 +104,8 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr upperType##Serializer::getWriteBlock(const std::string& accessor) const \ { \ CppBlockPtr block_if_data = CppBlockPtr(new CppBlock()); \ - block_if_data->addLine("w.writePrimitive(" + accessor + ");"); \ + std::string resolved_accessor = ResolveOptionalAccessor(accessor, typenavigator); \ + block_if_data->addLine("w.writePrimitive(" + resolved_accessor + ");"); \ \ return ResolveOptionalBlock(accessor, block_if_data, typenavigator); \ } \ @@ -112,8 +113,8 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr upperType##Serializer::getReadBlock(const std::string& accessor) const \ { \ CppBlockPtr b = CppBlockPtr(new CppBlock()); \ - \ - b->addLine("r.readPrimitive(" + accessor + ");"); \ + std::string resolved_accessor = ResolveOptionalAccessor(accessor, typenavigator); \ + b->addLine("r.readPrimitive(" + resolved_accessor + ");"); \ return b; \ } \ \ diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/typeReader/xml/ReaderFactory.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/typeReader/xml/ReaderFactory.cpp index 4d65cf804..ac53b26da 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/typeReader/xml/ReaderFactory.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/typeReader/xml/ReaderFactory.cpp @@ -135,11 +135,11 @@ namespace armarx::aron::xmltypereader Data::EnforceAttribute(objectChild, Data::KEY_ATTRIBUTE_NAME); const std::string key = objectChild.attribute_value(Data::KEY_ATTRIBUTE_NAME); - bool is_optional = Data::AttributeIsTrue(objectChild, Data::OPTIONAL_NAME); + bool isOptional = Data::AttributeIsTrue(objectChild, Data::OPTIONAL_NAME); std::vector<RapidXmlReaderNode> children = objectChild.nodes(); typenavigator::NavigatorPtr childNavigator = create(children[0], Path(path, key)); - childNavigator->setOptional(is_optional); + childNavigator->setOptional(isOptional); aronObjectType->addMemberType(key, childNavigator); } ObjectGenerationStack.pop(); @@ -154,6 +154,7 @@ namespace armarx::aron::xmltypereader { // We are a public top level class. Add to AllPublicObjects AllPublicObjects.insert(std::make_pair(simox::alg::to_lower(newObject->typeName), newObject)); + aronObjectType = typenavigator::ObjectNavigator::DynamicCastAndCheck(ResolveTypename(simox::alg::to_lower(newObject->typeName))); // make a copy } return aronObjectType; @@ -168,9 +169,9 @@ namespace armarx::aron::xmltypereader Data::EnforceChildSize(node, 1); std::vector<RapidXmlReaderNode> listTypeNodeChildren = node.nodes(); const RapidXmlReaderNode typeNode = listTypeNodeChildren[0]; - bool is_optional = Data::AttributeIsTrue(typeNode, Data::OPTIONAL_NAME); + bool isOptional = Data::AttributeIsTrue(typeNode, Data::OPTIONAL_NAME); typenavigator::NavigatorPtr type = create(typeNode, Path(path, "type")); - type->setOptional(is_optional); + type->setOptional(isOptional); list->setAcceptedType(type); return list; @@ -185,9 +186,9 @@ namespace armarx::aron::xmltypereader Data::EnforceChildSize(node, 1); std::vector<RapidXmlReaderNode> dictTypeNodeChildren = node.nodes(); const RapidXmlReaderNode typeNode = dictTypeNodeChildren[0]; - bool is_optional = Data::AttributeIsTrue(typeNode, Data::OPTIONAL_NAME); + bool isOptional = Data::AttributeIsTrue(typeNode, Data::OPTIONAL_NAME); typenavigator::NavigatorPtr type = create(typeNode, Path(path, "type")); - type->setOptional(is_optional); + type->setOptional(isOptional); dict->setAcceptedType(type); return dict; @@ -212,10 +213,10 @@ namespace armarx::aron::xmltypereader std::vector<RapidXmlReaderNode> typeNodeChildren = tupleTypeDeclarationNode.nodes(); const RapidXmlReaderNode typeNode = typeNodeChildren[0]; - bool is_optional = Data::AttributeIsTrue(typeNode, Data::OPTIONAL_NAME); + bool isOptional = Data::AttributeIsTrue(typeNode, Data::OPTIONAL_NAME); typenavigator::NavigatorPtr type = create(typeNode, Path(path, "<" + std::to_string(i++) + ">")); - type->setOptional(is_optional); + type->setOptional(isOptional); tuple->addAcceptedType(type); } @@ -239,20 +240,20 @@ namespace armarx::aron::xmltypereader std::vector<RapidXmlReaderNode> type1NodeChildren = nodeChildren[0].nodes(); const RapidXmlReaderNode type1Node = type1NodeChildren[0]; - bool is_optional1 = Data::AttributeIsTrue(type1Node, Data::OPTIONAL_NAME); + bool isOptional1 = Data::AttributeIsTrue(type1Node, Data::OPTIONAL_NAME); typenavigator::NavigatorPtr type1 = create(type1Node, Path(path, std::to_string(0))); - type1->setOptional(is_optional1); + type1->setOptional(isOptional1); pair->setFirstAcceptedType(type1); Data::EnforceChildSize(nodeChildren[1], 1); std::vector<RapidXmlReaderNode> type2NodeChildren = nodeChildren[1].nodes(); const RapidXmlReaderNode type2Node = type2NodeChildren[0]; - bool is_optional2 = Data::AttributeIsTrue(type2Node, Data::OPTIONAL_NAME); + bool isOptional2 = Data::AttributeIsTrue(type2Node, Data::OPTIONAL_NAME); typenavigator::NavigatorPtr type2 = create(type2Node, Path(path, std::to_string(1))); - type2->setOptional(is_optional2); + type2->setOptional(isOptional2); pair->setSecondAcceptedType(type2); return pair; diff --git a/source/RobotAPI/libraries/aron/core/io/typeIO/Reader.h b/source/RobotAPI/libraries/aron/core/io/typeIO/Reader.h index d3ea62010..52a707936 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/Reader.h +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/Reader.h @@ -42,7 +42,7 @@ namespace armarx::aron::typeIO { std::string name; unsigned int elements; - bool is_optional; + bool isOptional; }; virtual ReadStartObjectReturnType readStartObject() = 0; virtual bool readEndObject() = 0; @@ -50,7 +50,7 @@ namespace armarx::aron::typeIO struct ReadStartListReturnType { unsigned int elements; - bool is_optional; + bool isOptional; }; virtual ReadStartListReturnType readStartList() = 0; virtual bool readEndList() = 0; @@ -58,7 +58,7 @@ namespace armarx::aron::typeIO struct ReadStartDictReturnType { unsigned int elements; - bool is_optional; + bool isOptional; }; virtual ReadStartDictReturnType readStartDict() = 0; virtual bool readEndDict() = 0; @@ -66,7 +66,7 @@ namespace armarx::aron::typeIO struct ReadStartTupleReturnType { unsigned int elements; - bool is_optional; + bool isOptional; }; virtual ReadStartTupleReturnType readStartTuple() = 0; virtual bool readEndTuple() = 0; @@ -74,7 +74,7 @@ namespace armarx::aron::typeIO struct ReadStartPairReturnType { unsigned int elements; - bool is_optional; + bool isOptional; }; virtual ReadStartPairReturnType readStartPair() = 0; virtual bool readEndPair() = 0; @@ -83,14 +83,14 @@ namespace armarx::aron::typeIO { std::vector<int> dimensions; std::string type; - bool is_optional; + bool isOptional; }; virtual ReadEigenMatrixReturnType readEigenMatrix() = 0; struct ReadEigenQuaternionReturnType { std::string type; - bool is_optional; + bool isOptional; }; virtual ReadEigenQuaternionReturnType readEigenQuaternion() = 0; @@ -99,7 +99,7 @@ namespace armarx::aron::typeIO unsigned int width; unsigned int height; std::string type; - bool is_optional; + bool isOptional; }; virtual ReadIVTCbyteImageReturnType readIVTCByteImage() = 0; @@ -107,7 +107,7 @@ namespace armarx::aron::typeIO { std::vector<int> dimensions; std::string type; - bool is_optional; + bool isOptional; }; virtual ReadOpenCVMatReturnType readOpenCVMat() = 0; @@ -116,31 +116,31 @@ namespace armarx::aron::typeIO unsigned int width; unsigned int height; std::string type; - bool is_optional; + bool isOptional; }; virtual ReadPCLPointCloudReturnType readPCLPointCloud() = 0; struct ReadPositionReturnType { - bool is_optional; + bool isOptional; }; virtual ReadPositionReturnType readPosition() = 0; struct ReadOrientationReturnType { - bool is_optional; + bool isOptional; }; virtual ReadOrientationReturnType readOrientation() = 0; struct ReadPoseReturnType { - bool is_optional; + bool isOptional; }; virtual ReadPoseReturnType readPose() = 0; struct ReadPrimitiveReturnType { - bool is_optional; + bool isOptional; }; virtual ReadPrimitiveReturnType readInt() = 0; virtual ReadPrimitiveReturnType readLong() = 0; diff --git a/source/RobotAPI/libraries/aron/core/io/typeIO/Writer.h b/source/RobotAPI/libraries/aron/core/io/typeIO/Writer.h index 58f5bcc32..761d2d964 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/Writer.h +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/Writer.h @@ -42,35 +42,35 @@ namespace armarx::aron::typeIO struct WriteStartObjectInput { std::string name; - bool is_optional; + bool isOptional; }; virtual void writeStartObject(const WriteStartObjectInput&) = 0; virtual void writeEndObject() = 0; struct WriteStartListInput { - bool is_optional; + bool isOptional; }; virtual void writeStartList(const WriteStartListInput&) = 0; virtual void writeEndList() = 0; struct WriteStartDictInput { - bool is_optional; + bool isOptional; }; virtual void writeStartDict(const WriteStartDictInput&) = 0; virtual void writeEndDict() = 0; struct WriteStartTupleInput { - bool is_optional; + bool isOptional; }; virtual void writeStartTuple(const WriteStartTupleInput&) = 0; virtual void writeEndTuple() = 0; struct WriteStartPairInput { - bool is_optional; + bool isOptional; }; virtual void writeStartPair(const WriteStartPairInput&) = 0; virtual void writeEndPair() = 0; @@ -79,14 +79,14 @@ namespace armarx::aron::typeIO { std::vector<int> dimensions; std::string type; - bool is_optional; + bool isOptional; }; virtual void writeEigenMatrix(const WriteEigenMatrixInput&) = 0; struct WriteEigenQuaternionInput { std::string type; - bool is_optional; + bool isOptional; }; virtual void writeEigenQuaternion(const WriteEigenQuaternionInput&) = 0; @@ -95,7 +95,7 @@ namespace armarx::aron::typeIO unsigned int width; unsigned int height; std::string type; - bool is_optional; + bool isOptional; }; virtual void writeIVTCByteImage(const WriteIVTCByteImageInput&) = 0; @@ -103,7 +103,7 @@ namespace armarx::aron::typeIO { std::vector<int> dimensions; std::string type; - bool is_optional; + bool isOptional; }; virtual void writeOpenCVMat(const WriteOpenCVMatInput&) = 0; @@ -112,31 +112,31 @@ namespace armarx::aron::typeIO unsigned int width; unsigned int height; std::string type; - bool is_optional; + bool isOptional; }; virtual void writePCLPointCloud(const WritePCLPointCloudInput&) = 0; struct WritePositionInput { - bool is_optional; + bool isOptional; }; virtual void writePosition(const WritePositionInput&) = 0; struct WriteOrientationInput { - bool is_optional; + bool isOptional; }; virtual void writeOrientation(const WriteOrientationInput&) = 0; struct WritePoseInput { - bool is_optional; + bool isOptional; }; virtual void writePose(const WritePoseInput&) = 0; struct WritePrimitiveInput { - bool is_optional; + bool isOptional; }; virtual void writeInt(const WritePrimitiveInput&) = 0; virtual void writeLong(const WritePrimitiveInput&) = 0; diff --git a/source/RobotAPI/libraries/aron/core/io/typeIO/converter/Converter.cpp b/source/RobotAPI/libraries/aron/core/io/typeIO/converter/Converter.cpp index 9750bfc93..742a4063e 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/converter/Converter.cpp +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/converter/Converter.cpp @@ -35,7 +35,7 @@ namespace armarx::aron::typeIO case type::Descriptor::eObject: { const auto readStartObject = reader.readStartObject(); - writer.writeStartObject({readStartObject.name, readStartObject.is_optional}); + writer.writeStartObject({readStartObject.name, readStartObject.isOptional}); for (unsigned int i = 0; i < readStartObject.elements; ++i) { @@ -51,7 +51,7 @@ namespace armarx::aron::typeIO case type::Descriptor::eDict: { const auto readStartDict = reader.readStartDict(); - writer.writeStartDict({readStartDict.is_optional}); + writer.writeStartDict({readStartDict.isOptional}); Converter::ReadAndConvert(reader, writer); @@ -62,7 +62,7 @@ namespace armarx::aron::typeIO case type::Descriptor::eTuple: { const auto readStartTuple = reader.readStartTuple(); - writer.writeStartTuple({readStartTuple.is_optional}); + writer.writeStartTuple({readStartTuple.isOptional}); for (unsigned int i = 0; i < readStartTuple.elements; ++i) { @@ -76,7 +76,7 @@ namespace armarx::aron::typeIO case type::Descriptor::eList: { const auto readStartList = reader.readStartList(); - writer.writeStartList({readStartList.is_optional}); + writer.writeStartList({readStartList.isOptional}); Converter::ReadAndConvert(reader, writer); @@ -87,91 +87,91 @@ namespace armarx::aron::typeIO case type::Descriptor::eEigenMatrix: { const auto readEigenMatrix = reader.readEigenMatrix(); - writer.writeEigenMatrix({readEigenMatrix.dimensions, readEigenMatrix.type, readEigenMatrix.is_optional}); + writer.writeEigenMatrix({readEigenMatrix.dimensions, readEigenMatrix.type, readEigenMatrix.isOptional}); break; } case type::Descriptor::eEigenQuaternion: { const auto readEigenQuaternion = reader.readEigenQuaternion(); - writer.writeEigenQuaternion({readEigenQuaternion.type, readEigenQuaternion.is_optional}); + writer.writeEigenQuaternion({readEigenQuaternion.type, readEigenQuaternion.isOptional}); break; } case type::Descriptor::eIVTCByteImage: { const auto readIVTCByteImage = reader.readIVTCByteImage(); - writer.writeIVTCByteImage({readIVTCByteImage.width, readIVTCByteImage.height, readIVTCByteImage.type, readIVTCByteImage.is_optional}); + writer.writeIVTCByteImage({readIVTCByteImage.width, readIVTCByteImage.height, readIVTCByteImage.type, readIVTCByteImage.isOptional}); break; } case type::Descriptor::eOpenCVMat: { const auto readOpenCVMat = reader.readOpenCVMat(); - writer.writeOpenCVMat({readOpenCVMat.dimensions, readOpenCVMat.type, readOpenCVMat.is_optional}); + writer.writeOpenCVMat({readOpenCVMat.dimensions, readOpenCVMat.type, readOpenCVMat.isOptional}); break; } case type::Descriptor::ePCLPointCloud: { const auto readPCLPointCloud = reader.readPCLPointCloud(); - writer.writePCLPointCloud({readPCLPointCloud.width, readPCLPointCloud.height, readPCLPointCloud.type, readPCLPointCloud.is_optional}); + writer.writePCLPointCloud({readPCLPointCloud.width, readPCLPointCloud.height, readPCLPointCloud.type, readPCLPointCloud.isOptional}); break; } case type::Descriptor::ePosition: { const auto readPosition = reader.readPosition(); - writer.writePosition({readPosition.is_optional}); + writer.writePosition({readPosition.isOptional}); break; } case type::Descriptor::eOrientation: { const auto readOrientation = reader.readOrientation(); - writer.writeOrientation({readOrientation.is_optional}); + writer.writeOrientation({readOrientation.isOptional}); break; } case type::Descriptor::ePose: { const auto readPose = reader.readPose(); - writer.writePose({readPose.is_optional}); + writer.writePose({readPose.isOptional}); break; } case type::Descriptor::eInt: { const auto readInt = reader.readInt(); - writer.writeInt({readInt.is_optional}); + writer.writeInt({readInt.isOptional}); break; } case type::Descriptor::eLong: { const auto readLong = reader.readLong(); - writer.writeLong({readLong.is_optional}); + writer.writeLong({readLong.isOptional}); break; } case type::Descriptor::eFloat: { const auto readFloat = reader.readFloat(); - writer.writeFloat({readFloat.is_optional}); + writer.writeFloat({readFloat.isOptional}); break; } case type::Descriptor::eDouble: { const auto readDouble = reader.readDouble(); - writer.writeDouble({readDouble.is_optional}); + writer.writeDouble({readDouble.isOptional}); break; } case type::Descriptor::eString: { const auto readString = reader.readString(); - writer.writeString({readString.is_optional}); + writer.writeString({readString.isOptional}); break; } case type::Descriptor::eBool: { const auto readBool = reader.readBool(); - writer.writeBool({readBool.is_optional}); + writer.writeBool({readBool.isOptional}); break; } case type::Descriptor::eTime: { const auto readTime = reader.readTime(); - writer.writeTime({readTime.is_optional}); + writer.writeTime({readTime.isOptional}); break; } default: diff --git a/source/RobotAPI/libraries/aron/core/io/typeIO/visitor/Visitor.cpp b/source/RobotAPI/libraries/aron/core/io/typeIO/visitor/Visitor.cpp index a18cc2daa..942db9a9f 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/visitor/Visitor.cpp +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/visitor/Visitor.cpp @@ -22,6 +22,9 @@ #include <memory> #include <numeric> +// Simox +#include <SimoxUtility/algorithm/vector.hpp> + // Header #include "Visitor.h" @@ -46,7 +49,7 @@ namespace armarx::aron::typeIO case type::Descriptor::eObject: { auto casted = type::AronObjectPtr::dynamicCast(aron); - writer.writeStartObject({casted->objectName, casted->is_optional}); + writer.writeStartObject({casted->objectName, casted->isOptional}); for (const auto& [key, value] : casted->elementTypes) { writer.writeKey(key); @@ -58,7 +61,7 @@ namespace armarx::aron::typeIO case type::Descriptor::eDict: { auto casted = type::AronDictPtr::dynamicCast(aron); - writer.writeStartDict({casted->is_optional}); + writer.writeStartDict({casted->isOptional}); Visitor::VisitAndSetup(writer, casted->acceptedType); writer.writeEndDict(); break; @@ -66,7 +69,7 @@ namespace armarx::aron::typeIO case type::Descriptor::eTuple: { auto casted = type::AronTuplePtr::dynamicCast(aron); - writer.writeStartTuple({casted->is_optional}); + writer.writeStartTuple({casted->isOptional}); for (const auto& value : casted->elementTypes) { Visitor::VisitAndSetup(writer, value); @@ -77,7 +80,7 @@ namespace armarx::aron::typeIO case type::Descriptor::eList: { auto casted = type::AronListPtr::dynamicCast(aron); - writer.writeStartList({casted->is_optional}); + writer.writeStartList({casted->isOptional}); Visitor::VisitAndSetup(writer, casted->acceptedType); writer.writeEndList(); break; @@ -85,91 +88,91 @@ namespace armarx::aron::typeIO case type::Descriptor::eEigenMatrix: { auto casted = type::AronEigenMatrixPtr::dynamicCast(aron); - writer.writeEigenMatrix({casted->dimensions, casted->typeName, casted->is_optional}); + writer.writeEigenMatrix({simox::alg::appended({casted->rows, casted->cols}, casted->otherDimensions), casted->typeName, casted->isOptional}); break; } case type::Descriptor::eEigenQuaternion: { auto casted = type::AronEigenQuaternionPtr::dynamicCast(aron); - writer.writeEigenQuaternion({casted->typeName, casted->is_optional}); + writer.writeEigenQuaternion({casted->typeName, casted->isOptional}); break; } case type::Descriptor::eIVTCByteImage: { auto casted = type::AronIVTCByteImagePtr::dynamicCast(aron); - writer.writeIVTCByteImage({(unsigned int) casted->width, (unsigned int) casted->height, casted->typeName, casted->is_optional}); + writer.writeIVTCByteImage({(unsigned int) casted->width, (unsigned int) casted->height, casted->typeName, casted->isOptional}); break; } case type::Descriptor::eOpenCVMat: { auto casted = type::AronOpenCVMatPtr::dynamicCast(aron); - writer.writeOpenCVMat({casted->dimensions, casted->typeName, casted->is_optional}); + writer.writeOpenCVMat({casted->dimensions, casted->typeName, casted->isOptional}); break; } case type::Descriptor::ePCLPointCloud: { auto casted = type::AronPCLPointCloudPtr::dynamicCast(aron); - writer.writePCLPointCloud({(unsigned int) casted->width, (unsigned int) casted->height, casted->typeName, casted->is_optional}); + writer.writePCLPointCloud({(unsigned int) casted->width, (unsigned int) casted->height, casted->typeName, casted->isOptional}); break; } case type::Descriptor::ePosition: { auto casted = type::AronPositionPtr::dynamicCast(aron); - writer.writePosition({casted->is_optional}); + writer.writePosition({casted->isOptional}); break; } case type::Descriptor::eOrientation: { auto casted = type::AronOrientationPtr::dynamicCast(aron); - writer.writeOrientation({casted->is_optional}); + writer.writeOrientation({casted->isOptional}); break; } case type::Descriptor::ePose: { auto casted = type::AronPosePtr::dynamicCast(aron); - writer.writePose({casted->is_optional}); + writer.writePose({casted->isOptional}); break; } case type::Descriptor::eInt: { auto casted = type::AronIntPtr::dynamicCast(aron); - writer.writeInt({casted->is_optional}); + writer.writeInt({casted->isOptional}); break; } case type::Descriptor::eLong: { auto casted = type::AronLongPtr::dynamicCast(aron); - writer.writeLong({casted->is_optional}); + writer.writeLong({casted->isOptional}); break; } case type::Descriptor::eFloat: { auto casted = type::AronFloatPtr::dynamicCast(aron); - writer.writeFloat({casted->is_optional}); + writer.writeFloat({casted->isOptional}); break; } case type::Descriptor::eDouble: { auto casted = type::AronDoublePtr::dynamicCast(aron); - writer.writeDouble({casted->is_optional}); + writer.writeDouble({casted->isOptional}); break; } case type::Descriptor::eString: { auto casted = type::AronStringPtr::dynamicCast(aron); - writer.writeString({casted->is_optional}); + writer.writeString({casted->isOptional}); break; } case type::Descriptor::eBool: { auto casted = type::AronBoolPtr::dynamicCast(aron); - writer.writeBool({casted->is_optional}); + writer.writeBool({casted->isOptional}); break; } case type::Descriptor::eTime: { auto casted = type::AronTimePtr::dynamicCast(aron); - writer.writeTime({casted->is_optional}); + writer.writeTime({casted->isOptional}); break; } default: diff --git a/source/RobotAPI/libraries/aron/core/io/typeIO/writer/navigator/NavigatorWriter.cpp b/source/RobotAPI/libraries/aron/core/io/typeIO/writer/navigator/NavigatorWriter.cpp index e50169c74..163ec2609 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/writer/navigator/NavigatorWriter.cpp +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/writer/navigator/NavigatorWriter.cpp @@ -58,7 +58,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); auto type = std::make_shared<typenavigator::ObjectNavigator>(path); type->setObjectName(o.name); - type->setOptional(o.is_optional); + type->setOptional(o.isOptional); auto new_token = std::make_shared<NavigatorWriterToken>(type->getDescriptor(), type); stack.push(new_token); } @@ -79,7 +79,7 @@ namespace armarx::aron::typeIO::writer { Path path = generatePath(); auto type = std::make_shared<typenavigator::DictNavigator>(path); - type->setOptional(o.is_optional); + type->setOptional(o.isOptional); auto new_token = std::make_shared<NavigatorWriterToken>(type->getDescriptor(), type); stack.push(new_token); } @@ -100,7 +100,7 @@ namespace armarx::aron::typeIO::writer { Path path = generatePath(); auto type = std::make_shared<typenavigator::ListNavigator>(path); - type->setOptional(o.is_optional); + type->setOptional(o.isOptional); auto new_token = std::make_shared<NavigatorWriterToken>(type->getDescriptor(), type); stack.push(new_token); } @@ -121,7 +121,7 @@ namespace armarx::aron::typeIO::writer { Path path = generatePath(); auto type = std::make_shared<typenavigator::TupleNavigator>(path); - type->setOptional(o.is_optional); + type->setOptional(o.isOptional); auto new_token = std::make_shared<NavigatorWriterToken>(type->getDescriptor(), type); stack.push(new_token); } @@ -142,7 +142,7 @@ namespace armarx::aron::typeIO::writer { Path path = generatePath(); auto type = std::make_shared<typenavigator::PairNavigator>(path); - type->setOptional(o.is_optional); + type->setOptional(o.isOptional); auto new_token = std::make_shared<NavigatorWriterToken>(type->getDescriptor(), type); stack.push(new_token); } @@ -166,7 +166,7 @@ namespace armarx::aron::typeIO::writer typenavigator::EigenMatrixNavigatorPtr aron(new typenavigator::EigenMatrixNavigator(path)); aron->setTypename(o.type); aron->setDimensions(o.dimensions); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -176,7 +176,7 @@ namespace armarx::aron::typeIO::writer NavigatorWriterTokenPtr token = stack.top(); typenavigator::EigenQuaternionNavigatorPtr aron(new typenavigator::EigenQuaternionNavigator(path)); aron->setTypename(o.type); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -188,7 +188,7 @@ namespace armarx::aron::typeIO::writer aron->setTypename(o.type); aron->setWidth(o.width); aron->setHeight(o.height); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -199,7 +199,7 @@ namespace armarx::aron::typeIO::writer typenavigator::OpenCVMatNavigatorPtr aron(new typenavigator::OpenCVMatNavigator(path)); aron->setTypename(o.type); aron->setDimensions(o.dimensions); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -211,7 +211,7 @@ namespace armarx::aron::typeIO::writer aron->setTypename(o.type); aron->setWidth(o.width); aron->setHeight(o.height); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -220,7 +220,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::PositionNavigatorPtr aron(new typenavigator::PositionNavigator(path)); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -229,7 +229,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::OrientationNavigatorPtr aron(new typenavigator::OrientationNavigator(path)); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -238,7 +238,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::PoseNavigatorPtr aron(new typenavigator::PoseNavigator(path)); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -247,7 +247,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::IntNavigatorPtr aron(new typenavigator::IntNavigator(path)); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -256,7 +256,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::LongNavigatorPtr aron(new typenavigator::LongNavigator(path)); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -265,7 +265,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::FloatNavigatorPtr aron(new typenavigator::FloatNavigator(path)); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -274,7 +274,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::DoubleNavigatorPtr aron(new typenavigator::DoubleNavigator(path)); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -283,7 +283,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::StringNavigatorPtr aron(new typenavigator::StringNavigator(path)); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -292,7 +292,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::BoolNavigatorPtr aron(new typenavigator::BoolNavigator(path)); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } @@ -301,7 +301,7 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::TimeNavigatorPtr aron(new typenavigator::TimeNavigator(path)); - aron->setOptional(o.is_optional); + aron->setOptional(o.isOptional); token->addElement(aron); } diff --git a/source/RobotAPI/libraries/aron/core/io/typeIO/writer/nlohmannJSON/NlohmannJSONWriter.cpp b/source/RobotAPI/libraries/aron/core/io/typeIO/writer/nlohmannJSON/NlohmannJSONWriter.cpp index af8b31837..5ca58566d 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/writer/nlohmannJSON/NlohmannJSONWriter.cpp +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/writer/nlohmannJSON/NlohmannJSONWriter.cpp @@ -30,7 +30,7 @@ namespace armarx::aron::typeIO::writer { nlohmann::json data; data[io::Data::READER_WRITER_NAME_SLUG] = o.name; - data[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + data[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; auto new_token = std::make_shared<NlohmannJSONWriterToken>(type::Descriptor::eObject, data); stack.push(new_token); } @@ -50,7 +50,7 @@ namespace armarx::aron::typeIO::writer void NlohmannJSONWriter::writeStartList(const WriteStartListInput& o) { nlohmann::json data; - data[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + data[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; auto new_token = std::make_shared<NlohmannJSONWriterToken>(type::Descriptor::eList, data); stack.push(new_token); } @@ -70,7 +70,7 @@ namespace armarx::aron::typeIO::writer void NlohmannJSONWriter::writeStartDict(const WriteStartDictInput& o) { nlohmann::json data; - data[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + data[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; auto new_token = std::make_shared<NlohmannJSONWriterToken>(type::Descriptor::eDict, data); stack.push(new_token); } @@ -90,7 +90,7 @@ namespace armarx::aron::typeIO::writer void NlohmannJSONWriter::writeStartTuple(const WriteStartTupleInput& o) { nlohmann::json data; - data[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + data[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; auto new_token = std::make_shared<NlohmannJSONWriterToken>(type::Descriptor::eTuple, data); stack.push(new_token); } @@ -110,7 +110,7 @@ namespace armarx::aron::typeIO::writer void NlohmannJSONWriter::writeStartPair(const WriteStartPairInput& o) { nlohmann::json data; - data[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + data[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; auto new_token = std::make_shared<NlohmannJSONWriterToken>(type::Descriptor::ePair, data); stack.push(new_token); } @@ -131,7 +131,7 @@ namespace armarx::aron::typeIO::writer { auto token = stack.top(); nlohmann::json j; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; j[io::Data::READER_WRITER_NDARRAY_NAME_SLUG] = "EigenMatrix"; j[io::Data::READER_WRITER_NDARRAY_DIMENSIONS_SLUG] = o.dimensions; j[io::Data::READER_WRITER_NDARRAY_TYPE_SLUG] = o.type; @@ -142,7 +142,7 @@ namespace armarx::aron::typeIO::writer { auto token = stack.top(); nlohmann::json j; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; j[io::Data::READER_WRITER_NDARRAY_NAME_SLUG] = "EigenQuaternion"; j[io::Data::READER_WRITER_NDARRAY_TYPE_SLUG] = o.type; token->addElement(j); @@ -152,7 +152,7 @@ namespace armarx::aron::typeIO::writer { auto token = stack.top(); nlohmann::json j; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; j[io::Data::READER_WRITER_NDARRAY_NAME_SLUG] = "IVTCByteImage"; j[io::Data::READER_WRITER_NDARRAY_DIMENSIONS_SLUG] = {o.width, o.height}; j[io::Data::READER_WRITER_NDARRAY_TYPE_SLUG] = o.type; @@ -163,7 +163,7 @@ namespace armarx::aron::typeIO::writer { auto token = stack.top(); nlohmann::json j; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; j[io::Data::READER_WRITER_NDARRAY_NAME_SLUG] = "OpenCVMat"; j[io::Data::READER_WRITER_NDARRAY_DIMENSIONS_SLUG] = o.dimensions; j[io::Data::READER_WRITER_NDARRAY_TYPE_SLUG] = o.type; @@ -174,7 +174,7 @@ namespace armarx::aron::typeIO::writer { auto token = stack.top(); nlohmann::json j; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; j[io::Data::READER_WRITER_NDARRAY_NAME_SLUG] = "PCLPointCloud"; j[io::Data::READER_WRITER_NDARRAY_DIMENSIONS_SLUG] = {o.width, o.height}; j[io::Data::READER_WRITER_NDARRAY_TYPE_SLUG] = o.type; @@ -185,7 +185,7 @@ namespace armarx::aron::typeIO::writer { auto token = stack.top(); nlohmann::json j; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; j[io::Data::READER_WRITER_NDARRAY_NAME_SLUG] = "Position"; token->addElement(j); } @@ -194,7 +194,7 @@ namespace armarx::aron::typeIO::writer { auto token = stack.top(); nlohmann::json j; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; j[io::Data::READER_WRITER_NDARRAY_NAME_SLUG] = "Orientation"; token->addElement(j); } @@ -203,7 +203,7 @@ namespace armarx::aron::typeIO::writer { auto token = stack.top(); nlohmann::json j; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; j[io::Data::READER_WRITER_NDARRAY_NAME_SLUG] = "Pose"; token->addElement(j); } @@ -213,7 +213,7 @@ namespace armarx::aron::typeIO::writer auto token = stack.top(); nlohmann::json j; j[io::Data::READER_WRITER_PRIMITIVE_NAME_SLUG] = io::Data::READER_WRITER_INT_TYPENAME_SLUG; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; token->addElement(j); } @@ -222,7 +222,7 @@ namespace armarx::aron::typeIO::writer auto token = stack.top(); nlohmann::json j; j[io::Data::READER_WRITER_PRIMITIVE_NAME_SLUG] = io::Data::READER_WRITER_LONG_TYPENAME_SLUG; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; token->addElement(j); } @@ -231,7 +231,7 @@ namespace armarx::aron::typeIO::writer auto token = stack.top(); nlohmann::json j; j[io::Data::READER_WRITER_PRIMITIVE_NAME_SLUG] = io::Data::READER_WRITER_FLOAT_TYPENAME_SLUG; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; token->addElement(j); } @@ -240,7 +240,7 @@ namespace armarx::aron::typeIO::writer auto token = stack.top(); nlohmann::json j; j[io::Data::READER_WRITER_PRIMITIVE_NAME_SLUG] = io::Data::READER_WRITER_DOUBLE_TYPENAME_SLUG; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; token->addElement(j); } @@ -249,7 +249,7 @@ namespace armarx::aron::typeIO::writer auto token = stack.top(); nlohmann::json j; j[io::Data::READER_WRITER_PRIMITIVE_NAME_SLUG] = io::Data::READER_WRITER_STRING_TYPENAME_SLUG; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; token->addElement(j); } @@ -258,7 +258,7 @@ namespace armarx::aron::typeIO::writer auto token = stack.top(); nlohmann::json j; j[io::Data::READER_WRITER_PRIMITIVE_NAME_SLUG] = io::Data::READER_WRITER_BOOL_TYPENAME_SLUG; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; token->addElement(j); } @@ -267,7 +267,7 @@ namespace armarx::aron::typeIO::writer auto token = stack.top(); nlohmann::json j; j[io::Data::READER_WRITER_PRIMITIVE_NAME_SLUG] = io::Data::READER_WRITER_TIME_TYPENAME_SLUG; - j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.is_optional; + j[io::Data::READER_WRITER_OPTIONAL_SLUG] = o.isOptional; token->addElement(j); } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/container/Dict.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/container/Dict.cpp index 386b276aa..e3ccd105f 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/container/Dict.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/container/Dict.cpp @@ -99,12 +99,12 @@ namespace armarx::aron::typenavigator void DictNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool DictNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/container/List.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/container/List.cpp index 690d50557..400ccdf22 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/container/List.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/container/List.cpp @@ -98,11 +98,11 @@ namespace armarx::aron::typenavigator void ListNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool ListNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/container/Object.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/container/Object.cpp index 32e8b09e0..4fda595bb 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/container/Object.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/container/Object.cpp @@ -181,12 +181,12 @@ namespace armarx::aron::typenavigator void ObjectNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool ObjectNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/container/Pair.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/container/Pair.cpp index 95c4edca4..10c34bf24 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/container/Pair.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/container/Pair.cpp @@ -132,12 +132,12 @@ namespace armarx::aron::typenavigator void PairNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool PairNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/container/Tuple.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/container/Tuple.cpp index cf76c0afa..336058d2b 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/container/Tuple.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/container/Tuple.cpp @@ -115,12 +115,12 @@ namespace armarx::aron::typenavigator void TupleNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool TupleNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/enum/IntEnum.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/enum/IntEnum.cpp index 26791f2d6..825988af0 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/enum/IntEnum.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/enum/IntEnum.cpp @@ -120,12 +120,12 @@ namespace armarx::aron::typenavigator void IntEnumNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool IntEnumNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.cpp index 064e71c77..2ced1ba21 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.cpp @@ -24,16 +24,16 @@ // Header #include "EigenMatrix.h" +// Simox +#include <SimoxUtility/algorithm/vector.hpp> + namespace armarx::aron::typenavigator { // constructors EigenMatrixNavigator::EigenMatrixNavigator(const Path& path) : aron::Navigator<type::Descriptor, type::AronType>::Navigator(type::Descriptor::eEigenMatrix, path), Navigator(type::Descriptor::eEigenMatrix, path), - type(new type::AronEigenMatrix(false, - { - 1, 1 - }, "")) + type(new type::AronEigenMatrix(true, -1, -1, {}, "")) { } @@ -42,75 +42,88 @@ namespace armarx::aron::typenavigator Navigator(type::Descriptor::eEigenMatrix, path), type(new type::AronEigenMatrix(*o)) { - checkDimensions(type->dimensions); + checkDimensions(simox::alg::appended({type->rows, type->cols}, type->otherDimensions)); checkTypename(type->typeName); } bool EigenMatrixNavigator::checkDimensions(const std::vector<int>& d) const { - if (d.size() < ACCEPTED_DIMENSION_MIN_SIZE) + if (isOptional() && d == std::vector<int> {-1, -1}) + { + return true; + } + + if (d.size() < 2) { throw error::AronException("AronEigenMatrixNavigator", "checkDimensions", "The dimension size is wrong. Got size: " + std::to_string(d.size()), getPath()); } - if (std::any_of(d.begin(), d.end(), [](int i) - { - return i < -1 || i == 0; - })) + for (const auto& i : d) { - throw error::AronException("AronEigenMatrixNavigator", "checkDimensions", "The dimension size is wrong. At least one empty is < -1 or 0. Got as dimension: " + simox::alg::to_string(d, ", "), getPath()); + if (i == 0 || i < -1) + { + throw error::AronException("AronEigenMatrixNavigator", "checkDimensions", "The dimension size is wrong. Got as dimension: " + simox::alg::to_string(d, ", "), getPath()); + } } return true; } - bool EigenMatrixNavigator::checkTypename(const std::string& s) const + std::string EigenMatrixNavigator::checkTypename(const std::string& s) const { - if (s.empty()) + if (isOptional() && s == "") { - throw error::AronException("AronEigenMatrixNavigator", "checkTypename", "The typename is empty.", getPath()); + return s; } - if (!std::any_of(ACCEPTED_TYPES.begin(), ACCEPTED_TYPES.end(), [s](const auto & el) - { - return s == el.first || std::find(el.second.begin(), el.second.end(), s) != el.second.end(); - })) + for (const auto& [key, list] : ACCEPTED_TYPES) { - throw error::AronException("AronEigenMatrixNavigator", "checkTypename", "The typename is wrong. Got " + s, getPath()); + if (s == key) + { + return key; + } + + for (const auto& el : list) + { + if (s == el) + { + return key; + } + } } - return true; + throw error::StringNotValidException("EigenMatrixNavigator", "checkTypename", "The typename is wrong.", s, getPath()); } unsigned int EigenMatrixNavigator::getRows() const { - return type->dimensions[0]; + return type->rows; } unsigned int EigenMatrixNavigator::getCols() const { - return type->dimensions[1]; + return type->cols; } - void EigenMatrixNavigator::setRows(const unsigned int& w) + void EigenMatrixNavigator::setRows(int w) { - if (w == 0) + if (w == 0 || w < -1) { - throw error::AronException("AronEigenMatrixNavigator", "setRows", "The rows cannot be 0", getPath()); + throw error::AronException("AronEigenMatrixNavigator", "setRows", "The rows cannot be 0 or < -1", getPath()); } - type->dimensions[0] = w; + type->rows = w; } - void EigenMatrixNavigator::setCols(const unsigned int& h) + void EigenMatrixNavigator::setCols(int h) { - if (h == 0) + if (h == 0 || h < -1) { - throw error::AronException("AronEigenMatrixNavigator", "setCols", "The cols cannot be 0", getPath()); + throw error::AronException("AronEigenMatrixNavigator", "setCols", "The cols cannot be 0 or < -1", getPath()); } - type->dimensions[1] = h; + type->cols = h; } type::AronEigenMatrixPtr EigenMatrixNavigator::toAronEigenMatrixPtr() const { - checkDimensions(type->dimensions); + checkDimensions(simox::alg::appended({type->rows, type->cols}, type->otherDimensions)); checkTypename(type->typeName); return type; } @@ -122,7 +135,7 @@ namespace armarx::aron::typenavigator std::vector<int> EigenMatrixNavigator::getDimensions() const { - return type->dimensions; + return simox::alg::appended({type->rows, type->cols}, type->otherDimensions); } void EigenMatrixNavigator::setTypename(const std::string& u) @@ -134,7 +147,9 @@ namespace armarx::aron::typenavigator void EigenMatrixNavigator::setDimensions(const std::vector<int>& d) { checkDimensions(d); - type->dimensions = d; + type->rows = d[0]; + type->cols = d[1]; + type->otherDimensions = simox::alg::subvector(d, 3); } // static methods @@ -143,6 +158,16 @@ namespace armarx::aron::typenavigator return std::dynamic_pointer_cast<EigenMatrixNavigator>(n); } + EigenMatrixNavigator& EigenMatrixNavigator::DynamicCast(Navigator& n) + { + return dynamic_cast<EigenMatrixNavigator&>(n); + } + + const EigenMatrixNavigator& EigenMatrixNavigator::DynamicCast(const Navigator& n) + { + return dynamic_cast<const EigenMatrixNavigator&>(n); + } + EigenMatrixNavigatorPtr EigenMatrixNavigator::DynamicCastAndCheck(const NavigatorPtr& n) { CheckTypeNavigatorPtrForNull("AronEigenMatrixNavigator", "DynamicCast[Before]", n); @@ -169,17 +194,17 @@ namespace armarx::aron::typenavigator std::string EigenMatrixNavigator::getName() const { - return "AronEigenMatrix<" + simox::alg::to_string(type->dimensions, ", ") + ", " + type->typeName + ">"; + return "AronEigenMatrix<" + simox::alg::to_string(getDimensions(), ", ") + ", " + type->typeName + ">"; } void EigenMatrixNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool EigenMatrixNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.h b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.h index 4cf1839f0..e366ef37f 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.h +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.h @@ -48,15 +48,15 @@ namespace armarx::aron::typenavigator EigenMatrixNavigator(const type::AronEigenMatrixPtr&, const Path& path); bool checkDimensions(const std::vector<int>&) const; - bool checkTypename(const std::string&) const; + std::string checkTypename(const std::string&) const; unsigned int getRows() const; unsigned int getCols() const; std::string getTypename() const; std::vector<int> getDimensions() const; - void setRows(const unsigned int&); - void setCols(const unsigned int&); + void setRows(int); + void setCols(int); void setTypename(const std::string&); void setDimensions(const std::vector<int>&); @@ -64,6 +64,8 @@ namespace armarx::aron::typenavigator // static methods static EigenMatrixNavigatorPtr DynamicCast(const NavigatorPtr& n); + static EigenMatrixNavigator& DynamicCast(Navigator& n); + static const EigenMatrixNavigator& DynamicCast(const Navigator& n); static EigenMatrixNavigatorPtr DynamicCastAndCheck(const NavigatorPtr& n); // virtual implementations @@ -86,7 +88,6 @@ namespace armarx::aron::typenavigator //{"complex float", {"std::complex<float>"}}, //{"complex double", {"std::complex<double>"}}, }; - const unsigned int ACCEPTED_DIMENSION_MIN_SIZE = 2; private: // members diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenQuaternion.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenQuaternion.cpp index b4d8ed39e..399de45d1 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenQuaternion.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenQuaternion.cpp @@ -30,7 +30,7 @@ namespace armarx::aron::typenavigator EigenQuaternionNavigator::EigenQuaternionNavigator(const Path& path) : aron::Navigator<type::Descriptor, type::AronType>::Navigator(type::Descriptor::eEigenQuaternion, path), Navigator(type::Descriptor::eEigenQuaternion, path), - type(new type::AronEigenQuaternion(false, "")) + type(new type::AronEigenQuaternion(true, "")) { } @@ -43,17 +43,22 @@ namespace armarx::aron::typenavigator bool EigenQuaternionNavigator::checkTypename(const std::string& s) const { + if (isOptional()) + { + return true; + } + if (s.empty()) { throw error::AronException("AronEigenQuaternionTypeNavigator", "checkTypename", "The typename is empty.", getPath()); } - if (!std::any_of(ACCEPTED_TYPES.begin(), ACCEPTED_TYPES.end(), [s](const auto & el) - { - return s == el.first || std::find(el.second.begin(), el.second.end(), s) != el.second.end(); - })) + for (const auto& [k, t] : ACCEPTED_TYPES) { - throw error::AronException("AronEigenQuaternionTypeNavigator", "checkTypename", "The typename is wrong. Got " + s, getPath()); + if (s != k && std::find(t.begin(), t.end(), s) == t.end()) + { + throw error::AronException("AronEigenQuaternionTypeNavigator", "checkTypename", "The typename is wrong. Got " + s, getPath()); + } } return true; } @@ -117,12 +122,12 @@ namespace armarx::aron::typenavigator void EigenQuaternionNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool EigenQuaternionNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/IVTCByteImage.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/IVTCByteImage.cpp index 8155f1be1..ac72b5f15 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/IVTCByteImage.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/IVTCByteImage.cpp @@ -30,7 +30,7 @@ namespace armarx::aron::typenavigator IVTCByteImageNavigator::IVTCByteImageNavigator(const Path& path) : aron::Navigator<type::Descriptor, type::AronType>::Navigator(type::Descriptor::eIVTCByteImage, path), Navigator(type::Descriptor::eIVTCByteImage, path), - type(new type::AronIVTCByteImage(false, 0, 0, "")) + type(new type::AronIVTCByteImage(true, -1, -1, "")) { } @@ -43,6 +43,11 @@ namespace armarx::aron::typenavigator std::string IVTCByteImageNavigator::checkTypename(const std::string& s) const { + if (isOptional() && s == "") + { + return s; + } + for (const auto& [key, list] : ACCEPTED_TYPES) { if (s == key) @@ -58,7 +63,7 @@ namespace armarx::aron::typenavigator } } } - throw error::AronException("AronIVTCByteImageTypeNavigator", "checkTypename", "The typename is empty.", getPath()); + throw error::StringNotValidException("IVTCByteImageNavigator", "checkTypename", "The typename is wrong.", s, getPath()); } type::AronIVTCByteImagePtr IVTCByteImageNavigator::toAronIVTCByteImagePtr() const @@ -147,12 +152,12 @@ namespace armarx::aron::typenavigator void IVTCByteImageNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool IVTCByteImageNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/NDArray.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/NDArray.cpp index f4c471c4c..b5ec2ccce 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/NDArray.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/NDArray.cpp @@ -30,7 +30,7 @@ namespace armarx::aron::typenavigator NDArrayNavigator::NDArrayNavigator(const Path& path) : aron::Navigator<type::Descriptor, type::AronType>::Navigator(type::Descriptor::eNDArray, path), Navigator(type::Descriptor::eNDArray, path), - type(new type::AronNDArray(false, {}, "")) + type(new type::AronNDArray(true, {}, "")) { } @@ -118,12 +118,12 @@ namespace armarx::aron::typenavigator void NDArrayNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool NDArrayNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/OpenCVMat.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/OpenCVMat.cpp index db77cf3ec..ad7e19e11 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/OpenCVMat.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/OpenCVMat.cpp @@ -30,7 +30,7 @@ namespace armarx::aron::typenavigator OpenCVMatNavigator::OpenCVMatNavigator(const Path& path) : aron::Navigator<type::Descriptor, type::AronType>::Navigator(type::Descriptor::eOpenCVMat, path), Navigator(type::Descriptor::eOpenCVMat, path), - type(new type::AronOpenCVMat(false, {}, "")) + type(new type::AronOpenCVMat(true, {}, "")) { } @@ -146,12 +146,12 @@ namespace armarx::aron::typenavigator void OpenCVMatNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool OpenCVMatNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Orientation.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Orientation.cpp index 0e768b654..c31db0b5b 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Orientation.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Orientation.cpp @@ -30,7 +30,7 @@ namespace armarx::aron::typenavigator OrientationNavigator::OrientationNavigator(const Path& path) : aron::Navigator<type::Descriptor, type::AronType>::Navigator(type::Descriptor::eOrientation, path), Navigator(type::Descriptor::eOrientation, path), - type(new type::AronOrientation()) + type(new type::AronOrientation(true)) { } @@ -93,12 +93,12 @@ namespace armarx::aron::typenavigator void OrientationNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool OrientationNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.cpp index 5aa5cd89f..b66ce47fb 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.cpp @@ -30,7 +30,7 @@ namespace armarx::aron::typenavigator PCLPointCloudNavigator::PCLPointCloudNavigator(const Path& path) : aron::Navigator<type::Descriptor, type::AronType>::Navigator(type::Descriptor::ePCLPointCloud, path), Navigator(type::Descriptor::ePCLPointCloud, path), - type(new type::AronPCLPointCloud(false, 0, 0, "")) + type(new type::AronPCLPointCloud(true, -1, -1, "")) { } @@ -149,12 +149,12 @@ namespace armarx::aron::typenavigator void PCLPointCloudNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool PCLPointCloudNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Pose.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Pose.cpp index 0844950b9..5f165f016 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Pose.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Pose.cpp @@ -30,7 +30,7 @@ namespace armarx::aron::typenavigator PoseNavigator::PoseNavigator(const Path& path) : aron::Navigator<type::Descriptor, type::AronType>::Navigator(type::Descriptor::ePose, path), Navigator(type::Descriptor::ePose, path), - type(new type::AronPose()) + type(new type::AronPose(true)) { } @@ -93,12 +93,12 @@ namespace armarx::aron::typenavigator void PoseNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool PoseNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Position.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Position.cpp index 0fe6ed842..13898a188 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Position.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Position.cpp @@ -30,7 +30,7 @@ namespace armarx::aron::typenavigator PositionNavigator::PositionNavigator(const Path& path) : aron::Navigator<type::Descriptor, type::AronType>::Navigator(type::Descriptor::ePosition, path), Navigator(type::Descriptor::ePosition, path), - type(new type::AronPosition()) + type(new type::AronPosition(true)) { } @@ -93,12 +93,12 @@ namespace armarx::aron::typenavigator void PositionNavigator::setOptional(bool v) { - type->is_optional = v; + type->isOptional = v; } bool PositionNavigator::isOptional() const { - return type->is_optional; + return type->isOptional; } } diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/primitive/Primitive.cpp b/source/RobotAPI/libraries/aron/core/navigator/type/primitive/Primitive.cpp index 227155e7e..344b61d71 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/primitive/Primitive.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/primitive/Primitive.cpp @@ -92,12 +92,12 @@ namespace armarx::aron::typenavigator \ void upperType##Navigator::setOptional(bool v) \ { \ - type->is_optional = v; \ + type->isOptional = v; \ } \ \ bool upperType##Navigator::isOptional() const \ { \ - return type->is_optional; \ + return type->isOptional; \ } HANDLE_PRIMITIVE_TYPES -- GitLab