From 6c2f894532ffd6c6f426dd88e1f30d9fdcd23ff8 Mon Sep 17 00:00:00 2001 From: "fabian.peller-konrad@kit.edu" <fabian.peller-konrad@kit.edu> Date: Wed, 5 May 2021 15:45:20 +0200 Subject: [PATCH] optional updates, an arontype does not contain dynamic information anymore --- .../server/ExampleMemory/ExampleMemory.cpp | 2 +- .../ExampleMemory/test/ExampleMemoryTest.cpp | 2 +- source/RobotAPI/interface/aron/Aron.ice | 12 +-- .../armem_gui/instance/sanitize_typename.cpp | 2 +- .../armem_objects/server/class/Segment.cpp | 2 +- .../armem_objects/server/instance/Segment.cpp | 2 +- .../codegenerator/codeWriter/CodeWriter.h | 2 - .../codeWriter/cpp/AronCppClass.h | 1 - .../codegenerator/codeWriter/cpp/Writer.cpp | 52 ++----------- .../codeWriter/cpp/serializer/Serializer.cpp | 49 ++----------- .../codeWriter/cpp/serializer/Serializer.h | 11 +-- .../cpp/serializer/container/Dict.cpp | 19 +---- .../cpp/serializer/container/Dict.h | 3 +- .../cpp/serializer/container/List.cpp | 17 +---- .../cpp/serializer/container/List.h | 3 +- .../cpp/serializer/container/Object.cpp | 11 +-- .../cpp/serializer/container/Object.h | 3 +- .../cpp/serializer/container/Pair.cpp | 29 +------- .../cpp/serializer/container/Pair.h | 3 +- .../cpp/serializer/container/Tuple.cpp | 23 +----- .../cpp/serializer/container/Tuple.h | 3 +- .../cpp/serializer/enum/IntEnum.cpp | 11 +-- .../codeWriter/cpp/serializer/enum/IntEnum.h | 3 +- .../cpp/serializer/ndarray/EigenMatrix.cpp | 11 +-- .../cpp/serializer/ndarray/EigenMatrix.h | 3 +- .../serializer/ndarray/EigenQuaternion.cpp | 11 +-- .../cpp/serializer/ndarray/EigenQuaternion.h | 3 +- .../cpp/serializer/ndarray/IVTCByteImage.cpp | 15 +--- .../cpp/serializer/ndarray/IVTCByteImage.h | 3 +- .../cpp/serializer/ndarray/NDArray.cpp | 8 +- .../cpp/serializer/ndarray/NDArray.h | 3 +- .../cpp/serializer/ndarray/OpenCVMat.cpp | 28 +------ .../cpp/serializer/ndarray/OpenCVMat.h | 3 +- .../cpp/serializer/ndarray/Orientation.cpp | 13 +--- .../cpp/serializer/ndarray/Orientation.h | 3 +- .../cpp/serializer/ndarray/PCLPointCloud.cpp | 13 +--- .../cpp/serializer/ndarray/PCLPointCloud.h | 3 +- .../cpp/serializer/ndarray/Pose.cpp | 13 +--- .../codeWriter/cpp/serializer/ndarray/Pose.h | 3 +- .../cpp/serializer/ndarray/Position.cpp | 13 +--- .../cpp/serializer/ndarray/Position.h | 3 +- .../cpp/serializer/primitive/Primitive.cpp | 9 +-- .../cpp/serializer/primitive/Primitive.h | 3 +- .../cpp/serializer/toplevel/IntEnumClass.cpp | 9 +-- .../cpp/serializer/toplevel/IntEnumClass.h | 3 +- .../cpp/serializer/toplevel/ObjectClass.cpp | 27 +------ .../cpp/serializer/toplevel/ObjectClass.h | 3 +- .../typeReader/xml/ReaderFactory.cpp | 49 ++++++------- .../libraries/aron/core/io/typeIO/Reader.h | 10 +-- .../libraries/aron/core/io/typeIO/Writer.h | 10 +-- .../core/io/typeIO/converter/Converter.cpp | 8 +- .../reader/navigator/NavigatorReader.cpp | 8 +- .../nlohmannJSON/NlohmannJSONReader.cpp | 15 ++-- .../aron/core/io/typeIO/visitor/Visitor.cpp | 8 +- .../writer/navigator/NavigatorWriter.cpp | 10 +-- .../nlohmannJSON/NlohmannJSONWriter.cpp | 7 +- .../core/navigator/data/complex/NDArray.cpp | 32 ++++---- .../core/navigator/data/complex/NDArray.h | 1 + .../navigator/type/ndarray/EigenMatrix.cpp | 52 ++----------- .../core/navigator/type/ndarray/EigenMatrix.h | 3 - .../type/ndarray/EigenQuaternion.cpp | 29 ++------ .../navigator/type/ndarray/EigenQuaternion.h | 3 +- .../navigator/type/ndarray/IVTCByteImage.cpp | 73 +------------------ .../navigator/type/ndarray/IVTCByteImage.h | 11 --- .../core/navigator/type/ndarray/NDArray.cpp | 2 +- .../core/navigator/type/ndarray/OpenCVMat.cpp | 67 +---------------- .../core/navigator/type/ndarray/OpenCVMat.h | 10 --- .../navigator/type/ndarray/Orientation.cpp | 10 --- .../core/navigator/type/ndarray/Orientation.h | 6 -- .../navigator/type/ndarray/PCLPointCloud.cpp | 39 +--------- .../navigator/type/ndarray/PCLPointCloud.h | 5 -- .../aron/core/navigator/type/ndarray/Pose.cpp | 10 --- .../aron/core/navigator/type/ndarray/Pose.h | 3 - .../core/navigator/type/ndarray/Position.cpp | 10 --- .../core/navigator/type/ndarray/Position.h | 3 - .../core/test/aronDataWithoutCodeGeneration.h | 6 +- .../libraries/aron/core/test/aronTest.cpp | 4 +- .../aron/core/test/xmls/OptionalTest.xml | 24 +++--- 78 files changed, 184 insertions(+), 815 deletions(-) diff --git a/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.cpp b/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.cpp index 8bd030bb8..a86814987 100644 --- a/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.cpp +++ b/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.cpp @@ -63,7 +63,7 @@ namespace armarx workingMemory.name() = p.memoryName; // Usually, the memory server will specify a number of core segments with a specific aron type. - workingMemory.addCoreSegment("ExampleData", armem::example::ExampleData::toInitialAronType()); + workingMemory.addCoreSegment("ExampleData", armem::example::ExampleData::toAronType()); // For illustration purposes, we add more segments (without types). bool trim = true; diff --git a/source/RobotAPI/components/armem/server/ExampleMemory/test/ExampleMemoryTest.cpp b/source/RobotAPI/components/armem/server/ExampleMemory/test/ExampleMemoryTest.cpp index b269993f7..c5ba35a13 100644 --- a/source/RobotAPI/components/armem/server/ExampleMemory/test/ExampleMemoryTest.cpp +++ b/source/RobotAPI/components/armem/server/ExampleMemory/test/ExampleMemoryTest.cpp @@ -39,7 +39,7 @@ namespace armem = armarx::armem; BOOST_AUTO_TEST_CASE(test_ExampleData_type) { - armarx::aron::typenavigator::ObjectNavigatorPtr type = ExampleData::toInitialAronType(); + armarx::aron::typenavigator::ObjectNavigatorPtr type = ExampleData::toAronType(); BOOST_CHECK_EQUAL(type->childrenSize(), 15); diff --git a/source/RobotAPI/interface/aron/Aron.ice b/source/RobotAPI/interface/aron/Aron.ice index 2e7053efc..cf80de715 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 isOptional = true; // Every type can be optional or not + bool isOptional = false; // Every type can be optional or not } sequence<AronType> AronTypeList; dictionary<string, AronType> AronTypeDict; @@ -57,12 +57,12 @@ module armarx class AronDict extends AronType { AronType acceptedType; } // Complex Types (serialize to ndarray) - class AronNDArray extends AronType { AronIntSequence dimensions; string typeName; } - class AronEigenMatrix extends AronType { int rows; int cols; AronIntSequence otherDimensions; string typeName; } + class AronNDArray extends AronType { AronIntSequence dimensions; int elementSize; string typeName; } + class AronEigenMatrix extends AronType { int rows; int cols; 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; } - class AronPCLPointCloud extends AronType { int width; int height; string typeName; } + class AronIVTCByteImage extends AronType { } + class AronOpenCVMat extends AronType { } + class AronPCLPointCloud extends AronType { string typeName; } class AronPosition extends AronType { } class AronOrientation extends AronType { } class AronPose extends AronType { } diff --git a/source/RobotAPI/libraries/armem_gui/instance/sanitize_typename.cpp b/source/RobotAPI/libraries/armem_gui/instance/sanitize_typename.cpp index 9db048145..afe3fdc8f 100644 --- a/source/RobotAPI/libraries/armem_gui/instance/sanitize_typename.cpp +++ b/source/RobotAPI/libraries/armem_gui/instance/sanitize_typename.cpp @@ -7,7 +7,7 @@ #include <RobotAPI/libraries/armem/aron/MemoryID.aron.generated.h> -static const std::string MemoryIDTypeName = armarx::armem::arondto::MemoryID::toInitialAronType()->getName(); +static const std::string MemoryIDTypeName = armarx::armem::arondto::MemoryID::toAronType()->getName(); std::string armarx::armem::gui::instance::sanitizeTypeName(const std::string& typeName) { diff --git a/source/RobotAPI/libraries/armem_objects/server/class/Segment.cpp b/source/RobotAPI/libraries/armem_objects/server/class/Segment.cpp index 38b143f2b..4e4a23991 100644 --- a/source/RobotAPI/libraries/armem_objects/server/class/Segment.cpp +++ b/source/RobotAPI/libraries/armem_objects/server/class/Segment.cpp @@ -42,7 +42,7 @@ namespace armarx::armem::server::obj::clazz { ARMARX_CHECK_NOT_NULL(iceMemory.workingMemory); - coreSegment = &iceMemory.workingMemory->addCoreSegment(p.coreSegmentName, arondto::ObjectClass::toInitialAronType()); + coreSegment = &iceMemory.workingMemory->addCoreSegment(p.coreSegmentName, arondto::ObjectClass::toAronType()); coreSegment->setMaxHistorySize(p.maxHistorySize); if (p.loadFromObjectsPackage) diff --git a/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp b/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp index aa2125dad..669f07612 100644 --- a/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp +++ b/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp @@ -74,7 +74,7 @@ namespace armarx::armem::server::obj::instance { ARMARX_CHECK_NOT_NULL(iceMemory.workingMemory); - coreSegment = &iceMemory.workingMemory->addCoreSegment(p.coreSegmentName, arondto::ObjectInstance::toInitialAronType()); + coreSegment = &iceMemory.workingMemory->addCoreSegment(p.coreSegmentName, arondto::ObjectInstance::toAronType()); coreSegment->setMaxHistorySize(p.maxHistorySize); } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/CodeWriter.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/CodeWriter.h index f2f9b12c2..97dc8570e 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/CodeWriter.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/CodeWriter.h @@ -73,8 +73,6 @@ namespace armarx::aron::codegenerator std::vector<codegeneratorhelper::WriterInfoPtr> dataWriters; std::vector<codegeneratorhelper::ReaderInfoPtr> dataReaders; std::vector<codegeneratorhelper::WriterInfoPtr> initialTypeWriters; - std::vector<codegeneratorhelper::WriterInfoPtr> currentTypeWriters; - std::vector<codegeneratorhelper::ReaderInfoPtr> typeReaders; std::vector<std::string> additionalIncludes; }; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/AronCppClass.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/AronCppClass.h index a95dce2ca..390a0de8b 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/AronCppClass.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/AronCppClass.h @@ -51,6 +51,5 @@ namespace armarx::aron::cppcodegenerator virtual void initialize() = 0; virtual void read(armarx::aron::dataIO::ReaderInterface& r) = 0; virtual void write(armarx::aron::dataIO::WriterInterface& w) const = 0; - virtual void writeCurrentType(armarx::aron::typeIO::WriterInterface& w, bool type_is_optional = false) const = 0; }; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/Writer.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/Writer.cpp index c0d206781..592728007 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/Writer.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/Writer.cpp @@ -77,18 +77,11 @@ namespace armarx::aron::cppcodegenerator { // The toAron Serializer is visible by default codegeneratorhelper::WriterInfoPtr toAronType = codegeneratorhelper::WriterInfoPtr(new codegeneratorhelper::WriterInfo()); - toAronType->methodName = "toInitialAronType"; + toAronType->methodName = "toAronType"; toAronType->returnType = "armarx::aron::typenavigator::ObjectNavigatorPtr"; toAronType->writerClassType = "armarx::aron::typeIO::writer::NavigatorWriter"; toAronType->include = "<RobotAPI/libraries/aron/core/io/typeIO/writer/navigator/NavigatorWriter.h>"; initialTypeWriters.push_back(toAronType); - - // The toAron Serializer is visible by default - codegeneratorhelper::WriterInfoPtr toAronType2 = codegeneratorhelper::WriterInfoPtr(new codegeneratorhelper::WriterInfo()); - toAronType2->methodName = "toCurrentAronType"; - toAronType2->returnType = "armarx::aron::typenavigator::ObjectNavigatorPtr"; - toAronType2->writerClassType = "armarx::aron::typeIO::writer::NavigatorWriter"; - currentTypeWriters.push_back(toAronType2); } void Writer::generateTypeObjects(const std::vector<codegeneratorhelper::GenerateObjectInfoPtr>& generateObjects) @@ -159,12 +152,8 @@ namespace armarx::aron::cppcodegenerator c->addMethod(setup); //std::cout << "Generate writeInit method" << std::endl; - CppMethodPtr writeInitialType = serializer->toWriteInitialTypeMethod(); - c->addMethod(writeInitialType); - - //std::cout << "Generate writeCurrent method" << std::endl; - CppMethodPtr writeCurrentType = serializer->toWriteCurrentTypeMethod(); - c->addMethod(writeCurrentType); + CppMethodPtr writeType = serializer->toWriteTypeMethod(); + c->addMethod(writeType); //std::cout << "Generate write method" << std::endl; CppMethodPtr write = serializer->toWriteMethod(); @@ -203,29 +192,7 @@ namespace armarx::aron::cppcodegenerator { c->addInclude(info->include); } - CppMethodPtr convert = serializer->toSpecializedInitialTypeWriterMethod(info->returnType, info->methodName, info->writerClassType, "armarx::aron::typenavigator::ObjectNavigator::DynamicCast"); - c->addMethod(convert); - } - - // Typewritermethods - for (const codegeneratorhelper::WriterInfoPtr& info : currentTypeWriters) - { - if (!info->include.empty()) - { - c->addInclude(info->include); - } - CppMethodPtr convert = serializer->toSpecializedCurrentTypeWriterMethod(info->returnType, info->methodName, info->writerClassType, "armarx::aron::typenavigator::ObjectNavigator::DynamicCast"); - c->addMethod(convert); - } - - // Add methods to set the member variables - for (const codegeneratorhelper::ReaderInfoPtr& info : typeReaders) - { - if (!info->include.empty()) - { - c->addInclude(info->include); - } - CppMethodPtr convert = serializer->toSpecializedCurrentTypeReaderMethod(info->argumentType, info->methodName, info->readerClassType); + CppMethodPtr convert = serializer->toSpecializedTypeWriterMethod(info->returnType, info->methodName, info->writerClassType, "armarx::aron::typenavigator::ObjectNavigator::DynamicCast"); c->addMethod(convert); } @@ -303,13 +270,9 @@ namespace armarx::aron::cppcodegenerator c->addMethod(setup); //std::cout << "Generate writeInit method" << std::endl; - CppMethodPtr writeInitialType = serializer->toWriteInitialTypeMethod(); + CppMethodPtr writeInitialType = serializer->toWriteTypeMethod(); c->addMethod(writeInitialType); - //std::cout << "Generate writeCurrent method" << std::endl; - CppMethodPtr writeCurrentType = serializer->toWriteCurrentTypeMethod(); - c->addMethod(writeCurrentType); - //std::cout << "Generate write method" << std::endl; CppMethodPtr write = serializer->toWriteMethod(); c->addMethod(write); @@ -353,12 +316,9 @@ namespace armarx::aron::cppcodegenerator CppMethodPtr setup = serializer->toInitializeMethod(); c->addMethod(setup); - CppMethodPtr writeInitialType = serializer->toWriteInitialTypeMethod(); + CppMethodPtr writeInitialType = serializer->toWriteTypeMethod(); c->addMethod(writeInitialType); - CppMethodPtr writeCurrentType = serializer->toWriteCurrentTypeMethod(); - c->addMethod(writeCurrentType); - CppMethodPtr write = serializer->toWriteMethod(); c->addMethod(write); diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/Serializer.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/Serializer.cpp index c5d2bc671..098952c5b 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/Serializer.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/Serializer.cpp @@ -232,26 +232,14 @@ namespace armarx::aron::cppcodegenerator return m; } - CppMethodPtr Serializer::toWriteInitialTypeMethod() const + CppMethodPtr Serializer::toWriteTypeMethod() const { std::stringstream doc; - doc << "@brief writeInitialType() - This method returns a new type from the class structure using a type writer implementation. This function is static. \n"; + doc << "@brief writeType() - This method returns a new type from the class structure using a type writer implementation. This function is static. \n"; doc << "@return - the result of the writer implementation"; - CppMethodPtr m = CppMethodPtr(new CppMethod("static void writeInitialType(armarx::aron::typeIO::WriterInterface& w, bool type_is_optional = false)", doc.str())); - CppBlockPtr b = this->getWriteInitialTypeBlock(""); - m->setBlock(b); - return m; - } - - CppMethodPtr Serializer::toWriteCurrentTypeMethod() const - { - std::stringstream doc; - doc << "@brief writeType() - This method returns a new type from the current class structure using a type writer implementation. \n"; - doc << "@return - the result of the writer implementation"; - - CppMethodPtr m = CppMethodPtr(new CppMethod("void writeCurrentType(armarx::aron::typeIO::WriterInterface& w, bool type_is_optional = false) const override", doc.str())); - CppBlockPtr b = this->getWriteCurrentTypeBlock(""); + CppMethodPtr m = CppMethodPtr(new CppMethod("static void writeType(armarx::aron::typeIO::WriterInterface& w, bool type_is_optional = false)", doc.str())); + CppBlockPtr b = this->getWriteTypeBlock(""); m->setBlock(b); return m; } @@ -307,7 +295,7 @@ namespace armarx::aron::cppcodegenerator return m; } - CppMethodPtr Serializer::toSpecializedInitialTypeWriterMethod(const std::string& returnname, const std::string& methodname, const std::string& writerName, const std::string& enforceConversion) const + CppMethodPtr Serializer::toSpecializedTypeWriterMethod(const std::string& returnname, const std::string& methodname, const std::string& writerName, const std::string& enforceConversion) const { std::stringstream doc; doc << "@brief specializedTypeWrite() - This method returns a new type from the member data types using a writer implementation. \n"; @@ -315,36 +303,11 @@ namespace armarx::aron::cppcodegenerator CppMethodPtr m = CppMethodPtr(new CppMethod("static " + returnname + " " + methodname + "()", doc.str())); m->addLine(writerName + " writer;"); - m->addLine("writeInitialType(writer);"); - m->addLine("return " + enforceConversion + "(writer.getResult());"); - return m; - } - - CppMethodPtr Serializer::toSpecializedCurrentTypeWriterMethod(const std::string& returnname, const std::string& methodname, const std::string& writerName, const std::string& enforceConversion) const - { - std::stringstream doc; - doc << "@brief specializedTypeWrite() - This method returns a new type from the current member data types using a writer implementation. \n"; - doc << "@return - the result of the writer implementation"; - - CppMethodPtr m = CppMethodPtr(new CppMethod(returnname + " " + methodname + "()", doc.str())); - m->addLine(writerName + " writer;"); - m->addLine("this->writeCurrentType(writer);"); + m->addLine("writeType(writer);"); m->addLine("return " + enforceConversion + "(writer.getResult());"); return m; } - CppMethodPtr Serializer::toSpecializedCurrentTypeReaderMethod(const std::string& argumentname, const std::string& methodname, const std::string& readerName, const std::string& enforceConversion) const - { - std::stringstream doc; - doc << "@brief specializedTypeRead() - This method sets the structure of the members to new values given in a reader implementation. \n"; - doc << "@return - nothing"; - - CppMethodPtr m = CppMethodPtr(new CppMethod("void " + methodname + "(const " + argumentname + "& input)", doc.str())); - m->addLine(readerName + " reader(" + enforceConversion + "(input));"); - m->addLine("this->readType(reader);"); - return m; - } - CppMethodPtr Serializer::toEqualsMethod() const { std::stringstream doc; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/Serializer.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/Serializer.h index 8115d8de8..f631e9ecb 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/Serializer.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/Serializer.h @@ -81,9 +81,7 @@ namespace armarx::aron::cppcodegenerator CppMethodPtr toSpecializedDataWriterMethod(const std::string&, const std::string&, const std::string&, const std::string& enforceType = "") const; CppMethodPtr toSpecializedDataReaderMethod(const std::string&, const std::string&, const std::string&, const std::string& enforceType = "") const; - CppMethodPtr toSpecializedInitialTypeWriterMethod(const std::string&, const std::string&, const std::string&, const std::string& enforceType = "") const; - CppMethodPtr toSpecializedCurrentTypeWriterMethod(const std::string&, const std::string&, const std::string&, const std::string& enforceType = "") const; - CppMethodPtr toSpecializedCurrentTypeReaderMethod(const std::string&, const std::string&, const std::string&, const std::string& enforceType = "") const; + CppMethodPtr toSpecializedTypeWriterMethod(const std::string&, const std::string&, const std::string&, const std::string& enforceType = "") const; // virtual override definitions virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const = 0; @@ -95,11 +93,8 @@ namespace armarx::aron::cppcodegenerator CppMethodPtr toResetMethod() const; virtual CppBlockPtr getResetBlock(const std::string&) const = 0; - CppMethodPtr toWriteInitialTypeMethod() const; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const = 0; - - CppMethodPtr toWriteCurrentTypeMethod() const; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const = 0; + CppMethodPtr toWriteTypeMethod() const; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const = 0; CppMethodPtr toInitializeMethod() const; virtual CppBlockPtr getInitializeBlock(const std::string&) const = 0; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Dict.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Dict.cpp index a6978a13e..821574260 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Dict.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Dict.cpp @@ -70,7 +70,7 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr DictSerializer::getWriteInitialTypeBlock(const std::string& accessor) const + CppBlockPtr DictSerializer::getWriteTypeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); b->addLine("w.writeStartDict({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); @@ -79,22 +79,7 @@ namespace armarx::aron::cppcodegenerator::serializer std::string accessor_iterator = escaped_accessor + DICT_ITERATOR_ACCESSOR; auto type_s = FromAronTypeNaviagtorPtr(typenavigator->getAcceptedType()); - CppBlockPtr b2 = type_s->getWriteInitialTypeBlock(type_s->getFullCppTypename()); - b->appendBlock(b2); - b->addLine("w.writeEndDict();"); - return b; - } - - CppBlockPtr DictSerializer::getWriteCurrentTypeBlock(const std::string& accessor) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeStartDict({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); - - std::string escaped_accessor = EscapeAccessor(accessor); - std::string accessor_iterator = escaped_accessor + DICT_ITERATOR_ACCESSOR; - - auto type_s = FromAronTypeNaviagtorPtr(typenavigator->getAcceptedType()); - CppBlockPtr b2 = type_s->getWriteCurrentTypeBlock(type_s->getFullCppTypename()); + CppBlockPtr b2 = type_s->getWriteTypeBlock(type_s->getFullCppTypename()); b->appendBlock(b2); b->addLine("w.writeEndDict();"); return b; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Dict.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Dict.h index 99fa2f7ae..038c2ed40 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Dict.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Dict.h @@ -54,8 +54,7 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/List.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/List.cpp index 5afe9e9b6..ae2428570 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/List.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/List.cpp @@ -68,26 +68,13 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr ListSerializer::getWriteInitialTypeBlock(const std::string&) const + CppBlockPtr ListSerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); b->addLine("w.writeStartList({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); auto type_s = FromAronTypeNaviagtorPtr(typenavigator->getAcceptedType()); - CppBlockPtr b2 = type_s->getWriteInitialTypeBlock(type_s->getFullCppTypename()); - b->appendBlock(b2); - - b->addLine("w.writeEndList();"); - return b; - } - - CppBlockPtr ListSerializer::getWriteCurrentTypeBlock(const std::string&) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeStartList({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); - auto type_s = FromAronTypeNaviagtorPtr(typenavigator->getAcceptedType()); - - CppBlockPtr b2 = type_s->getWriteInitialTypeBlock(type_s->getFullCppTypename()); // TODO: think about having a better solution not ignoting the current type + CppBlockPtr b2 = type_s->getWriteTypeBlock(type_s->getFullCppTypename()); b->appendBlock(b2); b->addLine("w.writeEndList();"); diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/List.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/List.h index e35aaa2d8..3af8f241f 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/List.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/List.h @@ -52,8 +52,7 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Object.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Object.cpp index 7e1aacd7e..31d398f40 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Object.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Object.cpp @@ -82,17 +82,10 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr ObjectSerializer::getWriteInitialTypeBlock(const std::string& accessor) const + CppBlockPtr ObjectSerializer::getWriteTypeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + "::writeInitialType(w, " + std::string(typenavigator->isOptional() ? "true" : "false") + ");"); - return b; - } - - CppBlockPtr ObjectSerializer::getWriteCurrentTypeBlock(const std::string& accessor) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + nextEl() + "writeCurrentType(w, " + std::string(typenavigator->isOptional() ? "true" : "false") + ");"); + b->addLine(accessor + "::writeType(w, " + std::string(typenavigator->isOptional() ? "true" : "false") + ");"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Object.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Object.h index 226d08f67..770422d16 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Object.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Object.h @@ -54,8 +54,7 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Pair.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Pair.cpp index 56d0ff682..447f5b92c 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Pair.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Pair.cpp @@ -94,7 +94,7 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr PairSerializer::getWriteInitialTypeBlock(const std::string& accessor) const + CppBlockPtr PairSerializer::getWriteTypeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); b->addLine("w.writeStartPair({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); @@ -104,36 +104,13 @@ namespace armarx::aron::cppcodegenerator::serializer auto child_s1 = FromAronTypeNaviagtorPtr(typenavigator->getFirstAcceptedType()); std::string accessor_iterator1 = escaped_accessor + PAIR_FIRST_ACCESSOR; b->addLine("w.writeKey(\"0\");"); - CppBlockPtr b21 = child_s1->getWriteInitialTypeBlock(accessor_iterator1); + CppBlockPtr b21 = child_s1->getWriteTypeBlock(accessor_iterator1); b->appendBlock(b21); auto child_s2 = FromAronTypeNaviagtorPtr(typenavigator->getSecondAcceptedType()); std::string accessor_iterator2 = escaped_accessor + PAIR_SECOND_ACCESSOR; b->addLine("w.writeKey(\"1\");"); - CppBlockPtr b22 = child_s2->getWriteInitialTypeBlock(accessor_iterator2); - b->appendBlock(b22); - - b->addLine("w.writeEndPair();"); - return b; - } - - CppBlockPtr PairSerializer::getWriteCurrentTypeBlock(const std::string& accessor) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeStartPair({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); - - std::string escaped_accessor = EscapeAccessor(accessor); - - auto child_s1 = FromAronTypeNaviagtorPtr(typenavigator->getFirstAcceptedType()); - std::string accessor_iterator1 = escaped_accessor + PAIR_FIRST_ACCESSOR; - b->addLine("w.writeKey(\"0\");"); - CppBlockPtr b21 = child_s1->getWriteCurrentTypeBlock(accessor_iterator1); - b->appendBlock(b21); - - auto child_s2 = FromAronTypeNaviagtorPtr(typenavigator->getSecondAcceptedType()); - std::string accessor_iterator2 = escaped_accessor + PAIR_SECOND_ACCESSOR; - b->addLine("w.writeKey(\"1\");"); - CppBlockPtr b22 = child_s2->getWriteCurrentTypeBlock(accessor_iterator2); + CppBlockPtr b22 = child_s2->getWriteTypeBlock(accessor_iterator2); b->appendBlock(b22); b->addLine("w.writeEndPair();"); diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Pair.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Pair.h index f9441c02b..5ea49b510 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Pair.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Pair.h @@ -53,9 +53,8 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; virtual CppBlockPtr getReadBlock(const std::string&) const override; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Tuple.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Tuple.cpp index 9a8e86fbb..57d7e0419 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Tuple.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Tuple.cpp @@ -94,7 +94,7 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr TupleSerializer::getWriteInitialTypeBlock(const std::string& accessor) const + CppBlockPtr TupleSerializer::getWriteTypeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); b->addLine("w.writeStartTuple({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); @@ -106,26 +106,7 @@ namespace armarx::aron::cppcodegenerator::serializer std::string accessor_iterator = escaped_accessor + TUPLE_ITERATOR_ACCESSOR + std::to_string(i++); auto type_s = FromAronTypeNaviagtorPtr(type); b->addLine("w.writeKey(\"" + std::to_string(i) + "\");"); - CppBlockPtr b2 = type_s->getWriteInitialTypeBlock(accessor_iterator); - b->appendBlock(b2); - } - b->addLine("w.writeEndTuple();"); - return b; - } - - CppBlockPtr TupleSerializer::getWriteCurrentTypeBlock(const std::string& accessor) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeStartTuple({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); - - std::string escaped_accessor = EscapeAccessor(accessor); - unsigned int i = 0; - for (const auto& type : typenavigator->getAcceptedTypes()) - { - std::string accessor_iterator = escaped_accessor + TUPLE_ITERATOR_ACCESSOR + std::to_string(i++); - auto type_s = FromAronTypeNaviagtorPtr(type); - b->addLine("w.writeKey(\"" + std::to_string(i) + "\");"); - CppBlockPtr b2 = type_s->getWriteCurrentTypeBlock(accessor_iterator); + CppBlockPtr b2 = type_s->getWriteTypeBlock(accessor_iterator); b->appendBlock(b2); } b->addLine("w.writeEndTuple();"); diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Tuple.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Tuple.h index 52bd376ec..31a0a6fa7 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Tuple.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/container/Tuple.h @@ -53,9 +53,8 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; virtual CppBlockPtr getReadBlock(const std::string&) const override; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/enum/IntEnum.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/enum/IntEnum.cpp index 899f4fe1f..7cbd3deb4 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/enum/IntEnum.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/enum/IntEnum.cpp @@ -67,17 +67,10 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr IntEnumSerializer::getWriteInitialTypeBlock(const std::string& accessor) const + CppBlockPtr IntEnumSerializer::getWriteTypeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + "::writeInitialType(w, " + std::string(typenavigator->isOptional() ? "true" : "false") + ");"); - return b; - } - - CppBlockPtr IntEnumSerializer::getWriteCurrentTypeBlock(const std::string& accessor) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + nextEl() + "writeCurrentType(w, " + std::string(typenavigator->isOptional() ? "true" : "false") + ");"); + b->addLine(accessor + "::writeType(w, " + std::string(typenavigator->isOptional() ? "true" : "false") + ");"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/enum/IntEnum.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/enum/IntEnum.h index ba53bb47e..36fc41b53 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/enum/IntEnum.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/enum/IntEnum.h @@ -53,8 +53,7 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; 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 e6c93e450..4184f0754 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 @@ -79,17 +79,10 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr EigenMatrixSerializer::getWriteInitialTypeBlock(const std::string&) const + CppBlockPtr EigenMatrixSerializer::getWriteTypeBlock(const std::string&) 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") + "});"); - return b; - } - - CppBlockPtr EigenMatrixSerializer::getWriteCurrentTypeBlock(const std::string& accessor) 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({" + std::to_string(typenavigator->getRows()) + ", " + std::to_string(typenavigator->getCols()) + ", \"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenMatrix.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenMatrix.h index bbdb75fdf..df67a5f93 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenMatrix.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenMatrix.h @@ -53,8 +53,7 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; 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 20c0cbeaa..c1f541675 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 @@ -74,14 +74,7 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - 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::getWriteCurrentTypeBlock(const std::string&) const + CppBlockPtr EigenQuaternionSerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); b->addLine("w.writeEigenQuaternion({\"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); @@ -91,7 +84,7 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr EigenQuaternionSerializer::getWriteBlock(const std::string& accessor) const { CppBlockPtr block_if_data = CppBlockPtr(new CppBlock()); - block_if_data->addLine("w.writeNDArray({" + simox::alg::to_string(typenavigator->getDimensions(), ", ") + ", " + std::to_string(ACCEPTED_TYPES.at(typenavigator->getTypename()).second) + "}, \"" + typenavigator->getTypename() + "\", reinterpret_cast<const unsigned char*>(" + accessor + nextEl() + "coeffs().data()));"); + block_if_data->addLine("w.writeNDArray({" + simox::alg::to_string(typenavigator->ACCEPTED_DIMENSION, ", ") + ", " + std::to_string(ACCEPTED_TYPES.at(typenavigator->getTypename()).second) + "}, \"" + typenavigator->getTypename() + "\", reinterpret_cast<const unsigned char*>(" + accessor + nextEl() + "coeffs().data()));"); return ResolveOptionalBlock(accessor, block_if_data, typenavigator); } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenQuaternion.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenQuaternion.h index 9f306d7dd..d07b9796b 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenQuaternion.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/EigenQuaternion.h @@ -53,8 +53,7 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/IVTCByteImage.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/IVTCByteImage.cpp index 5a57d9373..170b9a086 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/IVTCByteImage.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/IVTCByteImage.cpp @@ -41,8 +41,6 @@ namespace armarx::aron::cppcodegenerator::serializer simox::meta::get_type_name(typeid(type::AronIVTCByteImage)), SerializerAccessType::ePTR), // a ptr is by default optional. We ignore the setting here typenavigator(e) { - // check if type exists - ACCEPTED_TYPES.at(typenavigator->getTypename()); } std::vector<CppFieldPtr> IVTCByteImageSerializer::getPublicVariableDeclarations(const std::string& name) const @@ -72,21 +70,14 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr IVTCByteImageSerializer::getInitializeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = std::make_shared<" + getCoreCppTypename() + ">(" + std::to_string(typenavigator->getWidth()) + ", " + std::to_string(typenavigator->getHeight()) + ", " + ACCEPTED_TYPES.at(typenavigator->getTypename()).first + ");"); + b->addLine(accessor + " = std::make_shared<" + getCoreCppTypename() + ">();"); return b; } - CppBlockPtr IVTCByteImageSerializer::getWriteInitialTypeBlock(const std::string&) const + CppBlockPtr IVTCByteImageSerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeIVTCByteImage({" + std::to_string(typenavigator->getWidth()) + ", " + std::to_string(typenavigator->getHeight()) + ", \"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); - return b; - } - - CppBlockPtr IVTCByteImageSerializer::getWriteCurrentTypeBlock(const std::string& accessor) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeIVTCByteImage({" + accessor + nextEl() + "width, " + accessor + nextEl() + "height, \"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); + b->addLine("w.writeIVTCByteImage({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/IVTCByteImage.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/IVTCByteImage.h index ac91df514..a801d7f3d 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/IVTCByteImage.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/IVTCByteImage.h @@ -53,9 +53,8 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; virtual CppBlockPtr getReadBlock(const std::string&) const override; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/NDArray.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/NDArray.cpp index c5a586b86..fe7724422 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/NDArray.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/NDArray.cpp @@ -66,13 +66,7 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr NDArraySerializer::getWriteInitialTypeBlock(const std::string&) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - return b; - } - - CppBlockPtr NDArraySerializer::getWriteCurrentTypeBlock(const std::string&) const + CppBlockPtr NDArraySerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); return b; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/NDArray.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/NDArray.h index 46e45ff14..f20a63d68 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/NDArray.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/NDArray.h @@ -52,9 +52,8 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; virtual CppBlockPtr getReadBlock(const std::string&) const override; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/OpenCVMat.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/OpenCVMat.cpp index b782c80d2..4076b1dc7 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/OpenCVMat.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/OpenCVMat.cpp @@ -46,11 +46,6 @@ namespace armarx::aron::cppcodegenerator::serializer (e->isOptional() ? SerializerAccessType::eOPTIONAL : SerializerAccessType::eDIRECT)), typenavigator(e) { - // check if type exists - if (ACCEPTED_TYPES.find(e->getTypename()) == ACCEPTED_TYPES.end()) - { - throw error::StringNotValidException("OpenCVMatSerializer", "OpenCVMatSerializer", "Could not find a matching typename.", e->getTypename(), e->getPath()); - } } std::vector<CppFieldPtr> OpenCVMatSerializer::getPublicVariableDeclarations(const std::string& name) const @@ -96,32 +91,15 @@ namespace armarx::aron::cppcodegenerator::serializer } else { - b->addLine(accessor + " = " + getFullCppTypename() + "(std::vector<int>({" + simox::alg::to_string<int>(typenavigator->getDimensions(), ", ") + "}), " + ACCEPTED_TYPES.at(typenavigator->getTypename()).first + ");"); + b->addLine(accessor + " = " + getFullCppTypename() + "(std::vector<int>());"); } return b; } - CppBlockPtr OpenCVMatSerializer::getWriteInitialTypeBlock(const std::string&) const + CppBlockPtr OpenCVMatSerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeOpenCVMat({{" + simox::alg::to_string<int>(typenavigator->getDimensions(), ", ") + "}, \"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); - return b; - } - - CppBlockPtr OpenCVMatSerializer::getWriteCurrentTypeBlock(const std::string& accessor) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - - std::string escaped_accessor = EscapeAccessor(accessor); - std::string accessor_dimensions = escaped_accessor + DIMENSION_ACCESSOR; - std::string accessor_iterator = escaped_accessor + ITERATOR_ACCESSOR; - - b->addLine("std::vector<int> " + accessor_dimensions + ";"); - b->addLine("for (int " + accessor_iterator + " = 0; " + accessor_iterator + " < " + accessor + nextEl() + "dims; ++" + accessor_iterator + ")"); - CppBlockPtr b2 = CppBlockPtr(new CppBlock()); - b2->addLine(accessor_dimensions + ".push_back(" + accessor + nextEl() + "size[" + accessor_iterator + "]);"); - b->appendBlock(b2); - b->addLine("w.writeOpenCVMat({" + accessor_dimensions + ", std::to_string(" + accessor + nextEl() + "type()), " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); + b->addLine("w.writeOpenCVMat({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/OpenCVMat.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/OpenCVMat.h index dff7118e2..79c8b0c05 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/OpenCVMat.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/OpenCVMat.h @@ -53,9 +53,8 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; virtual CppBlockPtr getReadBlock(const std::string&) const override; 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 992d169ce..8a8afb3c7 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 @@ -28,7 +28,7 @@ namespace armarx::aron::cppcodegenerator::serializer { // constructors OrientationSerializer::OrientationSerializer(const typenavigator::OrientationNavigatorPtr& n) : - Serializer("Eigen::Quaternion<" + n->getTypename() + ">", + Serializer("Eigen::Quaternion<" + n->ACCEPTED_TYPE + ">", simox::meta::get_type_name(typeid(data::AronNDArray)), simox::meta::get_type_name(typeid(type::AronOrientation)), (n->isOptional() ? SerializerAccessType::eOPTIONAL : SerializerAccessType::eDIRECT)), @@ -67,14 +67,7 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr OrientationSerializer::getWriteInitialTypeBlock(const std::string&) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeOrientation({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); - return b; - } - - CppBlockPtr OrientationSerializer::getWriteCurrentTypeBlock(const std::string&) const + CppBlockPtr OrientationSerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); b->addLine("w.writeOrientation({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); @@ -84,7 +77,7 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr OrientationSerializer::getWriteBlock(const std::string& accessor) const { CppBlockPtr block_if_data = CppBlockPtr(new CppBlock()); - block_if_data->addLine("w.writeNDArray({" + simox::alg::to_string(typenavigator->getDimensions(), ", ") + "}, \"" + typenavigator->getTypename() + "\", reinterpret_cast<const unsigned char*>(" + accessor + nextEl() + "coeffs().data()));"); + block_if_data->addLine("w.writeNDArray({" + simox::alg::to_string(typenavigator->ACCEPTED_DIMENSION, ", ") + "}, \"" + typenavigator->ACCEPTED_TYPE + "\", reinterpret_cast<const unsigned char*>(" + accessor + nextEl() + "coeffs().data()));"); return ResolveOptionalBlock(accessor, block_if_data, typenavigator); } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Orientation.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Orientation.h index 248a1a6da..5a55b78ec 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Orientation.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Orientation.h @@ -52,9 +52,8 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; virtual CppBlockPtr getReadBlock(const std::string&) const override; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.cpp index 314779853..761e2b6f0 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.cpp @@ -83,21 +83,14 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr PCLPointCloudSerializer::getInitializeBlock(const std::string& accessor) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine(accessor + " = " + getFullCppTypename() + "(" + std::to_string(typenavigator->getWidth()) + ", " + std::to_string(typenavigator->getHeight()) + ");"); + b->addLine(accessor + " = " + getFullCppTypename() + "();"); return b; } - CppBlockPtr PCLPointCloudSerializer::getWriteInitialTypeBlock(const std::string&) const + CppBlockPtr PCLPointCloudSerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writePCLPointCloud({" + std::to_string(typenavigator->getWidth()) + ", " + std::to_string(typenavigator->getHeight()) + ", \"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); - return b; - } - - CppBlockPtr PCLPointCloudSerializer::getWriteCurrentTypeBlock(const std::string& accessor) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writePCLPointCloud({" + accessor + nextEl() + "width, " + accessor + nextEl() + "height, \"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); + b->addLine("w.writePCLPointCloud({\"" + typenavigator->getTypename() + "\", " + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); return b; } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.h index 101ee2ee6..2224fce91 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/PCLPointCloud.h @@ -52,9 +52,8 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; virtual CppBlockPtr getReadBlock(const std::string&) const override; 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 3cc08abf3..f13b1d44b 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 @@ -28,7 +28,7 @@ namespace armarx::aron::cppcodegenerator::serializer { // constructors PoseSerializer::PoseSerializer(const typenavigator::PoseNavigatorPtr& n) : - Serializer("Eigen::Matrix<" + n->getTypename() + ", " + simox::alg::to_string(n->getDimensions(), ", ") + ">", + Serializer("Eigen::Matrix<" + n->ACCEPTED_TYPE + ", " + simox::alg::to_string(n->ACCEPTED_DIMENSION, ", ") + ">", simox::meta::get_type_name(typeid(data::AronNDArray)), simox::meta::get_type_name(typeid(type::AronPose)), (n->isOptional() ? SerializerAccessType::eOPTIONAL : SerializerAccessType::eDIRECT)), @@ -67,14 +67,7 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr PoseSerializer::getWriteInitialTypeBlock(const std::string&) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writePose({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); - return b; - } - - CppBlockPtr PoseSerializer::getWriteCurrentTypeBlock(const std::string&) const + CppBlockPtr PoseSerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); b->addLine("w.writePose({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); @@ -84,7 +77,7 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr PoseSerializer::getWriteBlock(const std::string& accessor) const { CppBlockPtr block_if_data = CppBlockPtr(new CppBlock()); - block_if_data->addLine("w.writeNDArray({" + simox::alg::to_string(typenavigator->getDimensions(), ", ") + "}, \"" + typenavigator->getTypename() + "\", reinterpret_cast<const unsigned char*>(" + accessor + nextEl() + "data()));"); + block_if_data->addLine("w.writeNDArray({" + simox::alg::to_string(typenavigator->ACCEPTED_DIMENSION, ", ") + "}, \"" + typenavigator->ACCEPTED_TYPE + "\", reinterpret_cast<const unsigned char*>(" + accessor + nextEl() + "data()));"); return ResolveOptionalBlock(accessor, block_if_data, typenavigator); } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Pose.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Pose.h index 567b4f1ef..03521edb7 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Pose.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Pose.h @@ -52,9 +52,8 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; virtual CppBlockPtr getReadBlock(const std::string&) const override; 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 9369718a0..4d1ee7b6e 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 @@ -28,7 +28,7 @@ namespace armarx::aron::cppcodegenerator::serializer { // constructors PositionSerializer::PositionSerializer(const typenavigator::PositionNavigatorPtr& n) : - Serializer("Eigen::Matrix<" + n->getTypename() + ", " + simox::alg::to_string(n->getDimensions(), ", ") + ">", + Serializer("Eigen::Matrix<" + n->ACCEPTED_TYPE + ", " + simox::alg::to_string(n->ACCEPTED_DIMENSION, ", ") + ">", simox::meta::get_type_name(typeid(data::AronNDArray)), simox::meta::get_type_name(typeid(type::AronPosition)), (n->isOptional() ? SerializerAccessType::eOPTIONAL : SerializerAccessType::eDIRECT)), @@ -67,14 +67,7 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr PositionSerializer::getWriteInitialTypeBlock(const std::string&) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writePosition({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); - return b; - } - - CppBlockPtr PositionSerializer::getWriteCurrentTypeBlock(const std::string&) const + CppBlockPtr PositionSerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); b->addLine("w.writePosition({" + std::string(typenavigator->isOptional() ? "true" : "false") + "});"); @@ -84,7 +77,7 @@ namespace armarx::aron::cppcodegenerator::serializer CppBlockPtr PositionSerializer::getWriteBlock(const std::string& accessor) const { CppBlockPtr block_if_data = CppBlockPtr(new CppBlock()); - block_if_data->addLine("w.writeNDArray({" + simox::alg::to_string(typenavigator->getDimensions(), ", ") + "}, \"" + typenavigator->getTypename() + "\", reinterpret_cast<const unsigned char*>(" + accessor + nextEl() + "data()));"); + block_if_data->addLine("w.writeNDArray({" + simox::alg::to_string(typenavigator->ACCEPTED_DIMENSION, ", ") + "}, \"" + typenavigator->ACCEPTED_TYPE + "\", reinterpret_cast<const unsigned char*>(" + accessor + nextEl() + "data()));"); return ResolveOptionalBlock(accessor, block_if_data, typenavigator); } diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Position.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Position.h index 94b9317e0..ab6dbf138 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Position.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/ndarray/Position.h @@ -52,9 +52,8 @@ namespace armarx::aron::cppcodegenerator::serializer virtual std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const override; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; virtual CppBlockPtr getReadBlock(const std::string&) const override; 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 a7f8b33b4..8987f2d59 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 @@ -87,14 +87,7 @@ namespace armarx::aron::cppcodegenerator::serializer return b; \ } \ \ - CppBlockPtr upperType##Serializer::getWriteInitialTypeBlock(const std::string&) const \ - { \ - CppBlockPtr b = CppBlockPtr(new CppBlock()); \ - b->addLine("w.write" + std::string(#upperType) + "({" + std::string(typenavigator->isOptional() ? "true" : "false")+"});"); \ - return b; \ - } \ - \ - CppBlockPtr upperType##Serializer::getWriteCurrentTypeBlock(const std::string&) const \ + CppBlockPtr upperType##Serializer::getWriteTypeBlock(const std::string&) const \ { \ CppBlockPtr b = CppBlockPtr(new CppBlock()); \ b->addLine("w.write" + std::string(#upperType) + "({" + std::string(typenavigator->isOptional() ? "true" : "false")+"});"); \ diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/primitive/Primitive.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/primitive/Primitive.h index 4356f6757..60c2d93c9 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/primitive/Primitive.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/primitive/Primitive.h @@ -56,8 +56,7 @@ namespace armarx::aron::cppcodegenerator::serializer virtual CppBlockPtr getCtorBlock(const std::string&) const override; \ virtual CppBlockPtr getResetBlock(const std::string& accessor) const override; \ virtual CppBlockPtr getInitializeBlock(const std::string& accessor) const override; \ - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; \ - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string& accessor) const override; \ + virtual CppBlockPtr getWriteTypeBlock(const std::string& accessor) const override; \ virtual CppBlockPtr getWriteBlock(const std::string& accessor) const override; \ virtual CppBlockPtr getReadBlock(const std::string& accessor) const override; \ CppBlockPtr getEqualsBlock(const std::string& accessor, const std::string& otherInstanceAccessor) const override; \ diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.cpp index c7f32781e..68fc518a9 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.cpp @@ -95,14 +95,7 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr IntEnumClassSerializer::getWriteInitialTypeBlock(const std::string&) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - b->addLine("w.writeInt({" + std::string(navigator->isOptional() ? "true" : "false") + "});"); - return b; - } - - CppBlockPtr IntEnumClassSerializer::getWriteCurrentTypeBlock(const std::string&) const + CppBlockPtr IntEnumClassSerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); b->addLine("w.writeInt({" + std::string(navigator->isOptional() ? "true" : "false") + "});"); diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.h index cf5b46c25..b4a9d4dde 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/IntEnumClass.h @@ -53,8 +53,7 @@ namespace armarx::aron::cppcodegenerator::serializer std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/ObjectClass.cpp b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/ObjectClass.cpp index 75f466fbe..4ad79753c 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/ObjectClass.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/ObjectClass.cpp @@ -97,13 +97,13 @@ namespace armarx::aron::cppcodegenerator::serializer return b; } - CppBlockPtr ObjectClassSerializer::getWriteInitialTypeBlock(const std::string&) const + CppBlockPtr ObjectClassSerializer::getWriteTypeBlock(const std::string&) const { CppBlockPtr b = CppBlockPtr(new CppBlock()); if (navigator->getExtends() != nullptr) { const auto extends_s = FromAronTypeNaviagtorPtr(navigator->getExtends()); - b->addLine(extends_s->getFullCppTypename() + "::writeInitialType(w);"); + b->addLine(extends_s->getFullCppTypename() + "::writeType(w);"); } b->addLine("w.writeStartObject({\"" + navigator->getObjectName() + "\", type_is_optional});"); @@ -111,28 +111,7 @@ namespace armarx::aron::cppcodegenerator::serializer { const auto child_s = FromAronTypeNaviagtorPtr(child); b->addLine("w.writeKey(\"" + key + "\");"); - CppBlockPtr b2 = child_s->getWriteInitialTypeBlock(child_s->getCoreCppTypename()); - b->appendBlock(b2); - } - b->addLine("w.writeEndObject();"); - return b; - } - - CppBlockPtr ObjectClassSerializer::getWriteCurrentTypeBlock(const std::string&) const - { - CppBlockPtr b = CppBlockPtr(new CppBlock()); - if (navigator->getExtends() != nullptr) - { - const auto extends_s = FromAronTypeNaviagtorPtr(navigator->getExtends()); - b->addLine(extends_s->getFullCppTypename() + "::writeCurrentType(w);"); - } - - b->addLine("w.writeStartObject({\"" + navigator->getObjectName() + "\", type_is_optional});"); - for (const auto& [key, child] : navigator->getMemberTypes()) - { - const auto child_s = FromAronTypeNaviagtorPtr(child); - b->addLine("w.writeKey(\"" + key + "\");"); - CppBlockPtr b2 = child_s->getWriteCurrentTypeBlock(key); + CppBlockPtr b2 = child_s->getWriteTypeBlock(child_s->getCoreCppTypename()); b->appendBlock(b2); } b->addLine("w.writeEndObject();"); diff --git a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/ObjectClass.h b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/ObjectClass.h index 7b996cb76..1eb4c9316 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/ObjectClass.h +++ b/source/RobotAPI/libraries/aron/core/codegenerator/codeWriter/cpp/serializer/toplevel/ObjectClass.h @@ -54,8 +54,7 @@ namespace armarx::aron::cppcodegenerator::serializer std::vector<CppFieldPtr> getPublicVariableDeclarations(const std::string&) const; virtual std::vector<std::pair<std::string, std::string>> getCtorInitializers(const std::string&) const override; virtual CppBlockPtr getCtorBlock(const std::string&) const override; - virtual CppBlockPtr getWriteInitialTypeBlock(const std::string&) const override; - virtual CppBlockPtr getWriteCurrentTypeBlock(const std::string&) const override; + virtual CppBlockPtr getWriteTypeBlock(const std::string&) const override; virtual CppBlockPtr getInitializeBlock(const std::string&) const override; virtual CppBlockPtr getResetBlock(const std::string&) const override; virtual CppBlockPtr getWriteBlock(const std::string&) const override; 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 ac53b26da..fb6ef9bae 100644 --- a/source/RobotAPI/libraries/aron/core/codegenerator/typeReader/xml/ReaderFactory.cpp +++ b/source/RobotAPI/libraries/aron/core/codegenerator/typeReader/xml/ReaderFactory.cpp @@ -117,13 +117,8 @@ namespace armarx::aron::xmltypereader if (extends != "") { - auto it = AllPublicObjects.find(extends); - if (it == AllPublicObjects.end()) - { - throw error::StringNotValidException("AronObjectTypeXMLReaderFactory", "createSpecific", "An extends name could not be found. Perhaps you need to change the order of your types or you have to add another UseType", extends, path); - } - codegeneratorhelper::GenerateObjectInfoPtr parentObj = it->second; - aronObjectType->setExtends(parentObj->correspondingType); + auto parentObj = typenavigator::ObjectNavigator::DynamicCastAndCheck(ResolveTypename(simox::alg::to_lower(extends))); + aronObjectType->setExtends(parentObj); } ObjectGenerationStack.push(newObject); @@ -135,10 +130,11 @@ namespace armarx::aron::xmltypereader Data::EnforceAttribute(objectChild, Data::KEY_ATTRIBUTE_NAME); const std::string key = objectChild.attribute_value(Data::KEY_ATTRIBUTE_NAME); - bool isOptional = Data::AttributeIsTrue(objectChild, Data::OPTIONAL_NAME); - std::vector<RapidXmlReaderNode> children = objectChild.nodes(); + + bool isOptional = Data::AttributeIsTrue(children[0], Data::OPTIONAL_NAME); typenavigator::NavigatorPtr childNavigator = create(children[0], Path(path, key)); + childNavigator->setOptional(isOptional); aronObjectType->addMemberType(key, childNavigator); } @@ -269,16 +265,13 @@ namespace armarx::aron::xmltypereader typenavigator::NavigatorPtr IVTCByteImageReaderFactory::createSpecific(const RapidXmlReaderNode& node, const Path& path) const { Data::EnforceTagName(node, Data::GENERATE_IVT_CBYTE_IMAGE_MEMBER_TAG); - Data::EnforceAttribute(node, Data::TYPE_ATTRIBUTE_NAME); + //Data::EnforceAttribute(node, Data::TYPE_ATTRIBUTE_NAME); - int width = std::stoi(Data::GetAttributeWithDefault(node, Data::WIDTH_ATTRIBUTE_NAME, "1")); - int height = std::stoi(Data::GetAttributeWithDefault(node, Data::HEIGHT_ATTRIBUTE_NAME, "1")); - std::string type = node.attribute_value(Data::TYPE_ATTRIBUTE_NAME);; + //int width = std::stoi(Data::GetAttributeWithDefault(node, Data::WIDTH_ATTRIBUTE_NAME, "1")); + //int height = std::stoi(Data::GetAttributeWithDefault(node, Data::HEIGHT_ATTRIBUTE_NAME, "1")); + //std::string type = node.attribute_value(Data::TYPE_ATTRIBUTE_NAME);; typenavigator::IVTCByteImageNavigatorPtr complex(new typenavigator::IVTCByteImageNavigator(path)); - complex->setWidth(width); - complex->setHeight(height); - complex->setTypename(type); return complex; } @@ -288,8 +281,8 @@ namespace armarx::aron::xmltypereader Data::EnforceTagName(node, Data::GENERATE_EIGEN_MATRIX_MEMBER_TAG); Data::EnforceAttribute(node, Data::TYPE_ATTRIBUTE_NAME); - int rows = std::stoi(Data::GetAttributeWithDefault(node, Data::ROWS_ATTRIBUTE_NAME, "1")); - int cols = std::stoi(Data::GetAttributeWithDefault(node, Data::COLS_ATTRIBUTE_NAME, "1")); + int rows = std::stoi(Data::GetAttributeWithDefault(node, Data::ROWS_ATTRIBUTE_NAME, "4")); + int cols = std::stoi(Data::GetAttributeWithDefault(node, Data::COLS_ATTRIBUTE_NAME, "4")); std::string type = node.attribute_value(Data::TYPE_ATTRIBUTE_NAME); typenavigator::EigenMatrixNavigatorPtr complex(new typenavigator::EigenMatrixNavigator(path)); @@ -316,15 +309,15 @@ namespace armarx::aron::xmltypereader typenavigator::NavigatorPtr OpenCVMatReaderFactory::createSpecific(const RapidXmlReaderNode& node, const Path& path) const { Data::EnforceTagName(node, Data::GENERATE_OPENCV_MAT_MEMBER_TAG); - Data::EnforceAttribute(node, Data::TYPE_ATTRIBUTE_NAME); + //Data::EnforceAttribute(node, Data::TYPE_ATTRIBUTE_NAME); - std::vector<std::string> dimensions_as_strings = simox::alg::split(Data::GetAttributeWithDefault(node, Data::DIMENSIONS_ATTRIBUTE_NAME, "1"), ","); - std::vector<int> dimensions = simox::alg::to_vec<int>(dimensions_as_strings); - std::string type = node.attribute_value(Data::TYPE_ATTRIBUTE_NAME); + //std::vector<std::string> dimensions_as_strings = simox::alg::split(Data::GetAttributeWithDefault(node, Data::DIMENSIONS_ATTRIBUTE_NAME, "1"), ","); + //std::vector<int> dimensions = simox::alg::to_vec<int>(dimensions_as_strings); + //std::string type = node.attribute_value(Data::TYPE_ATTRIBUTE_NAME); typenavigator::OpenCVMatNavigatorPtr complex(new typenavigator::OpenCVMatNavigator(path)); - complex->setDimensions(dimensions); - complex->setTypename(type); + //complex->setDimensions(dimensions); + //complex->setTypename(type); return complex; } @@ -334,13 +327,13 @@ namespace armarx::aron::xmltypereader Data::EnforceTagName(node, Data::GENERATE_PCL_POINTCLOUD_MEMBER_TAG); Data::EnforceAttribute(node, Data::TYPE_ATTRIBUTE_NAME); - int width = std::stoi(Data::GetAttributeWithDefault(node, Data::WIDTH_ATTRIBUTE_NAME, "1")); - int height = std::stoi(Data::GetAttributeWithDefault(node, Data::HEIGHT_ATTRIBUTE_NAME, "1")); + //int width = std::stoi(Data::GetAttributeWithDefault(node, Data::WIDTH_ATTRIBUTE_NAME, "1")); + //int height = std::stoi(Data::GetAttributeWithDefault(node, Data::HEIGHT_ATTRIBUTE_NAME, "1")); std::string type = node.attribute_value(Data::TYPE_ATTRIBUTE_NAME);; typenavigator::PCLPointCloudNavigatorPtr complex(new typenavigator::PCLPointCloudNavigator(path)); - complex->setWidth(width); - complex->setHeight(height); + //complex->setWidth(width); + //complex->setHeight(height); complex->setTypename(type); return complex; } diff --git a/source/RobotAPI/libraries/aron/core/io/typeIO/Reader.h b/source/RobotAPI/libraries/aron/core/io/typeIO/Reader.h index 52a707936..0b61e0a35 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/Reader.h +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/Reader.h @@ -81,7 +81,8 @@ namespace armarx::aron::typeIO struct ReadEigenMatrixReturnType { - std::vector<int> dimensions; + unsigned int rows; + unsigned int cols; std::string type; bool isOptional; }; @@ -96,25 +97,18 @@ namespace armarx::aron::typeIO struct ReadIVTCbyteImageReturnType { - unsigned int width; - unsigned int height; - std::string type; bool isOptional; }; virtual ReadIVTCbyteImageReturnType readIVTCByteImage() = 0; struct ReadOpenCVMatReturnType { - std::vector<int> dimensions; - std::string type; bool isOptional; }; virtual ReadOpenCVMatReturnType readOpenCVMat() = 0; struct ReadPCLPointCloudReturnType { - unsigned int width; - unsigned int height; std::string type; bool isOptional; }; diff --git a/source/RobotAPI/libraries/aron/core/io/typeIO/Writer.h b/source/RobotAPI/libraries/aron/core/io/typeIO/Writer.h index 761d2d964..b83e8d3e6 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/Writer.h +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/Writer.h @@ -77,7 +77,8 @@ namespace armarx::aron::typeIO struct WriteEigenMatrixInput { - std::vector<int> dimensions; + unsigned int rows; + unsigned int cols; std::string type; bool isOptional; }; @@ -92,25 +93,18 @@ namespace armarx::aron::typeIO struct WriteIVTCByteImageInput { - unsigned int width; - unsigned int height; - std::string type; bool isOptional; }; virtual void writeIVTCByteImage(const WriteIVTCByteImageInput&) = 0; struct WriteOpenCVMatInput { - std::vector<int> dimensions; - std::string type; bool isOptional; }; virtual void writeOpenCVMat(const WriteOpenCVMatInput&) = 0; struct WritePCLPointCloudInput { - unsigned int width; - unsigned int height; std::string type; bool isOptional; }; 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 742a4063e..fe1f4eb36 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/converter/Converter.cpp +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/converter/Converter.cpp @@ -87,7 +87,7 @@ namespace armarx::aron::typeIO case type::Descriptor::eEigenMatrix: { const auto readEigenMatrix = reader.readEigenMatrix(); - writer.writeEigenMatrix({readEigenMatrix.dimensions, readEigenMatrix.type, readEigenMatrix.isOptional}); + writer.writeEigenMatrix({readEigenMatrix.rows, readEigenMatrix.cols, readEigenMatrix.type, readEigenMatrix.isOptional}); break; } case type::Descriptor::eEigenQuaternion: @@ -99,19 +99,19 @@ namespace armarx::aron::typeIO case type::Descriptor::eIVTCByteImage: { const auto readIVTCByteImage = reader.readIVTCByteImage(); - writer.writeIVTCByteImage({readIVTCByteImage.width, readIVTCByteImage.height, readIVTCByteImage.type, readIVTCByteImage.isOptional}); + writer.writeIVTCByteImage({readIVTCByteImage.isOptional}); break; } case type::Descriptor::eOpenCVMat: { const auto readOpenCVMat = reader.readOpenCVMat(); - writer.writeOpenCVMat({readOpenCVMat.dimensions, readOpenCVMat.type, readOpenCVMat.isOptional}); + writer.writeOpenCVMat({readOpenCVMat.isOptional}); break; } case type::Descriptor::ePCLPointCloud: { const auto readPCLPointCloud = reader.readPCLPointCloud(); - writer.writePCLPointCloud({readPCLPointCloud.width, readPCLPointCloud.height, readPCLPointCloud.type, readPCLPointCloud.isOptional}); + writer.writePCLPointCloud({readPCLPointCloud.type, readPCLPointCloud.isOptional}); break; } case type::Descriptor::ePosition: diff --git a/source/RobotAPI/libraries/aron/core/io/typeIO/reader/navigator/NavigatorReader.cpp b/source/RobotAPI/libraries/aron/core/io/typeIO/reader/navigator/NavigatorReader.cpp index d31e4fca7..d134d98ca 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/reader/navigator/NavigatorReader.cpp +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/reader/navigator/NavigatorReader.cpp @@ -168,7 +168,7 @@ namespace armarx::aron::typeIO::reader { auto nav = getNextAndIncrease(); auto casted = typenavigator::EigenMatrixNavigator::DynamicCastAndCheck(nav); - return {casted->getDimensions(), casted->getTypename(), casted->isOptional()}; + return {casted->getRows(), casted->getCols(), casted->getTypename(), casted->isOptional()}; } ReaderInterface::ReadEigenQuaternionReturnType NavigatorReader::readEigenQuaternion() @@ -182,21 +182,21 @@ namespace armarx::aron::typeIO::reader { auto nav = getNextAndIncrease(); auto casted = typenavigator::IVTCByteImageNavigator::DynamicCastAndCheck(nav); - return {casted->getWidth(), casted->getHeight(), casted->getTypename(), casted->isOptional()}; + return {casted->isOptional()}; } ReaderInterface::ReadOpenCVMatReturnType NavigatorReader::readOpenCVMat() { auto nav = getNextAndIncrease(); auto casted = typenavigator::OpenCVMatNavigator::DynamicCastAndCheck(nav); - return {casted->getDimensions(), casted->getTypename(), casted->isOptional()}; + return {casted->isOptional()}; } ReaderInterface::ReadPCLPointCloudReturnType NavigatorReader::readPCLPointCloud() { auto nav = getNextAndIncrease(); auto casted = typenavigator::PCLPointCloudNavigator::DynamicCastAndCheck(nav); - return {casted->getWidth(), casted->getHeight(), casted->getTypename(), casted->isOptional()}; + return {casted->getTypename(), casted->isOptional()}; } ReaderInterface::ReadPositionReturnType NavigatorReader::readPosition() diff --git a/source/RobotAPI/libraries/aron/core/io/typeIO/reader/nlohmannJSON/NlohmannJSONReader.cpp b/source/RobotAPI/libraries/aron/core/io/typeIO/reader/nlohmannJSON/NlohmannJSONReader.cpp index 175918c82..f39daa017 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/reader/nlohmannJSON/NlohmannJSONReader.cpp +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/reader/nlohmannJSON/NlohmannJSONReader.cpp @@ -168,10 +168,10 @@ namespace armarx::aron::typeIO::reader ReaderInterface::ReadEigenMatrixReturnType NlohmannJSONReader::readEigenMatrix() { nlohmann::json j = getNextAndIncrease(); - std::vector<int> dims = j[io::Data::READER_WRITER_NDARRAY_DIMENSIONS_SLUG]; + std::vector<unsigned int> dims = j[io::Data::READER_WRITER_NDARRAY_DIMENSIONS_SLUG]; std::string type = j[io::Data::READER_WRITER_NDARRAY_TYPE_SLUG]; bool o = j[io::Data::READER_WRITER_OPTIONAL_SLUG]; - return {dims, type, o}; + return {dims[0], dims[1], type, o}; } ReaderInterface::ReadEigenQuaternionReturnType NlohmannJSONReader::readEigenQuaternion() @@ -185,28 +185,23 @@ namespace armarx::aron::typeIO::reader ReaderInterface::ReadIVTCbyteImageReturnType NlohmannJSONReader::readIVTCByteImage() { nlohmann::json j = getNextAndIncrease(); - std::vector<unsigned int> dims = j[io::Data::READER_WRITER_NDARRAY_DIMENSIONS_SLUG]; - std::string type = j[io::Data::READER_WRITER_NDARRAY_TYPE_SLUG]; bool o = j[io::Data::READER_WRITER_OPTIONAL_SLUG]; - return {dims[0], dims[1], type, o}; + return {o}; } ReaderInterface::ReadOpenCVMatReturnType NlohmannJSONReader::readOpenCVMat() { nlohmann::json j = getNextAndIncrease(); - std::vector<int> dims = j[io::Data::READER_WRITER_NDARRAY_DIMENSIONS_SLUG]; - std::string type = j[io::Data::READER_WRITER_NDARRAY_TYPE_SLUG]; bool o = j[io::Data::READER_WRITER_OPTIONAL_SLUG]; - return {dims, type, o}; + return {o}; } ReaderInterface::ReadPCLPointCloudReturnType NlohmannJSONReader::readPCLPointCloud() { nlohmann::json j = getNextAndIncrease(); - std::vector<unsigned int> dims = j[io::Data::READER_WRITER_NDARRAY_DIMENSIONS_SLUG]; std::string type = j[io::Data::READER_WRITER_NDARRAY_TYPE_SLUG]; bool o = j[io::Data::READER_WRITER_OPTIONAL_SLUG]; - return {dims[0], dims[1], type, o}; + return {type, o}; } ReaderInterface::ReadPositionReturnType NlohmannJSONReader::readPosition() 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 942db9a9f..c4aa86d62 100644 --- a/source/RobotAPI/libraries/aron/core/io/typeIO/visitor/Visitor.cpp +++ b/source/RobotAPI/libraries/aron/core/io/typeIO/visitor/Visitor.cpp @@ -88,7 +88,7 @@ namespace armarx::aron::typeIO case type::Descriptor::eEigenMatrix: { auto casted = type::AronEigenMatrixPtr::dynamicCast(aron); - writer.writeEigenMatrix({simox::alg::appended({casted->rows, casted->cols}, casted->otherDimensions), casted->typeName, casted->isOptional}); + writer.writeEigenMatrix({(unsigned int) casted->rows, (unsigned int) casted->cols, casted->typeName, casted->isOptional}); break; } case type::Descriptor::eEigenQuaternion: @@ -100,19 +100,19 @@ namespace armarx::aron::typeIO case type::Descriptor::eIVTCByteImage: { auto casted = type::AronIVTCByteImagePtr::dynamicCast(aron); - writer.writeIVTCByteImage({(unsigned int) casted->width, (unsigned int) casted->height, casted->typeName, casted->isOptional}); + writer.writeIVTCByteImage({casted->isOptional}); break; } case type::Descriptor::eOpenCVMat: { auto casted = type::AronOpenCVMatPtr::dynamicCast(aron); - writer.writeOpenCVMat({casted->dimensions, casted->typeName, casted->isOptional}); + writer.writeOpenCVMat({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->isOptional}); + writer.writePCLPointCloud({casted->typeName, casted->isOptional}); break; } case type::Descriptor::ePosition: 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 163ec2609..0ef6f90ba 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 @@ -164,8 +164,9 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::EigenMatrixNavigatorPtr aron(new typenavigator::EigenMatrixNavigator(path)); + aron->setRows(o.rows); + aron->setCols(o.cols); aron->setTypename(o.type); - aron->setDimensions(o.dimensions); aron->setOptional(o.isOptional); token->addElement(aron); } @@ -185,9 +186,6 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::IVTCByteImageNavigatorPtr aron(new typenavigator::IVTCByteImageNavigator(path)); - aron->setTypename(o.type); - aron->setWidth(o.width); - aron->setHeight(o.height); aron->setOptional(o.isOptional); token->addElement(aron); } @@ -197,8 +195,6 @@ namespace armarx::aron::typeIO::writer Path path = generatePath(); NavigatorWriterTokenPtr token = stack.top(); typenavigator::OpenCVMatNavigatorPtr aron(new typenavigator::OpenCVMatNavigator(path)); - aron->setTypename(o.type); - aron->setDimensions(o.dimensions); aron->setOptional(o.isOptional); token->addElement(aron); } @@ -209,8 +205,6 @@ namespace armarx::aron::typeIO::writer NavigatorWriterTokenPtr token = stack.top(); typenavigator::PCLPointCloudNavigatorPtr aron(new typenavigator::PCLPointCloudNavigator(path)); aron->setTypename(o.type); - aron->setWidth(o.width); - aron->setHeight(o.height); 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 5ca58566d..04d6efecf 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 @@ -133,7 +133,7 @@ namespace armarx::aron::typeIO::writer nlohmann::json j; 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_DIMENSIONS_SLUG] = std::vector<unsigned int>({o.rows, o.cols}); j[io::Data::READER_WRITER_NDARRAY_TYPE_SLUG] = o.type; token->addElement(j); } @@ -154,8 +154,6 @@ namespace armarx::aron::typeIO::writer nlohmann::json j; 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; token->addElement(j); } @@ -165,8 +163,6 @@ namespace armarx::aron::typeIO::writer nlohmann::json j; 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; token->addElement(j); } @@ -176,7 +172,6 @@ namespace armarx::aron::typeIO::writer nlohmann::json j; 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; token->addElement(j); } diff --git a/source/RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.cpp b/source/RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.cpp index ed82f0a7e..fb58bf424 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.cpp @@ -115,6 +115,11 @@ namespace armarx::aron::datanavigator return dynamic_cast<NDArrayNavigator&>(n); } + const NDArrayNavigator NDArrayNavigator::DynamicCast(const Navigator& n) + { + return dynamic_cast<const NDArrayNavigator&>(n); + } + NDArrayNavigatorPtr NDArrayNavigator::DynamicCastAndCheck(const NavigatorPtr& n) { CheckDataNavigatorPtrForNull("NDArrayNavigator", "DynamicCastAndCheck[Before]", n); @@ -193,10 +198,8 @@ namespace armarx::aron::datanavigator typenavigator::NavigatorPtr NDArrayNavigator::recalculateType() const { - // We set all to openCVMat because it accepts n-dimensional types + // We set all to openCVMat because it accepts n-dimensional types TODO typenavigator::OpenCVMatNavigatorPtr typenav = typenavigator::OpenCVMatNavigatorPtr(new typenavigator::OpenCVMatNavigator(getPath())); - typenav->setDimensions(std::vector<int>(aron->dimensions.begin(), std::prev(aron->dimensions.end()))); - typenav->setTypename(aron->type); return typenav; } @@ -209,19 +212,16 @@ namespace armarx::aron::datanavigator switch (type->getDescriptor()) { -#define RUN_ARON_MACRO(upperType, lowerType, capsType) \ -case type::Descriptor::e##upperType: \ -{ \ - typenavigator::upperType##NavigatorPtr casted = typenavigator::upperType##Navigator::DynamicCast(type); \ - if (std::vector<int>(aron->dimensions.begin(), std::prev(aron->dimensions.end())) != casted->getDimensions() || aron->type != casted->getTypename()) \ - { \ - return false; \ - } \ - break; \ -} - - HANDLE_NDARRAY_TYPES -#undef RUN_ARON_MACRO + case type::Descriptor::eEigenMatrix: + { + auto casted = typenavigator::EigenMatrixNavigator::DynamicCast(type); + if ((unsigned int) aron->dimensions[0] != casted->getRows() || (unsigned int) aron->dimensions[1] != casted->getCols()) + { + return false; + } + break; + } + // TODO: default: throw error::AronException("NDArrayNavigator", "fullfillsType", "Could not cast a type to an NDArray-Type", getPath()); } diff --git a/source/RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.h b/source/RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.h index c6d12cc6b..4cf022696 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.h +++ b/source/RobotAPI/libraries/aron/core/navigator/data/complex/NDArray.h @@ -60,6 +60,7 @@ namespace armarx::aron::datanavigator // static methods static NDArrayNavigatorPtr DynamicCast(const NavigatorPtr& n); static NDArrayNavigator DynamicCast(Navigator& n); + static const NDArrayNavigator DynamicCast(const Navigator& n); static NDArrayNavigatorPtr DynamicCastAndCheck(const NavigatorPtr& n); static NDArrayNavigatorPtr FromAronNDArrayPtr(const data::AronNDArrayPtr& aron); 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 2ced1ba21..8d731614f 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.cpp @@ -33,7 +33,7 @@ namespace armarx::aron::typenavigator 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(true, -1, -1, {}, "")) + type(new type::AronEigenMatrix()) { } @@ -42,39 +42,11 @@ namespace armarx::aron::typenavigator Navigator(type::Descriptor::eEigenMatrix, path), type(new type::AronEigenMatrix(*o)) { - checkDimensions(simox::alg::appended({type->rows, type->cols}, type->otherDimensions)); checkTypename(type->typeName); } - bool EigenMatrixNavigator::checkDimensions(const std::vector<int>& d) const - { - 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()); - } - - for (const auto& i : d) - { - 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; - } - std::string EigenMatrixNavigator::checkTypename(const std::string& s) const { - if (isOptional() && s == "") - { - return s; - } - for (const auto& [key, list] : ACCEPTED_TYPES) { if (s == key) @@ -121,35 +93,21 @@ namespace armarx::aron::typenavigator type->cols = h; } - type::AronEigenMatrixPtr EigenMatrixNavigator::toAronEigenMatrixPtr() const - { - checkDimensions(simox::alg::appended({type->rows, type->cols}, type->otherDimensions)); - checkTypename(type->typeName); - return type; - } - std::string EigenMatrixNavigator::getTypename() const { return type->typeName; } - std::vector<int> EigenMatrixNavigator::getDimensions() const - { - return simox::alg::appended({type->rows, type->cols}, type->otherDimensions); - } - void EigenMatrixNavigator::setTypename(const std::string& u) { checkTypename(u); type->typeName = u; } - void EigenMatrixNavigator::setDimensions(const std::vector<int>& d) + type::AronEigenMatrixPtr EigenMatrixNavigator::toAronEigenMatrixPtr() const { - checkDimensions(d); - type->rows = d[0]; - type->cols = d[1]; - type->otherDimensions = simox::alg::subvector(d, 3); + checkTypename(type->typeName); + return type; } // static methods @@ -194,7 +152,7 @@ namespace armarx::aron::typenavigator std::string EigenMatrixNavigator::getName() const { - return "AronEigenMatrix<" + simox::alg::to_string(getDimensions(), ", ") + ", " + type->typeName + ">"; + return "AronEigenMatrix<" + std::to_string(type->rows) + ", " + std::to_string(type->cols) + ", " + type->typeName + ">"; } void EigenMatrixNavigator::setOptional(bool v) 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 e366ef37f..214d3bfb5 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.h +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenMatrix.h @@ -47,18 +47,15 @@ namespace armarx::aron::typenavigator EigenMatrixNavigator(const Path& path); EigenMatrixNavigator(const type::AronEigenMatrixPtr&, const Path& path); - bool checkDimensions(const std::vector<int>&) 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(int); void setCols(int); void setTypename(const std::string&); - void setDimensions(const std::vector<int>&); type::AronEigenMatrixPtr toAronEigenMatrixPtr() const; 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 399de45d1..374ec9b03 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(true, "")) + type(new type::AronEigenQuaternion()) { } @@ -41,31 +41,20 @@ namespace armarx::aron::typenavigator { } - bool EigenQuaternionNavigator::checkTypename(const std::string& s) const + std::string EigenQuaternionNavigator::checkTypename(const std::string& s) const { - if (isOptional()) - { - return true; - } - - if (s.empty()) - { - throw error::AronException("AronEigenQuaternionTypeNavigator", "checkTypename", "The typename is empty.", getPath()); - } - for (const auto& [k, t] : ACCEPTED_TYPES) { - if (s != k && std::find(t.begin(), t.end(), s) == t.end()) + 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 k; } } - return true; + throw error::StringNotValidException("EigenQuaternionNavigator", "checkTypename", "The typename is wrong.", s, getPath()); } type::AronEigenQuaternionPtr EigenQuaternionNavigator::toAronEigenQuaternionPtr() const { - checkTypename(type->typeName); return type; } @@ -74,15 +63,9 @@ namespace armarx::aron::typenavigator return type->typeName; } - std::vector<int> EigenQuaternionNavigator::getDimensions() const - { - return ACCEPTED_DIMENSION; - } - void EigenQuaternionNavigator::setTypename(const std::string& u) { - checkTypename(u); - type->typeName = u; + type->typeName = checkTypename(u); } // static methods diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenQuaternion.h b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenQuaternion.h index 8ea5977f7..cae9c4ea0 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenQuaternion.h +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/EigenQuaternion.h @@ -47,10 +47,9 @@ namespace armarx::aron::typenavigator EigenQuaternionNavigator(const Path& path); EigenQuaternionNavigator(const type::AronEigenQuaternionPtr&, const Path& path); - bool checkTypename(const std::string&) const; + std::string checkTypename(const std::string&) const; std::string getTypename() const; - std::vector<int> getDimensions() const; void setTypename(const std::string&); 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 ac72b5f15..ccde3a9ac 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(true, -1, -1, "")) + type(new type::AronIVTCByteImage()) { } @@ -41,80 +41,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) - { - return key; - } - - for (const auto& el : list) - { - if (s == el) - { - return key; - } - } - } - throw error::StringNotValidException("IVTCByteImageNavigator", "checkTypename", "The typename is wrong.", s, getPath()); - } - type::AronIVTCByteImagePtr IVTCByteImageNavigator::toAronIVTCByteImagePtr() const { - checkTypename(type->typeName); return type; } - std::vector<int> IVTCByteImageNavigator::getDimensions() const - { - return {type->width, type->height}; - } - - unsigned int IVTCByteImageNavigator::getWidth() const - { - return type->width; - } - - unsigned int IVTCByteImageNavigator::getHeight() const - { - return type->height; - } - - std::string IVTCByteImageNavigator::getTypename() const - { - return type->typeName; - } - - void IVTCByteImageNavigator::setWidth(const unsigned int& w) - { - if (w == 0) - { - throw error::AronException("AronIVTCByteImageTypeNavigator", "setWidth", "The width of an image cannot be 0", getPath()); - } - type->width = w; - } - - void IVTCByteImageNavigator::setHeight(const unsigned int& h) - { - if (h == 0) - { - throw error::AronException("AronIVTCByteImageTypeNavigator", "setHeight", "The height of an image cannot be 0", getPath()); - } - type->height = h; - } - - void IVTCByteImageNavigator::setTypename(const std::string& u) - { - type->typeName = checkTypename(u); - } - // static methods IVTCByteImageNavigatorPtr IVTCByteImageNavigator::DynamicCast(const NavigatorPtr& n) { @@ -147,7 +78,7 @@ namespace armarx::aron::typenavigator std::string IVTCByteImageNavigator::getName() const { - return "AronIVTCByteImageType<" + simox::alg::to_string(getDimensions(), ", ") + ", " + type->typeName + ">"; + return "AronIVTCByteImageType"; } void IVTCByteImageNavigator::setOptional(bool v) diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/IVTCByteImage.h b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/IVTCByteImage.h index 3fd5f987a..0946108d0 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/IVTCByteImage.h +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/IVTCByteImage.h @@ -47,17 +47,6 @@ namespace armarx::aron::typenavigator IVTCByteImageNavigator(const Path& path); IVTCByteImageNavigator(const type::AronIVTCByteImagePtr&, const Path& path); - std::string checkTypename(const std::string&) const; - - unsigned int getWidth() const; - unsigned int getHeight() const; - std::string getTypename() const; - std::vector<int> getDimensions() const; - - void setWidth(const unsigned int&); - void setHeight(const unsigned int&); - void setTypename(const std::string&); - type::AronIVTCByteImagePtr toAronIVTCByteImagePtr() const; // static methods 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 b5ec2ccce..26755ddca 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(true, {}, "")) + type(new type::AronNDArray()) { } 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 ad7e19e11..2b70f33d0 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(true, {}, "")) + type(new type::AronOpenCVMat()) { } @@ -39,76 +39,13 @@ namespace armarx::aron::typenavigator Navigator(type::Descriptor::eOpenCVMat, path), type(new type::AronOpenCVMat(*o)) { - checkDimensions(type->dimensions); - checkTypename(type->typeName); - } - - bool OpenCVMatNavigator::checkDimensions(const std::vector<int>& d) const - { - if (d.size() < ACCEPTED_DIMENSION_MIN_SIZE) - { - throw error::AronException("AronOpenCVMatTypeNavigator", "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; - })) - { - throw error::AronException("AronOpenCVMatTypeNavigator", "checkDimensions", "The dimension size is wrong. At least one empty is < -1 or 0. Got as dimension: " + simox::alg::to_string(d, ", "), getPath()); - } - return true; - } - - std::string OpenCVMatNavigator::checkTypename(const std::string& s) const - { - for (const auto& [key, list] : ACCEPTED_TYPES) - { - if (s == key) - { - return key; - } - - for (const auto& el : list) - { - if (s == el) - { - return key; - } - } - } - throw error::AronException("OpenCVMatNavigator", "checkTypename", "The typename is empty.", getPath()); } type::AronOpenCVMatPtr OpenCVMatNavigator::toAronOpenCVMatPtr() const { - checkDimensions(type->dimensions); - checkTypename(type->typeName); return type; } - std::string OpenCVMatNavigator::getTypename() const - { - return type->typeName; - } - - std::vector<int> OpenCVMatNavigator::getDimensions() const - { - return type->dimensions; - } - - void OpenCVMatNavigator::setTypename(const std::string& u) - { - type->typeName = checkTypename(u); - } - - void OpenCVMatNavigator::setDimensions(const std::vector<int>& d) - { - checkDimensions(d); - type->dimensions = d; - } - - // static methods OpenCVMatNavigatorPtr OpenCVMatNavigator::DynamicCast(const NavigatorPtr& n) { @@ -141,7 +78,7 @@ namespace armarx::aron::typenavigator std::string OpenCVMatNavigator::getName() const { - return "AronOpenCVMatType<" + simox::alg::to_string(type->dimensions, ", ") + ", " + type->typeName + ">"; + return "AronOpenCVMatType"; } void OpenCVMatNavigator::setOptional(bool v) diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/OpenCVMat.h b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/OpenCVMat.h index 18d61a3c0..82be8a9aa 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/OpenCVMat.h +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/OpenCVMat.h @@ -47,15 +47,6 @@ namespace armarx::aron::typenavigator OpenCVMatNavigator(const Path& path); OpenCVMatNavigator(const type::AronOpenCVMatPtr&, const Path& path); - bool checkDimensions(const std::vector<int>&) const; - std::string checkTypename(const std::string&) const; - - std::string getTypename() const; - std::vector<int> getDimensions() const; - - void setDimensions(const std::vector<int>&); - void setTypename(const std::string&); - type::AronOpenCVMatPtr toAronOpenCVMatPtr() const; // static methods @@ -82,7 +73,6 @@ namespace armarx::aron::typenavigator {"CV_32F", {"32F"}}, {"CV_64F", {"64F"}} }; - const unsigned int ACCEPTED_DIMENSION_MIN_SIZE = 2; private: // members 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 c31db0b5b..b91f79dc2 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Orientation.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Orientation.cpp @@ -46,16 +46,6 @@ namespace armarx::aron::typenavigator return type; } - std::vector<int> OrientationNavigator::getDimensions() const - { - return ACCEPTED_DIMENSION; - } - - std::string OrientationNavigator::getTypename() const - { - return ACCEPTED_TYPE; - } - // static methods OrientationNavigatorPtr OrientationNavigator::DynamicCast(const NavigatorPtr& n) { diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Orientation.h b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Orientation.h index 001212b29..691c09741 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Orientation.h +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Orientation.h @@ -47,12 +47,6 @@ namespace armarx::aron::typenavigator OrientationNavigator(const Path& path); OrientationNavigator(const type::AronOrientationPtr&, const Path& path); - bool checkDimensions(const std::vector<int>&) const; - bool checkTypename(const std::string&) const; - - std::string getTypename() const; - std::vector<int> getDimensions() const; - type::AronOrientationPtr toAronOrientationPtr() const; // static methods 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 b66ce47fb..59ee729c9 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(true, -1, -1, "")) + type(new type::AronPCLPointCloud()) { } @@ -59,7 +59,7 @@ namespace armarx::aron::typenavigator } } } - throw error::AronException("PCLPointCloudNavigator", "checkTypename", "The typename is empty.", getPath()); + throw error::StringNotValidException("PCLPointCloudNavigator", "checkTypename", "The typename is wrong.", s, getPath()); } type::AronPCLPointCloudPtr PCLPointCloudNavigator::toAronPCLPointCloudPtr() const @@ -68,44 +68,11 @@ namespace armarx::aron::typenavigator return type; } - std::vector<int> PCLPointCloudNavigator::getDimensions() const - { - return {type->width, type->height}; - } - - unsigned int PCLPointCloudNavigator::getWidth() const - { - return type->width; - } - - unsigned int PCLPointCloudNavigator::getHeight() const - { - return type->height; - } - std::string PCLPointCloudNavigator::getTypename() const { return type->typeName; } - void PCLPointCloudNavigator::setWidth(const unsigned int& w) - { - if (w == 0) - { - throw error::AronException("AronPCLPointCloudTypeNavigator", "setWidth", "The width of aa pointcloud cannot be 0", getPath()); - } - type->width = w; - } - - void PCLPointCloudNavigator::setHeight(const unsigned int& h) - { - if (h == 0) - { - throw error::AronException("AronPCLPointCloudTypeNavigator", "setHeight", "The height of aa pointcloud cannot be 0", getPath()); - } - type->height = h; - } - void PCLPointCloudNavigator::setTypename(const std::string& u) { type->typeName = checkTypename(u); @@ -144,7 +111,7 @@ namespace armarx::aron::typenavigator std::string PCLPointCloudNavigator::getName() const { - return "AronPCLPointCloudType<" + simox::alg::to_string(getDimensions(), ", ") + ", " + type->typeName + ">"; + return "AronPCLPointCloudType<" + type->typeName + ">"; } void PCLPointCloudNavigator::setOptional(bool v) diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.h b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.h index d0ba9c448..1b550562a 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.h +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/PCLPointCloud.h @@ -49,13 +49,8 @@ namespace armarx::aron::typenavigator std::string checkTypename(const std::string&) const; - unsigned int getWidth() const; - unsigned int getHeight() const; std::string getTypename() const; - std::vector<int> getDimensions() const; - void setWidth(const unsigned int&); - void setHeight(const unsigned int&); void setTypename(const std::string&); type::AronPCLPointCloudPtr toAronPCLPointCloudPtr() const; 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 5f165f016..e5585f27a 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Pose.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Pose.cpp @@ -46,16 +46,6 @@ namespace armarx::aron::typenavigator return type; } - std::vector<int> PoseNavigator::getDimensions() const - { - return ACCEPTED_DIMENSION; - } - - std::string PoseNavigator::getTypename() const - { - return ACCEPTED_TYPE; - } - // static methods PoseNavigatorPtr PoseNavigator::DynamicCast(const NavigatorPtr& n) { diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Pose.h b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Pose.h index a38aef961..bed12f9e9 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Pose.h +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Pose.h @@ -46,9 +46,6 @@ namespace armarx::aron::typenavigator PoseNavigator(const Path& path = Path()); PoseNavigator(const type::AronPosePtr&, const Path& path = Path()); - std::string getTypename() const; - std::vector<int> getDimensions() const; - type::AronPosePtr toAronPosePtr() const; // static methods 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 13898a188..e0066c620 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Position.cpp +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Position.cpp @@ -46,16 +46,6 @@ namespace armarx::aron::typenavigator return type; } - std::vector<int> PositionNavigator::getDimensions() const - { - return ACCEPTED_DIMENSION; - } - - std::string PositionNavigator::getTypename() const - { - return ACCEPTED_TYPE; - } - // static methods PositionNavigatorPtr PositionNavigator::DynamicCast(const NavigatorPtr& n) { diff --git a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Position.h b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Position.h index 36eccd67a..2b9a0be09 100644 --- a/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Position.h +++ b/source/RobotAPI/libraries/aron/core/navigator/type/ndarray/Position.h @@ -46,9 +46,6 @@ namespace armarx::aron::typenavigator PositionNavigator(const Path& path = Path()); PositionNavigator(const type::AronPositionPtr&, const Path& path = Path()); - std::string getTypename() const; - std::vector<int> getDimensions() const; - type::AronPositionPtr toAronPositionPtr() const; // static methods diff --git a/source/RobotAPI/libraries/aron/core/test/aronDataWithoutCodeGeneration.h b/source/RobotAPI/libraries/aron/core/test/aronDataWithoutCodeGeneration.h index 0e7e29371..db9969bbb 100644 --- a/source/RobotAPI/libraries/aron/core/test/aronDataWithoutCodeGeneration.h +++ b/source/RobotAPI/libraries/aron/core/test/aronDataWithoutCodeGeneration.h @@ -72,7 +72,7 @@ namespace armarx //this->read(reader); } - armarx::aron::typenavigator::ObjectNavigatorPtr toInitialAronType() const + armarx::aron::typenavigator::ObjectNavigatorPtr toAronType() const { armarx::aron::io::NavigatorWriter writer; this->writeType(writer); @@ -157,7 +157,7 @@ namespace armarx //this->read(reader); } - armarx::aron::typenavigator::ObjectNavigatorPtr toInitialAronType() const + armarx::aron::typenavigator::ObjectNavigatorPtr toAronType() const { armarx::aron::io::NavigatorWriter writer; this->writeType(writer); @@ -280,7 +280,7 @@ namespace armarx //this->read(reader); } - armarx::aron::typenavigator::ObjectNavigatorPtr toInitialAronType() const + armarx::aron::typenavigator::ObjectNavigatorPtr toAronType() const { armarx::aron::io::NavigatorWriter writer; this->writeType(writer); diff --git a/source/RobotAPI/libraries/aron/core/test/aronTest.cpp b/source/RobotAPI/libraries/aron/core/test/aronTest.cpp index 96c6a5c53..f9e33b547 100644 --- a/source/RobotAPI/libraries/aron/core/test/aronTest.cpp +++ b/source/RobotAPI/libraries/aron/core/test/aronTest.cpp @@ -93,12 +93,12 @@ void runTestWithInstances(T& k1, T& k2) Randomizer r; std::cout << "\t getting type 1" << std::endl; - typenavigator::ObjectNavigatorPtr k1_type_nav = k1.toInitialAronType(); + typenavigator::ObjectNavigatorPtr k1_type_nav = k1.toAronType(); type::AronObjectPtr k1_type = k1_type_nav->toAronObjectPtr(); BOOST_CHECK_NE(k1_type.get(), nullptr); std::cout << "\t getting type 2" << std::endl; - typenavigator::ObjectNavigatorPtr k2_type_nav = k2.toInitialAronType(); + typenavigator::ObjectNavigatorPtr k2_type_nav = k2.toAronType(); type::AronObjectPtr k2_type = k2_type_nav->toAronObjectPtr(); BOOST_CHECK_NE(k2_type.get(), nullptr); diff --git a/source/RobotAPI/libraries/aron/core/test/xmls/OptionalTest.xml b/source/RobotAPI/libraries/aron/core/test/xmls/OptionalTest.xml index 6ab102f24..9c7462aa0 100644 --- a/source/RobotAPI/libraries/aron/core/test/xmls/OptionalTest.xml +++ b/source/RobotAPI/libraries/aron/core/test/xmls/OptionalTest.xml @@ -11,16 +11,16 @@ </Object> <Object name='armarx::OptionalTest'> - <ObjectChild key='some_float' optional="1"> - <Float /> + <ObjectChild key='some_float'> + <Float optional="1"/> </ObjectChild> - <ObjectChild key='some_string' optional="true"> - <String /> + <ObjectChild key='some_string'> + <String optional="true"/> </ObjectChild> - <ObjectChild key='some_dict' optional="wahr"> - <Dict> + <ObjectChild key='some_dict'> + <Dict optional="wahr"> <Float /> </Dict> </ObjectChild> @@ -31,8 +31,8 @@ </Dict> </ObjectChild> - <ObjectChild key='some_list' optional="ja"> - <List> + <ObjectChild key='some_list'> + <List optional="ja"> <Double /> </List> </ObjectChild> @@ -43,12 +43,12 @@ </List> </ObjectChild> - <ObjectChild key='some_obj' optional="ja"> - <EigenMatrix rows="25" cols="10" type="long" /> + <ObjectChild key='some_obj'> + <EigenMatrix rows="25" cols="10" type="long" optional="ja"/> </ObjectChild> - <ObjectChild key='some_obj' optional="ja"> - <armarx::OptionalTestElement /> + <ObjectChild key='some_obj'> + <armarx::OptionalTestElement optional="ja"/> </ObjectChild> </Object> -- GitLab