From 1d3e99505e712e15809dd357c2ab8e4f6684b82c Mon Sep 17 00:00:00 2001 From: merakulix Date: Thu, 6 Mar 2025 11:26:39 +0100 Subject: [PATCH 1/4] add getter-function declarations --- src/lib/CodeGen.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/CodeGen.cpp b/src/lib/CodeGen.cpp index f2413ca..3c2cec0 100644 --- a/src/lib/CodeGen.cpp +++ b/src/lib/CodeGen.cpp @@ -266,6 +266,9 @@ namespace tigl { hpp << "TIGL_EXPORT virtual size_t Get" << capitalizeFirstLetter(f.cpacsName) << "Count() const;"; hpp << "TIGL_EXPORT virtual const " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(size_t index) const;"; hpp << "TIGL_EXPORT virtual " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(size_t index);"; + hpp << "TIGL_EXPORT virtual const " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID) const;"; + hpp << "TIGL_EXPORT virtual " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID);"; + hpp << "TIGL_EXPORT virtual " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "Index(const std::string& UID) const;"; } // generate special accessors for uid reference vectors else if (f.cardinality() == Cardinality::Vector && f.xmlTypeName == c_uidRefType) { hpp << "TIGL_EXPORT virtual void AddTo" << capitalizeFirstLetter(f.name()) << "(const " << vectorInnerType(f) << "& value);"; From e487874040676d34b2d63b98675eb927693d6380 Mon Sep 17 00:00:00 2001 From: merakulix Date: Thu, 6 Mar 2025 15:56:15 +0100 Subject: [PATCH 2/4] update getter functions --- src/lib/CodeGen.cpp | 59 +++++++++++++++++- test/data/sequence/ref.cpp | 123 +++++++++++++++++++++++++++++++++---- 2 files changed, 167 insertions(+), 15 deletions(-) diff --git a/src/lib/CodeGen.cpp b/src/lib/CodeGen.cpp index 3c2cec0..828636c 100644 --- a/src/lib/CodeGen.cpp +++ b/src/lib/CodeGen.cpp @@ -264,11 +264,13 @@ namespace tigl { hpp << "TIGL_EXPORT virtual " << getterSetterType(f) << "& Get" << capitalizeFirstLetter(f.name()) << "();"; hpp << EmptyLine; hpp << "TIGL_EXPORT virtual size_t Get" << capitalizeFirstLetter(f.cpacsName) << "Count() const;"; + hpp << "TIGL_EXPORT virtual size_t Get" << capitalizeFirstLetter(f.cpacsName) << "Index(const std::string& UID) const;"; + hpp << EmptyLine; hpp << "TIGL_EXPORT virtual const " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(size_t index) const;"; hpp << "TIGL_EXPORT virtual " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(size_t index);"; + hpp << EmptyLine; hpp << "TIGL_EXPORT virtual const " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID) const;"; hpp << "TIGL_EXPORT virtual " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID);"; - hpp << "TIGL_EXPORT virtual " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "Index(const std::string& UID) const;"; } // generate special accessors for uid reference vectors else if (f.cardinality() == Cardinality::Vector && f.xmlTypeName == c_uidRefType) { hpp << "TIGL_EXPORT virtual void AddTo" << capitalizeFirstLetter(f.name()) << "(const " << vectorInnerType(f) << "& value);"; @@ -389,6 +391,27 @@ namespace tigl { cpp << "}"; cpp << EmptyLine; + // Getter for index by UID + cpp << "size_t " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << "Index(const std::string& UID) const"; + cpp << "{"; + { + Scope s(cpp); + cpp << "for (size_t i=0; i < Get" << capitalizeFirstLetter(f.cpacsName) << "Count(); i++) {"; + { + Scope s(cpp); + cpp << "const std::string tmpUID(" << f.fieldName() << "[i]->GetUID());"; + cpp << "if (tmpUID == UID) {"; + { + Scope s(cpp); + cpp << "return i+1;"; + } + cpp << "}"; + } + cpp << "}"; + } + cpp << "}"; + cpp << EmptyLine; + //Getters for elements in vector type by index; for (auto isConst : { false, true }) { if(isConst){ @@ -399,13 +422,13 @@ namespace tigl { cpp << "{"; { Scope s(cpp); - cpp << "index--;"; - cpp << "if (index < 0 || index >= Get" << capitalizeFirstLetter(f.cpacsName) << "Count()) {"; + cpp << "if (index < 1 || index > Get" << capitalizeFirstLetter(f.cpacsName) << "Count()) {"; { Scope s(cpp); cpp << "throw CTiglError(\"Invalid index in " << getterSetterType(f) << "::Get" << capitalizeFirstLetter(f.cpacsName) << "\", TIGL_INDEX_ERROR);"; } cpp << "}"; + cpp << "index--;"; if (vectorInnerTypeIsUniquePtr(f)) { cpp << "return *" << f.fieldName() << "[index];"; } else { @@ -416,6 +439,36 @@ namespace tigl { cpp << EmptyLine; } + //Getters for elements in vector type by uid; + for (auto isConst : { false, true }) { + if(isConst){ + cpp << "const " << vectorInnerType(f) << "& " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID) const"; + } else { + cpp << vectorInnerType(f) << "& " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID)"; + } + cpp << "{"; + { + Scope s(cpp); + cpp << "for (auto& elem : " << f.fieldName() <<" ) {"; + { + Scope s(cpp); + cpp << "if (elem->GetUID() == UID)"; + { + Scope s(cpp); + if (vectorInnerTypeIsUniquePtr(f)) { + cpp << "return *elem;"; + } else { + cpp << "return elem;"; + } + + } + cpp << "throw CTiglError(\"Invalid UID in " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << ". \\\"\"+ UID + \"\\\" not found in CPACS file!\" , TIGL_UID_ERROR);"; + } + cpp << "}"; + } + cpp << "}"; + cpp << EmptyLine; + } }// generate special accessors for uid reference vectors else if (f.cardinality() == Cardinality::Vector && f.xmlTypeName == c_uidRefType) { diff --git a/test/data/sequence/ref.cpp b/test/data/sequence/ref.cpp index 4efcaba..2a91f56 100644 --- a/test/data/sequence/ref.cpp +++ b/test/data/sequence/ref.cpp @@ -59,9 +59,14 @@ namespace generated TIGL_EXPORT virtual std::vector& GetEs(); TIGL_EXPORT virtual size_t GetECount() const; + TIGL_EXPORT virtual size_t GetEIndex(const std::string& UID) const; + TIGL_EXPORT virtual const int& GetE(size_t index) const; TIGL_EXPORT virtual int& GetE(size_t index); + TIGL_EXPORT virtual const int& GetE(const std::string& UID) const; + TIGL_EXPORT virtual int& GetE(const std::string& UID); + TIGL_EXPORT virtual const boost::optional& GetF() const; TIGL_EXPORT virtual void SetF(const boost::optional& value); @@ -69,9 +74,14 @@ namespace generated TIGL_EXPORT virtual std::vector& GetGs(); TIGL_EXPORT virtual size_t GetGCount() const; + TIGL_EXPORT virtual size_t GetGIndex(const std::string& UID) const; + TIGL_EXPORT virtual const int& GetG(size_t index) const; TIGL_EXPORT virtual int& GetG(size_t index); + TIGL_EXPORT virtual const int& GetG(const std::string& UID) const; + TIGL_EXPORT virtual int& GetG(const std::string& UID); + TIGL_EXPORT virtual const int& GetH() const; TIGL_EXPORT virtual void SetH(const int& value); @@ -79,9 +89,14 @@ namespace generated TIGL_EXPORT virtual std::vector& GetIs(); TIGL_EXPORT virtual size_t GetICount() const; + TIGL_EXPORT virtual size_t GetIIndex(const std::string& UID) const; + TIGL_EXPORT virtual const int& GetI(size_t index) const; TIGL_EXPORT virtual int& GetI(size_t index); + TIGL_EXPORT virtual const int& GetI(const std::string& UID) const; + TIGL_EXPORT virtual int& GetI(const std::string& UID); + protected: int m_a; boost::optional m_b; @@ -323,24 +338,52 @@ namespace generated return m_es.size(); } + size_t CPACSRoot::GetEIndex(const std::string& UID) const + { + for (size_t i=0; i < GetECount(); i++) { + const std::string tmpUID(m_es[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + } + int& CPACSRoot::GetE(size_t index) { - index--; - if (index < 0 || index >= GetECount()) { + if (index < 1 || index > GetECount()) { throw CTiglError("Invalid index in std::vector::GetE", TIGL_INDEX_ERROR); } + index--; return m_es[index]; } const int& CPACSRoot::GetE(size_t index) const { - index--; - if (index < 0 || index >= GetECount()) { + if (index < 1 || index > GetECount()) { throw CTiglError("Invalid index in std::vector::GetE", TIGL_INDEX_ERROR); } + index--; return m_es[index]; } + int& CPACSRoot::GetE(const std::string& UID) + { + for (auto& elem : m_es ) { + if (elem->GetUID() == UID) + return elem; + throw CTiglError("Invalid UID in CPACSRoot::GetE. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + } + + const int& CPACSRoot::GetE(const std::string& UID) const + { + for (auto& elem : m_es ) { + if (elem->GetUID() == UID) + return elem; + throw CTiglError("Invalid UID in CPACSRoot::GetE. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + } + const boost::optional& CPACSRoot::GetF() const { @@ -367,24 +410,52 @@ namespace generated return m_gs.size(); } + size_t CPACSRoot::GetGIndex(const std::string& UID) const + { + for (size_t i=0; i < GetGCount(); i++) { + const std::string tmpUID(m_gs[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + } + int& CPACSRoot::GetG(size_t index) { - index--; - if (index < 0 || index >= GetGCount()) { + if (index < 1 || index > GetGCount()) { throw CTiglError("Invalid index in std::vector::GetG", TIGL_INDEX_ERROR); } + index--; return m_gs[index]; } const int& CPACSRoot::GetG(size_t index) const { - index--; - if (index < 0 || index >= GetGCount()) { + if (index < 1 || index > GetGCount()) { throw CTiglError("Invalid index in std::vector::GetG", TIGL_INDEX_ERROR); } + index--; return m_gs[index]; } + int& CPACSRoot::GetG(const std::string& UID) + { + for (auto& elem : m_gs ) { + if (elem->GetUID() == UID) + return elem; + throw CTiglError("Invalid UID in CPACSRoot::GetG. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + } + + const int& CPACSRoot::GetG(const std::string& UID) const + { + for (auto& elem : m_gs ) { + if (elem->GetUID() == UID) + return elem; + throw CTiglError("Invalid UID in CPACSRoot::GetG. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + } + const int& CPACSRoot::GetH() const { @@ -411,24 +482,52 @@ namespace generated return m_is.size(); } + size_t CPACSRoot::GetIIndex(const std::string& UID) const + { + for (size_t i=0; i < GetICount(); i++) { + const std::string tmpUID(m_is[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + } + int& CPACSRoot::GetI(size_t index) { - index--; - if (index < 0 || index >= GetICount()) { + if (index < 1 || index > GetICount()) { throw CTiglError("Invalid index in std::vector::GetI", TIGL_INDEX_ERROR); } + index--; return m_is[index]; } const int& CPACSRoot::GetI(size_t index) const { - index--; - if (index < 0 || index >= GetICount()) { + if (index < 1 || index > GetICount()) { throw CTiglError("Invalid index in std::vector::GetI", TIGL_INDEX_ERROR); } + index--; return m_is[index]; } + int& CPACSRoot::GetI(const std::string& UID) + { + for (auto& elem : m_is ) { + if (elem->GetUID() == UID) + return elem; + throw CTiglError("Invalid UID in CPACSRoot::GetI. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + } + + const int& CPACSRoot::GetI(const std::string& UID) const + { + for (auto& elem : m_is ) { + if (elem->GetUID() == UID) + return elem; + throw CTiglError("Invalid UID in CPACSRoot::GetI. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + } + } // namespace generated } // namespace tigl From 4aea7ae493caffca18373427955f5abd379fc430 Mon Sep 17 00:00:00 2001 From: merakulix Date: Tue, 8 Apr 2025 11:56:03 +0200 Subject: [PATCH 3/4] update function for classes with optional uid --- src/lib/CodeGen.cpp | 116 ++++++++++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 41 deletions(-) diff --git a/src/lib/CodeGen.cpp b/src/lib/CodeGen.cpp index 828636c..fb21de0 100644 --- a/src/lib/CodeGen.cpp +++ b/src/lib/CodeGen.cpp @@ -32,6 +32,7 @@ namespace tigl { } namespace { + auto customReplacedType(const std::string& type, const Tables& tables) -> const std::string& { const auto p = tables.m_customTypes.find(type); return p ? *p : type; @@ -200,7 +201,7 @@ namespace tigl { return typeName; case Cardinality::Vector: { - if (vectorInnerTypeIsUniquePtr(field)) + if (vectorInnerTypeIsCPACSClass(field)) return "std::vector>"; else return "std::vector<" + typeName + ">"; @@ -220,7 +221,20 @@ namespace tigl { return customReplacedType(field); } - auto vectorInnerTypeIsUniquePtr(const Field& field) const -> bool { + auto vectorInnerClass(const Field& field) const -> Class const& + { + if (field.cardinality() != Cardinality::Vector){ + throw std::logic_error("Requested vector inner type for non-vector type"); + } + auto const it = m_types.classes.find(field.typeName); + if(vectorInnerTypeIsCPACSClass(field) && it != std::end(m_types.classes)) { + return it->second; + } else { + throw std::logic_error("VectorInnerType is not a CPACS class"); + } + } + + auto vectorInnerTypeIsCPACSClass(const Field& field) const -> bool { if (field.cardinality() != Cardinality::Vector) throw std::logic_error("Requested vector inner type for non-vector type"); return m_types.classes.find(field.typeName) != std::end(m_types.classes); @@ -264,14 +278,18 @@ namespace tigl { hpp << "TIGL_EXPORT virtual " << getterSetterType(f) << "& Get" << capitalizeFirstLetter(f.name()) << "();"; hpp << EmptyLine; hpp << "TIGL_EXPORT virtual size_t Get" << capitalizeFirstLetter(f.cpacsName) << "Count() const;"; - hpp << "TIGL_EXPORT virtual size_t Get" << capitalizeFirstLetter(f.cpacsName) << "Index(const std::string& UID) const;"; + if(vectorInnerTypeIsCPACSClass(f) && hasUidField(vectorInnerClass(f))){ + hpp << "TIGL_EXPORT virtual size_t Get" << capitalizeFirstLetter(f.cpacsName) << "Index(const std::string& UID) const;"; + } hpp << EmptyLine; hpp << "TIGL_EXPORT virtual const " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(size_t index) const;"; hpp << "TIGL_EXPORT virtual " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(size_t index);"; - hpp << EmptyLine; - hpp << "TIGL_EXPORT virtual const " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID) const;"; - hpp << "TIGL_EXPORT virtual " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID);"; - } // generate special accessors for uid reference vectors + if(vectorInnerTypeIsCPACSClass(f) && hasUidField(vectorInnerClass(f))){ + hpp << EmptyLine; + hpp << "TIGL_EXPORT virtual const " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID) const;"; + hpp << "TIGL_EXPORT virtual " << vectorInnerType(f) << "& Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID);"; + } + } // generate special accessors for uid reference vectors else if (f.cardinality() == Cardinality::Vector && f.xmlTypeName == c_uidRefType) { hpp << "TIGL_EXPORT virtual void AddTo" << capitalizeFirstLetter(f.name()) << "(const " << vectorInnerType(f) << "& value);"; hpp << "TIGL_EXPORT virtual bool RemoveFrom" << capitalizeFirstLetter(f.name()) << "(const " << vectorInnerType(f) << "& value);"; @@ -392,25 +410,38 @@ namespace tigl { cpp << EmptyLine; // Getter for index by UID - cpp << "size_t " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << "Index(const std::string& UID) const"; - cpp << "{"; - { - Scope s(cpp); - cpp << "for (size_t i=0; i < Get" << capitalizeFirstLetter(f.cpacsName) << "Count(); i++) {"; + if(vectorInnerTypeIsCPACSClass(f) && hasUidField(vectorInnerClass(f))){ + cpp << "size_t " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << "Index(const std::string& UID) const"; + cpp << "{"; { Scope s(cpp); - cpp << "const std::string tmpUID(" << f.fieldName() << "[i]->GetUID());"; - cpp << "if (tmpUID == UID) {"; + cpp << "for (size_t i=0; i < Get" << capitalizeFirstLetter(f.cpacsName) << "Count(); i++) {"; { - Scope s(cpp); - cpp << "return i+1;"; + Scope s(cpp); + if(vectorInnerTypeIsCPACSClass(f) && hasUidField(vectorInnerClass(f)) && !hasMandatoryUidField(vectorInnerClass(f))) { + cpp << "const boost::optional tmpUID(*" << f.fieldName() << "[i]->GetUID());"; + cpp << "if (tmpUID == UID) {"; + { + Scope s(cpp); + cpp << "return i+1;"; + } + cpp << "}"; + } else { + cpp << "const std::string tmpUID(" << f.fieldName() << "[i]->GetUID());"; + cpp << "if (tmpUID == UID) {"; + { + Scope s(cpp); + cpp << "return i+1;"; + } + cpp << "}"; + } } cpp << "}"; + cpp << "throw CTiglError(\"Invalid UID in " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << "Index\", TIGL_UID_ERROR);"; } cpp << "}"; + cpp << EmptyLine; } - cpp << "}"; - cpp << EmptyLine; //Getters for elements in vector type by index; for (auto isConst : { false, true }) { @@ -429,7 +460,8 @@ namespace tigl { } cpp << "}"; cpp << "index--;"; - if (vectorInnerTypeIsUniquePtr(f)) { + // CPACS classes are stored in smart pointers and we need to derefence + if (vectorInnerTypeIsCPACSClass(f)) { cpp << "return *" << f.fieldName() << "[index];"; } else { cpp << "return " << f.fieldName() << "[index];"; @@ -440,35 +472,37 @@ namespace tigl { } //Getters for elements in vector type by uid; - for (auto isConst : { false, true }) { - if(isConst){ - cpp << "const " << vectorInnerType(f) << "& " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID) const"; - } else { - cpp << vectorInnerType(f) << "& " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID)"; - } - cpp << "{"; - { - Scope s(cpp); - cpp << "for (auto& elem : " << f.fieldName() <<" ) {"; + if(vectorInnerTypeIsCPACSClass(f) && hasUidField(vectorInnerClass(f))){ + for (auto isConst : { false, true }) { + if(isConst){ + cpp << "const " << vectorInnerType(f) << "& " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID) const"; + } else { + cpp << vectorInnerType(f) << "& " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << "(const std::string& UID)"; + } + cpp << "{"; { Scope s(cpp); - cpp << "if (elem->GetUID() == UID)"; + cpp << "for (auto& elem : " << f.fieldName() <<" ) {"; { Scope s(cpp); - if (vectorInnerTypeIsUniquePtr(f)) { - cpp << "return *elem;"; - } else { - cpp << "return elem;"; - } + cpp << "if (elem->GetUID() == UID)"; + { + Scope s(cpp); + if (vectorInnerTypeIsCPACSClass(f)) { + cpp << "return *elem;"; + } else { + cpp << "return elem;"; + } + } + cpp << "}"; + cpp << "throw CTiglError(\"Invalid UID in " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << ". \\\"\"+ UID + \"\\\" not found in CPACS file!\" , TIGL_UID_ERROR);"; } - cpp << "throw CTiglError(\"Invalid UID in " << className << "::Get" << capitalizeFirstLetter(f.cpacsName) << ". \\\"\"+ UID + \"\\\" not found in CPACS file!\" , TIGL_UID_ERROR);"; - } + } cpp << "}"; - } - cpp << "}"; - cpp << EmptyLine; - } + cpp << EmptyLine; + } + } }// generate special accessors for uid reference vectors else if (f.cardinality() == Cardinality::Vector && f.xmlTypeName == c_uidRefType) { From 22b351a08f916ee83160e35e4f6eae48ea8f0e73 Mon Sep 17 00:00:00 2001 From: merakulix Date: Mon, 7 Jul 2025 16:20:19 +0200 Subject: [PATCH 4/4] update reference file to test sequence --- test/data/sequence/ref.cpp | 96 -------------------------------------- 1 file changed, 96 deletions(-) diff --git a/test/data/sequence/ref.cpp b/test/data/sequence/ref.cpp index 2a91f56..e5aeaa5 100644 --- a/test/data/sequence/ref.cpp +++ b/test/data/sequence/ref.cpp @@ -59,14 +59,10 @@ namespace generated TIGL_EXPORT virtual std::vector& GetEs(); TIGL_EXPORT virtual size_t GetECount() const; - TIGL_EXPORT virtual size_t GetEIndex(const std::string& UID) const; TIGL_EXPORT virtual const int& GetE(size_t index) const; TIGL_EXPORT virtual int& GetE(size_t index); - TIGL_EXPORT virtual const int& GetE(const std::string& UID) const; - TIGL_EXPORT virtual int& GetE(const std::string& UID); - TIGL_EXPORT virtual const boost::optional& GetF() const; TIGL_EXPORT virtual void SetF(const boost::optional& value); @@ -74,14 +70,10 @@ namespace generated TIGL_EXPORT virtual std::vector& GetGs(); TIGL_EXPORT virtual size_t GetGCount() const; - TIGL_EXPORT virtual size_t GetGIndex(const std::string& UID) const; TIGL_EXPORT virtual const int& GetG(size_t index) const; TIGL_EXPORT virtual int& GetG(size_t index); - TIGL_EXPORT virtual const int& GetG(const std::string& UID) const; - TIGL_EXPORT virtual int& GetG(const std::string& UID); - TIGL_EXPORT virtual const int& GetH() const; TIGL_EXPORT virtual void SetH(const int& value); @@ -89,14 +81,10 @@ namespace generated TIGL_EXPORT virtual std::vector& GetIs(); TIGL_EXPORT virtual size_t GetICount() const; - TIGL_EXPORT virtual size_t GetIIndex(const std::string& UID) const; TIGL_EXPORT virtual const int& GetI(size_t index) const; TIGL_EXPORT virtual int& GetI(size_t index); - TIGL_EXPORT virtual const int& GetI(const std::string& UID) const; - TIGL_EXPORT virtual int& GetI(const std::string& UID); - protected: int m_a; boost::optional m_b; @@ -338,16 +326,6 @@ namespace generated return m_es.size(); } - size_t CPACSRoot::GetEIndex(const std::string& UID) const - { - for (size_t i=0; i < GetECount(); i++) { - const std::string tmpUID(m_es[i]->GetUID()); - if (tmpUID == UID) { - return i+1; - } - } - } - int& CPACSRoot::GetE(size_t index) { if (index < 1 || index > GetECount()) { @@ -366,24 +344,6 @@ namespace generated return m_es[index]; } - int& CPACSRoot::GetE(const std::string& UID) - { - for (auto& elem : m_es ) { - if (elem->GetUID() == UID) - return elem; - throw CTiglError("Invalid UID in CPACSRoot::GetE. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); - } - } - - const int& CPACSRoot::GetE(const std::string& UID) const - { - for (auto& elem : m_es ) { - if (elem->GetUID() == UID) - return elem; - throw CTiglError("Invalid UID in CPACSRoot::GetE. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); - } - } - const boost::optional& CPACSRoot::GetF() const { @@ -410,16 +370,6 @@ namespace generated return m_gs.size(); } - size_t CPACSRoot::GetGIndex(const std::string& UID) const - { - for (size_t i=0; i < GetGCount(); i++) { - const std::string tmpUID(m_gs[i]->GetUID()); - if (tmpUID == UID) { - return i+1; - } - } - } - int& CPACSRoot::GetG(size_t index) { if (index < 1 || index > GetGCount()) { @@ -438,24 +388,6 @@ namespace generated return m_gs[index]; } - int& CPACSRoot::GetG(const std::string& UID) - { - for (auto& elem : m_gs ) { - if (elem->GetUID() == UID) - return elem; - throw CTiglError("Invalid UID in CPACSRoot::GetG. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); - } - } - - const int& CPACSRoot::GetG(const std::string& UID) const - { - for (auto& elem : m_gs ) { - if (elem->GetUID() == UID) - return elem; - throw CTiglError("Invalid UID in CPACSRoot::GetG. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); - } - } - const int& CPACSRoot::GetH() const { @@ -482,16 +414,6 @@ namespace generated return m_is.size(); } - size_t CPACSRoot::GetIIndex(const std::string& UID) const - { - for (size_t i=0; i < GetICount(); i++) { - const std::string tmpUID(m_is[i]->GetUID()); - if (tmpUID == UID) { - return i+1; - } - } - } - int& CPACSRoot::GetI(size_t index) { if (index < 1 || index > GetICount()) { @@ -510,24 +432,6 @@ namespace generated return m_is[index]; } - int& CPACSRoot::GetI(const std::string& UID) - { - for (auto& elem : m_is ) { - if (elem->GetUID() == UID) - return elem; - throw CTiglError("Invalid UID in CPACSRoot::GetI. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); - } - } - - const int& CPACSRoot::GetI(const std::string& UID) const - { - for (auto& elem : m_is ) { - if (elem->GetUID() == UID) - return elem; - throw CTiglError("Invalid UID in CPACSRoot::GetI. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); - } - } - } // namespace generated } // namespace tigl