diff --git a/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.cpp b/source/RobotAPI/components/armem/server/ExampleMemory/ExampleMemory.cpp index 8bd030bb8883e73910b182d7aad66feda0dab96f..a868149874e6f4d354c03f1cfc4847fa7fa1024f 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 b269993f79bd5c5d39c590e1359cb5790fd9b4dc..c5ba35a13aa4ec127f64d0992021d29262d54407 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 2e7053efc4da5de5221d9f9eefc12a06d484e59e..cf80de715529744ce3028457e3d746ed690cad61 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 9db04814561de68c4e7390093a7a7b3659f0219c..afe3fdc8fd7e9223d804506264bb3df49595a271 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 38b143f2baded43c3a4f028174380abaef288dcf..4e4a23991a4c1ad5558c8606c5a4d90718e2fcae 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 aa2125dada86d895e7fe063cbdc20501623576b7..669f076124b6897325a7fbcf8540466a157cb92c 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 f2f9b12c22c9a8bcf3ca88ddc4ba19f6f8168b14..97dc8570e0c202d30e3e72f7b7764dfef21bf8a0 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 a95dce2ca38e0ec513f10f67946646eb90d06069..390a0de8bdb037371ca450932fcc08b2d5d4a714 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 c0d2067811d86fd394dd29be507a9af7fcb96ba5..5927280076e02c8f267f9576b7c25aeda65cc6b3 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 c5d2bc6711486b9e51243d3e779752df8bc7a395..098952c5b1703e9d7eded4a4e002e06baa705775 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 8115d8de84c4dfeba78cf8c5b087c33156f9eb80..f631e9ecb0d891263bee59aff303672b0bf5978e 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 a6978a13ea8bb2aaa3addba4db348d26e49d6b35..821574260be0cfd14c0ba5e6cb9d3ce7aee80092 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 99fa2f7ae929fc64086e4da7569a3857ca7f51a0..038c2ed403e5b192e6b9f2a8a1e03acfceedc3e4 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 5afe9e9b66b2434117d8b03f4b40b9f2673b89a3..ae24285701f498bfbff29aadf6ceb9d37f3d6686 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 e35aaa2d8addcac9d6025e024c18c6f54b135589..3af8f241fe52a0ee860c80db3504249220c63000 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 7e1aacd7e1f01cfde240866b34789526907bbc92..31d398f4091199c39f83157b607cdf66d5e76b6e 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 226d08f67d0be1bff71d60caace9281cca914b4a..770422d16613703f467f468e43267f7ea7be04df 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 56d0ff682a608410b62edc119a9765d808a16f87..447f5b92c91cae1f1e5fed849b46daf67575c829 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 f9441c02b5d4d82a866a32380c32794dc2df298e..5ea49b510e12d25b557941c7b800ec9cb38888bf 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 9a8e86fbb3bea08ac5b132e2e4f3c30206e5a7a0..57d7e04196c97a6fa6fa249759e9a329c9ab3dc9 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 52bd376ec1e2485800500e486313f408eadaa7a9..31a0a6fa7a57174cbf43dc290a6ec4d586c41218 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 899f4fe1fe9e16c77884e7cb31de5cc5498cd9a7..7cbd3deb474b3135fd6056ae08ca28c8b8ef0f37 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 ba53bb47e8b7a406eab9d2ad738c48df0b3c62ab..36fc41b5368e511dfb58add5c5a205a2d74d5ff8 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 e6c93e450f18e039c326532cfb73a09bfc698575..4184f0754ef936b65c7732e0749354872e2b79c5 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 bbdb75fdf7bb55b287b6853457053da6aa32f476..df67a5f931ddea91664a5aa23ae5ea1623e515b7 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 20c0cbeaa94edd8e0e5213e3d4f1c869409abbeb..c1f5416755159e6af90293964a2dd37c40dad15e 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 9f306d7dd6604e43ba4e86b4e112c225c911e504..d07b9796be8b389e07afaa81a4770cb9b84c4af6 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 5a57d93733ba445caa8767f64b3d10f5340f2b7c..170b9a0867f856099e4252c1605f267743312a18 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 ac91df514b87f3377f5f9738a613cd1dc6c29ca6..a801d7f3d82dea5b177cc9b6c90e313819c9745d 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 c5a586b86153251f0064c95b79c0b17e2182f1fc..fe7724422ea6f36e136a8d0a8a2e695116915beb 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 46e45ff141ed98804cebe4d9d565b48ce2c68ffa..f20a63d68b7c94084c42c7865596cba9db101948 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 b782c80d215fb1a0e4110ec257152845b4720b50..4076b1dc777746ab632adefdffe0e64d5258dedc 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 dff7118e2e4dad0cdc46267e4a927f7d53435eac..79c8b0c05121c086da6ad7ea1b15f968d62bc53f 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 992d169ceac2aad59c72d14618a1ad65b9645bdb..8a8afb3c768a563808a9890b9008a0e7c8a9fb3d 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 248a1a6da3f4a93da04e362640bdb0fa5feedd8e..5a55b78ec50f0de49fd8f576322a7a63fefb161f 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 314779853e220f018614beef1b0ca2e43bba7424..761e2b6f041d9bd3f1b333da6aebfad4d1d9c03a 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 101ee2ee61047673fed94964f2d41da297d0c263..2224fce91eeb2f1ddbc066aeac00f9b775b8fe4d 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 3cc08abf3f794664783533aa88eeabbd9db554b9..f13b1d44be82f3edada6355d35daa019610c113c 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 567b4f1ef970f2084c7b032074808438d3d27e5d..03521edb754ceb50a668760b8026b701d7c832a4 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 9369718a0f4992338e94b3ab76bc6ddbd5d3ac98..4d1ee7b6ede5ffeaddf66fb5f70e837efa7d2786 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 94b9317e0921c8d1e9c1985eb0060d6427ddfeaa..ab6dbf1383febfcaff4cc9d11440a12cdded08bd 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 a7f8b33b4b2581bf452b1f175069fcabea03efda..8987f2d5997cc31d5e7fed489937e882cccfc3f9 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 4356f6757d20c4ba68b603d49e98d51f9aa2a3e8..60c2d93c9fde476a875b45e5a4eef0c43b64b564 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 c7f32781eb6fbcd4776b44416a894d80162cfc4c..68fc518a93a0ab02cb38b3df17ee6bd2292d6a70 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 cf5b46c25b102ce0d2e49d4e971a6c5935f50000..b4a9d4ddeb9906654052ea9220f69fa9b3d5d422 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 75f466fbe5356e8cab4ad557e476dbd42dc50255..4ad79753c4abd47b28083382b5bf63ae49f21f44 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 7b996cb7625ab2968d515cb0db05060a85e0ce60..1eb4c931657e6c420a4f5bc8841d4751bbdbaf36 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 ac53b26da313549ed26f62a47c199ec2c504d32f..fb6ef9bae1e43b15974dd227b4846db22c7082f8 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 52a70793605685fb67ec002db655e95a9e99991f..0b61e0a351cdedde1861ecd6446eb6a7eda09e2d 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 761d2d9649f88a512d7891b25075d1d14303315c..b83e8d3e6677f73a295ed8ef433d129bf7fdc2df 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 742a4063e1fd8c64df550bf4faac9ea938601848..fe1f4eb3609324092db1d8a7e77b00e05c336162 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 d31e4fca736084aeb7ac92024f5202a760cbd95b..d134d98cac7f87a05c2df329e0941b9a64a54877 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 175918c8269f936596e6283711e12e3ac0e3eaf5..f39daa017875f8a64a90e5aaf744830db6d8cc92 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 942db9a9fc5b6acf69e7d809926bdeed3efa0c96..c4aa86d6279f90c693521e39ef5f4517c92a593e 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 163ec2609e02521094a170487a7abba8b1bf07bc..0ef6f90bac500de7837f4e4eafb6867d44975973 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 5ca58566d1537df60168a6338d445b27d515afed..04d6efecf85f7ab2be02543f1012d0f8abffab45 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 ed82f0a7e91aeae360ab7a644cb4349914ce0f77..fb58bf42474a61731c48675cfcf54c021517d442 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 c6d12cc6b896a53a8b28cbc2e6c134fae58612f0..4cf022696bfcd51f2be70814a34ce22c20ce4b4e 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 2ced1ba2197de335be6bef308f90392755d42ca1..8d731614f92579473144a7649b5cb63e1c73e9b0 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 e366ef37f54b53ac4a69beea48eae73dd1651ece..214d3bfb5968254372828fea0d8a49abf4328c28 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 399de45d15c9f266fc2f3d65a112ee6582362db8..374ec9b035fd6447e25ab47653ba1e736df12d1a 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 8ea5977f76def23ca4e205641fd551bffc27d0c1..cae9c4ea03a913a4cc264d13e96ac51e67a43892 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 ac72b5f15ddcaef40d1bc865a20e595100fc7361..ccde3a9ac5f862517993cd2aee46fd6fdf989a6f 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 3fd5f987a3c946d41ee12fb516acbc932f90d69c..0946108d036946ab198bda8746a2e3a776371efe 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 b5ec2ccce750acf9d8f010a894347f969e94565d..26755ddcadc932853b2d3a5b699212788eb74fe5 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 ad7e19e1176e18be25a1abed29d295ee724e0a33..2b70f33d06d54e4735d80848d908ad8781b5d27a 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 18d61a3c0c0de28d1d0def5c29bc1553e687fccf..82be8a9aa6aebc8525a7670b2a8fcfd4e0b2ab86 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 c31db0b5b2ce28cdbeb4e78f32fa967383a34485..b91f79dc2815f96d98a198535c2ce719ef48727c 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 001212b292bba3550ee936e5a2f6b0438dcf08b3..691c09741857b0d834ebaa306fc06b93a8da7284 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 b66ce47fb2083465fb10204f18a5ec730387229e..59ee729c9c194073b7ea2026713a9bfee65d1677 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 d0ba9c44852eaf054433a79c8151c2c774352697..1b550562a8865cea505bbd8ae066ab1d1aee838c 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 5f165f016d533154a039c81f455890bc30090224..e5585f27ada144f3f487f86fff65963c0dfd3f5d 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 a38aef961a21027dfbc976f79c3d0a201bdd70e5..bed12f9e93d47d981a2e118a9582f3cacefcf517 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 13898a188d3823d3e1721a5d89c289f2c0b2c178..e0066c62041e94ef6fc3bd1ee994edd881c69edd 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 36eccd67ad92cbb138503db5a365107f5b60628f..2b9a0be09be5217bc0f40d967ae798d5aa76938c 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 0e7e29371456eb156a786976eb838ab4444d5a9a..db9969bbbafe82d38c146453d7f1449bf1bd24d9 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 96c6a5c53485b860ce967ddbbe8fb2c50cb19b66..f9e33b547c7a85fe7be570485d079e4a02c701f5 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 6ab102f24000f318b15ef7f8d8b99e71b9fc4c8b..9c7462aa054cf47e904990355c2b458f59135df4 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>