diff --git a/ChangeLog.md b/ChangeLog.md index b8cc57aeea..5f727c57e6 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -8,6 +8,7 @@ Changes since last release - TiGL is now able to approximate profile point lists. The user can define an index list refering to points that should still be interpolated [#1276](https://github.com/DLR-SC/tigl/issues/1276). - Add `Color` class and `setObjectsColor`/`setObjectsColorRGB` functions to the TiGLCreator scripting console to set object colors without needing a native QColor object ([#1222](https://github.com/DLR-SC/tigl/issues/1222)) - CPACS Export: Choose more meaningful marker for mirrored objects uIDs [#1289](https://github.com/DLR-SC/tigl/issues/1289) + - Add fuselage decks - Add leading edge devices (LED) to TiGL and TiGLcreator [#1101](https://github.com/DLR-SC/tigl/issues/1101) - Always display the borders of the control surfaces on the wing - Add funtionality to add user-defined spotlights to the TiGLCreator ([#1245](https://github.com/DLR-SC/tigl/issues/1245)) diff --git a/TIGLCreator/filefilter.txt b/TIGLCreator/filefilter.txt new file mode 100644 index 0000000000..66534f4644 --- /dev/null +++ b/TIGLCreator/filefilter.txt @@ -0,0 +1,24 @@ +~ RULE_10_1_A_do_not_use_bufferoverflow_risky_function_for_unix +~ RULE_10_1_B_do_not_use_bufferoverflow_risky_function_for_windows +~ RULE_3_2_B_do_not_use_same_filename_more_than_once +~ RULE_3_2_CD_do_not_use_special_characters_in_filename +~ RULE_3_2_F_use_representitive_classname_for_cpp_filename +~ RULE_3_2_H_do_not_use_uppercase_for_c_filename +~ RULE_4_1_A_B_use_space_for_indentation +~ RULE_4_1_B_indent_each_enum_item_in_enum_block +~ RULE_4_1_B_locate_each_enum_item_in_seperate_line +~ RULE_4_1_C_align_long_function_parameter_list +~ RULE_4_1_E_align_conditions +~ RULE_4_2_A_B_space_around_word +~ RULE_4_5_A_brace_for_namespace_should_be_located_in_seperate_line +~ RULE_4_5_A_braces_for_function_definition_should_be_located_in_seperate_line +~ RULE_4_5_A_braces_for_type_definition_should_be_located_in_seperate_line +~ RULE_4_5_A_braces_inside_of_function_should_be_located_in_end_of_line +~ RULE_4_5_A_indent_blocks_inside_of_function +~ RULE_4_5_B_use_braces_even_for_one_statement +~ RULE_6_5_B_do_not_use_lowercase_for_macro_constants +~ RULE_7_2_B_do_not_use_goto_statement +~ RULE_8_1_A_provide_file_info_comment +~ RULE_9_1_A_do_not_use_hardcorded_include_path +~ RULE_9_2_D_use_reentrant_function +~ RULE_A_3_avoid_too_deep_blocks diff --git a/bindings/python_internal/configuration.i b/bindings/python_internal/configuration.i index 4b28e9f0a7..2bb69cc765 100644 --- a/bindings/python_internal/configuration.i +++ b/bindings/python_internal/configuration.i @@ -157,7 +157,10 @@ #include "generated/CPACSNacaProfile.h" #include "CTiglNACA4Calculator.h" #include "CPACSNacaProfile.h" - +#include "CCPACSDeck.h" +#include "generated/CPACSDecks.h" +#include "generated/CPACSCabinGeometryContour.h" +#include "CCPACSDeckComponentBase.h" %} %feature("autodoc", "3"); @@ -216,6 +219,8 @@ %boost_optional(tigl::CCPACSRotorProfiles) %boost_optional(tigl::CCPACSCurveParamPointMap) %boost_optional(tigl::CCPACSCurvePointListXYZ) +%boost_optional(tigl::CTiglMassInertia) +%boost_optional(tigl::CTiglPoint) // ---------------- Other ------------------------------// %boost_optional(tigl::CCPACSEtaIsoLine) @@ -236,6 +241,11 @@ %include "CCPACSMaterialDefinition.h" %include "generated/CPACSCap.h" +%include "CTiglMassInertia.h" +%include "CTiglPoint.h" + +%include "generated/CPACSDoubleVectorBase.h" + // -------------- Fuselage Walls, Compartments -------------// %boost_optional(tigl::generated::CPACSCompartments) %include "generated/CPACSCompartments.h" @@ -412,6 +422,61 @@ namespace tigl %include "CTiglAttachedRotorBlade.h" %include "CPACSRotorHubHinge_type.h" + +// ---------------- Decks ------------------ // + +%boost_optional(tigl::CCPACSDecks) +%boost_optional(tigl::CCPACSCabinGeometry) +%boost_optional(tigl::CCPACSSeatModules) +%boost_optional(tigl::CCPACSCabinAisles) +%boost_optional(tigl::CCPACSCabinSpaces) +%boost_optional(tigl::CCPACSSidewallPanels) +%boost_optional(tigl::CCPACSLuggageCompartments) +%boost_optional(tigl::CCPACSCeilingPanels) +%boost_optional(tigl::CCPACSGalleys) +%boost_optional(tigl::CCPACSGenericFloorModules) +%boost_optional(tigl::CCPACSLavatories) +%boost_optional(tigl::CCPACSClassDividers) +%boost_optional(tigl::CCPACSCargoContainers) +%boost_optional(tigl::CCPACSDeckDoors) + +%include "generated/CPACSDecks.h" + +%include "generated/CPACSCabinGeometryContour.h" +%include "generated/CPACSCabinGeometryContours.h" +%include "generated/CPACSCabinGeometry.h" +%include "generated/CPACSDeck_deckType.h" + +%ignore tigl::generated::CPACSSeatModules::GetSeatModules; +%ignore tigl::generated::CPACSCabinAisles::GetCabinAisles; +%ignore tigl::generated::CPACSCabinSpaces::GetCabinSpaces; +%ignore tigl::generated::CPACSSidewallPanels::GetSidewallPanels; +%ignore tigl::generated::CPACSLuggageCompartments::GetLuggageCompartments; +%ignore tigl::generated::CPACSCeilingPanels::GetCeilingPanels; +%ignore tigl::generated::CPACSGalleys::GetGalleys; +%ignore tigl::generated::CPACSGenericFloorModules::GetGenericFloorModules; +%ignore tigl::generated::CPACSLavatories::GetLavatorys; +%ignore tigl::generated::CPACSClassDividers::GetClassDividers; +%ignore tigl::generated::CPACSCargoContainers::GetCargoContainers; +%ignore tigl::generated::CPACSDeckDoors::GetDeckDoors; + +%include "generated/CPACSSeatModules.h" +%include "generated/CPACSCabinAisles.h" +%include "generated/CPACSCabinSpaces.h" +%include "generated/CPACSSidewallPanels.h" +%include "generated/CPACSLuggageCompartments.h" +%include "generated/CPACSCeilingPanels.h" +%include "generated/CPACSGalleys.h" +%include "generated/CPACSGenericFloorModules.h" +%include "generated/CPACSLavatories.h" +%include "generated/CPACSClassDividers.h" +%include "generated/CPACSCargoContainers.h" +%include "generated/CPACSDeckDoors.h" +%include "CCPACSDeckComponentBase.h" + +%include "generated/CPACSDeck.h" +%include "CCPACSDeck.h" + // --------------- Fuselage tanks -----------------// %boost_optional(tigl::generated::CPACSVessels) %boost_optional(tigl::CCPACSVessels) @@ -653,7 +718,6 @@ class CCPACSSystemElements; %boost_optional(tigl::CCPACSSystemControlDevices) %boost_optional_enum(tigl::ECPACSSourceTarget_externalElement) -%include "CTiglMassInertia.h" %include "generated/CPACSUIDSequence.h" %include "generated/CPACSComponent.h" %include "CCPACSComponent.h" @@ -670,7 +734,6 @@ class CCPACSSystemElements; %include "CCPACSSystemConnection.h" %include "generated/CPACSSystemConnections.h" -%include "CTiglPoint.h" %include "generated/CPACSComponents.h" %include "generated/CPACSGenericSystem.h" %include "CCPACSGenericSystem.h" @@ -721,7 +784,9 @@ class CCPACSSystemElements; tigl::CCPACSDuctAssembly, tigl::CCPACSFuelTank, tigl::CCPACSVessel, - tigl::CCPACSComponent + tigl::CCPACSComponent, + tigl::CCPACSDeck, + tigl::CCPACSDeckComponentBase ); namespace tigl diff --git a/cpacs_gen_input/CustomTypes.txt b/cpacs_gen_input/CustomTypes.txt index 6f00bc0a85..ec3f428ed0 100644 --- a/cpacs_gen_input/CustomTypes.txt +++ b/cpacs_gen_input/CustomTypes.txt @@ -50,6 +50,10 @@ CPACSFuselageSections CCPACSFuselageSections CPACSFuselageElement CCPACSFuselageSectionElement CPACSFuselageElements CCPACSFuselageSectionElements +CPACSDeck CCPACSDeck +CPACSDeckComponentBase CCPACSDeckComponentBase +CPACSDeckComponent2DBase CCPACSDeckComponent2DBase + CPACSComponentSegment CCPACSWingComponentSegment CPACSComponentSegments CCPACSWingComponentSegments CPACSWing CCPACSWing diff --git a/cpacs_gen_input/PruneList.txt b/cpacs_gen_input/PruneList.txt index aef71978c8..50e8a46949 100644 --- a/cpacs_gen_input/PruneList.txt +++ b/cpacs_gen_input/PruneList.txt @@ -44,7 +44,6 @@ CPACSControlLaws CPACSReference // in fuselage -CPACSDecks CPACSFuselageCutOuts CPACSFuselageFuelTanks CPACSCenterFuselageAreasAssembly diff --git a/cpacs_gen_input/cpacs_schema.xsd b/cpacs_gen_input/cpacs_schema.xsd index c0de6c5c4e..b9a0043459 100644 --- a/cpacs_gen_input/cpacs_schema.xsd +++ b/cpacs_gen_input/cpacs_schema.xsd @@ -25424,12 +25424,12 @@ The fuel tank volume type should also be used for the wing fuel tank - + @@ -34943,59 +34943,12 @@ The fuel tank volume type should also be used for the wing fuel tank - + - - - - - - Cargo container - - - Cargo container type for placing an instance of a cargo container in the parent deck. - - - - - - - - - - Name - - - - - Description - - - - - UID of the cargo container element in the cpacs/vehicles/deckElements node - - - - - Position in x - - - - - Position in y - - - - - - - - @@ -35012,7 +34965,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Seat module @@ -35038,7 +34991,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Galley @@ -35064,7 +35017,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Generic floor module @@ -35090,7 +35043,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Lavatory @@ -35116,7 +35069,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Class divider @@ -35264,142 +35217,6 @@ The fuel tank volume type should also be used for the wing fuel tank - - - - - - Bounding Box - - - - - - - - - - Length in x - - - - - Length in y - - - - - Length in z - - - - - Origin - - - - - - - - - - - - - Geometry - - - Description of the deck element geometry. This might be either a bounding box definition or a link to a generic geometry component. - - - - - - - - - - - - - - - - - - - - Cargo container element for use in the decks - - - - - - - - - - - - - - - - - Description - - - - - - Contour: single or double - - - - - - - - - - - - - Delta x - - - - - - Delta y - - - - - - Delta y of the base - - - - - - Delta z - - - - - - Delta z kink - - - - - - - - - @@ -35416,7 +35233,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + @@ -35438,7 +35255,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Ceiling panel element for use in the decks @@ -35464,7 +35281,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Class divider element for use in the decks @@ -35490,47 +35307,47 @@ The fuel tank volume type should also be used for the wing fuel tank - + Ceiling panel elements for use in the decks - + Class divider elements for use in the decks - + Galley elements for use in the decks - + Generic floor elements for use in the decks - + Lavatory elements for use in the decks - + Luggage compartment elements for use in the decks - + Seat elements for use in the decks - + Sidewall panel elements for use in the decks - + Cargo container elements for use in the decks @@ -35554,22 +35371,14 @@ The fuel tank volume type should also be used for the wing fuel tank - - - - - Description - - - - - + + + Number of trolleys - - + @@ -35590,7 +35399,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Galley element for use in the decks @@ -35616,7 +35425,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Lavatory element for use in the decks @@ -35642,7 +35451,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Luggage compartment element for use in the decks @@ -35666,22 +35475,14 @@ The fuel tank volume type should also be used for the wing fuel tank - - - - - Description - - - - - + + + Number of seats - - + @@ -35702,7 +35503,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Seat element for use in the decks @@ -35728,7 +35529,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Generic floor element for use in the decks @@ -35754,7 +35555,7 @@ The fuel tank volume type should also be used for the wing fuel tank - + Sidewall panel element for use in the decks @@ -35764,29 +35565,6 @@ The fuel tank volume type should also be used for the wing fuel tank - - - - - - Generic geometry component - - - - - - - - - - - - - - - - - @@ -35823,102 +35601,6 @@ The fuel tank volume type should also be used for the wing fuel tank - - - - - - Deck component - - - - - - - - - - Name - - - - - Description - - - - - UID of the corresponding element in the cpacs/vehicles/deckElemets node - - - - - - - - - - - - - - - - Deck element - - - - - - - - - - Description - - - - - - - - - - - - - - - - Mass - - - Description of mass, center of gravity and inertia - - - - - - - - - - - Mass value - - - - - Center of gravity (x,y,z) - - - - - - - - - diff --git a/src/CCPACSPoint.cpp b/src/CCPACSPoint.cpp index 93435ae41f..bef8cc3b6f 100644 --- a/src/CCPACSPoint.cpp +++ b/src/CCPACSPoint.cpp @@ -36,16 +36,6 @@ CCPACSPoint::CCPACSPoint(CCPACSPointList* parent, CTiglUIDManager* uidMgr) { } -CCPACSPoint::CCPACSPoint(CCPACSBoundingBox* parent, CTiglUIDManager* uidMgr) - : generated::CPACSPoint(parent, uidMgr) -{ -} - -CCPACSPoint::CCPACSPoint(CCPACSDeckElementMass* parent, CTiglUIDManager* uidMgr) - : generated::CPACSPoint(parent, uidMgr) -{ -} - CCPACSPoint::CCPACSPoint(CCPACSTransformation* parent, CTiglUIDManager* uidMgr) : generated::CPACSPoint(parent, uidMgr) { diff --git a/src/CCPACSPoint.h b/src/CCPACSPoint.h index 48a350aea2..bcf31fee92 100644 --- a/src/CCPACSPoint.h +++ b/src/CCPACSPoint.h @@ -27,8 +27,6 @@ class CCPACSPoint : public generated::CPACSPoint TIGL_EXPORT CCPACSPoint(CCPACSControlSurfaceStep* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSPoint(CCPACSControlSurfaceHingePoint* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSPoint(CCPACSPointList* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CCPACSPoint(CCPACSBoundingBox* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CCPACSPoint(CCPACSDeckElementMass* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSPoint(CCPACSTransformation* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSPoint(CCPACSTransformationSE3* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSPoint(CCPACSElementMass* parent, CTiglUIDManager* uidMgr); diff --git a/src/api/tigl.h b/src/api/tigl.h index 7431b9cdba..83246dc212 100644 --- a/src/api/tigl.h +++ b/src/api/tigl.h @@ -237,7 +237,9 @@ enum TiglGeometricComponentType TIGL_COMPONENT_TANK = 27, /**< The Component is a fuel tank */ TIGL_COMPONENT_TANK_HULL = 28, /**< The Component is a vessel of a fuel tank */ TIGL_COMPONENT_SYSTEM_COMPONENT = 29, /**< The Component is a system component */ - TIGL_COMPONENT_OTHER = 30 + TIGL_COMPONENT_DECK = 30, /**< The Component is a fuselage deck */ + TIGL_COMPONENT_DECK_COMPONENT = 31, /**< The Component is a component of a fuselage deck */ + TIGL_COMPONENT_OTHER = 32 }; typedef enum TiglGeometricComponentType TiglGeometricComponentType; diff --git a/src/configuration/CCPACSConfiguration.cpp b/src/configuration/CCPACSConfiguration.cpp index 0dfc7b2dda..5fe6738877 100644 --- a/src/configuration/CCPACSConfiguration.cpp +++ b/src/configuration/CCPACSConfiguration.cpp @@ -82,6 +82,7 @@ namespace { const std::string farFieldXPath = "/cpacs/toolspecific/cFD/farField"; const std::string enginesXPath = "/cpacs/vehicles/engines"; const std::string systemElementsXPath = "/cpacs/vehicles/systemElements"; + const std::string deckElementsXPath = "/cpacs/vehicles/deckElements"; } // Build up memory structure for whole CPACS file @@ -111,6 +112,10 @@ void CCPACSConfiguration::ReadCPACS(const std::string& configurationUID) systemElements = boost::in_place(nullptr, &uidManager); systemElements->ReadCPACS(tixiDocumentHandle, systemElementsXPath); } + if (tixi::TixiCheckElement(tixiDocumentHandle, deckElementsXPath)) { + deckElements = boost::in_place(nullptr, &uidManager); + deckElements->ReadCPACS(tixiDocumentHandle, deckElementsXPath); + } // create new root component for CTiglUIDManager const bool isRotorcraft = tixi::TixiCheckElement(tixiDocumentHandle, "/cpacs/vehicles/rotorcraft/model[@uID='" + std::string(configurationUID) + "']"); diff --git a/src/configuration/CCPACSConfiguration.h b/src/configuration/CCPACSConfiguration.h index 4c8c2ee8de..ef53e521a9 100644 --- a/src/configuration/CCPACSConfiguration.h +++ b/src/configuration/CCPACSConfiguration.h @@ -44,6 +44,7 @@ #include "generated/CPACSProfiles.h" #include "generated/CPACSEngines.h" #include "generated/CPACSSystemElements.h" +#include "generated/CPACSDeckElements.h" namespace tigl { @@ -281,6 +282,7 @@ class CCPACSConfiguration boost::optional profiles; /**< Wing airfoils, fuselage profiles, rotor airfoils, guide curve profiles */ boost::optional engines; /**< Engines under vehicle node */ boost::optional systemElements; /**< System elements under vehicle node */ + boost::optional deckElements; /**< Deck elements under vehicle node */ TixiDocumentHandle tixiDocumentHandle; /**< Handle for internal TixiDocument */ CCPACSHeader header; /**< Configuration header element */ CCPACSFarField farField; /**< Far field configuration for CFD tools */ diff --git a/src/decks/CCPACSDeck.cpp b/src/decks/CCPACSDeck.cpp new file mode 100644 index 0000000000..a2327c2552 --- /dev/null +++ b/src/decks/CCPACSDeck.cpp @@ -0,0 +1,147 @@ +/* +* Copyright (C) 2007-2026 German Aerospace Center (DLR/SC) +* +* Created: 2026-03-17 Marko Alder +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "CCPACSDeck.h" +#include "generated/CPACSDecks.h" +#include "CCPACSFuselage.h" +#include "CCPACSDeckComponentBase.h" + +#include "tiglcommonfunctions.h" +#include "CNamedShape.h" +#include "CGroupShapes.h" + +namespace tigl +{ + +// Constructor +CCPACSDeck::CCPACSDeck(CCPACSDecks* parent, CTiglUIDManager* uidMgr) + : generated::CPACSDeck(parent, uidMgr) + , CTiglRelativelyPositionedComponent(&m_parentUID, &m_transformation) +{ +} + +// Destructor +CCPACSDeck::~CCPACSDeck() +{ +} + +void CCPACSDeck::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) +{ + Reset(); + generated::CPACSDeck::ReadCPACS(tixiHandle, xpath); + + // Default parent: if no explicit parentUID is given, place the deck + // relative to the surrounding fuselage. + if ((!m_parentUID || m_parentUID->empty()) && m_parent && m_parent->GetParent()) { + generated::CPACSDeck::SetParentUID(boost::optional(m_parent->GetParent()->GetUID())); + } +} + +std::string CCPACSDeck::GetDefaultedUID() const +{ + return GetUID(); +} + +// Returns the parent configuration +CCPACSConfiguration const& CCPACSDeck::GetConfiguration() const +{ + return m_parent->GetParent()->GetConfiguration(); +} + +TiglGeometricComponentType CCPACSDeck::GetComponentType() const +{ + return TIGL_COMPONENT_DECK; +} + +TiglGeometricComponentIntent CCPACSDeck::GetComponentIntent() const +{ + return TIGL_INTENT_PHYSICAL; +} + +// build loft +PNamedShape CCPACSDeck::BuildLoft() const +{ + ListPNamedShape shapes; + + auto appendLofts = [&shapes](const auto& components) { + for (const auto& component : components) { + if (component) { + shapes.push_back(component->GetLoft()); + } + } + }; + + if (GetSeatModules()) { + appendLofts(GetSeatModules()->GetSeatModules()); + } + + if (GetSidewallPanels()) { + appendLofts(GetSidewallPanels()->GetSidewallPanels()); + } + + if (GetLuggageCompartments()) { + appendLofts(GetLuggageCompartments()->GetLuggageCompartments()); + } + + if (GetCeilingPanels()) { + appendLofts(GetCeilingPanels()->GetCeilingPanels()); + } + + if (GetGalleys()) { + appendLofts(GetGalleys()->GetGalleys()); + } + + if (GetGenericFloorModules()) { + appendLofts(GetGenericFloorModules()->GetGenericFloorModules()); + } + + if (GetLavatories()) { + appendLofts(GetLavatories()->GetLavatorys()); + } + + if (GetClassDividers()) { + appendLofts(GetClassDividers()->GetClassDividers()); + } + + if (GetCargoContainers()) { + appendLofts(GetCargoContainers()->GetCargoContainers()); + } + + PNamedShape groupedShape = CGroupShapes(shapes); + groupedShape->SetName(GetUID().c_str()); + groupedShape->SetShortName(GetShortShapeName().c_str()); + + return groupedShape; +} + +// get short name for loft +std::string CCPACSDeck::GetShortShapeName() const +{ + unsigned int i = 0; + + for (const auto& d : GetParent()->GetDecks()) { + ++i; + if (GetUID() == d->GetUID()) { + return "D" + std::to_string(i); + } + } + + return "D"; +} + +} // end namespace tigl diff --git a/src/decks/CCPACSDeck.h b/src/decks/CCPACSDeck.h new file mode 100644 index 0000000000..fd365d320d --- /dev/null +++ b/src/decks/CCPACSDeck.h @@ -0,0 +1,60 @@ +/* +* Copyright (C) 2007-2026 German Aerospace Center (DLR/SC) +* +* Created: 2026-03-17 Marko Alder +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma once + +#include "generated/CPACSDeck.h" +#include "CTiglRelativelyPositionedComponent.h" + +namespace tigl +{ + +class CCPACSConfiguration; + +class CCPACSDeck : public generated::CPACSDeck, public CTiglRelativelyPositionedComponent +{ +public: + // Constructor + TIGL_EXPORT CCPACSDeck(CCPACSDecks* parent, CTiglUIDManager* uidMgr); + + // Virtual destructor + TIGL_EXPORT virtual ~CCPACSDeck(); + + TIGL_EXPORT void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) override; + + TIGL_EXPORT std::string GetDefaultedUID() const override; + + // Returns the parent configuration + TIGL_EXPORT CCPACSConfiguration const& GetConfiguration() const; + + // Returns the Component Type TIGL_COMPONENT_GENERICSYSTEM. + TIGL_EXPORT TiglGeometricComponentType GetComponentType() const override; + + /// @brief Returns the TiGL geometric component intent. + TIGL_EXPORT TiglGeometricComponentIntent GetComponentIntent() const override; + +protected: + // Build the shape of the system + PNamedShape BuildLoft() const override; + +private: + // get short name for loft + std::string GetShortShapeName() const; +}; + +} // end namespace tigl diff --git a/src/decks/CCPACSDeckComponentBase.cpp b/src/decks/CCPACSDeckComponentBase.cpp new file mode 100644 index 0000000000..407ddad815 --- /dev/null +++ b/src/decks/CCPACSDeckComponentBase.cpp @@ -0,0 +1,297 @@ +/* +* Copyright (C) 2007-2026 German Aerospace Center (DLR/SC) +* +* Created: 2026-03-17 Marko Alder +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include +#include + +#include "CCPACSDeckComponentBase.h" +#include "CCPACSDeck.h" +#include "generated/CPACSVehicleElementBase.h" +#include "generated/CPACSSeatElement.h" +#include "generated/CPACSGalleyElement.h" + +#include "CCPACSConfiguration.h" +#include "CTiglUIDManager.h" +#include "CTiglElementGeometryBuilder.h" +#include "CTiglElementMassBuilder.h" +#include "tiglcommonfunctions.h" +#include "CPACSElementGeometry.h" +#include "CPACSElementMass.h" + +#include "CNamedShape.h" + +namespace tigl +{ +namespace +{ + + template + const CCPACSElementGeometry* ResolveGeometry(const CTiglUIDManager& uidMgr, const std::string& uid) + { + if (!uidMgr.IsType(uid)) { + return nullptr; + } + return &uidMgr.ResolveObject(uid).GetGeometry(); + } + + template + const boost::optional* ResolveMassDescription(const CTiglUIDManager& uidMgr, + const std::string& uid) + { + if (!uidMgr.IsType(uid)) { + return nullptr; + } + return &uidMgr.ResolveObject(uid).GetMass(); + } + + template struct SupportedDeckElementTypes { + static const CCPACSElementGeometry* GetGeometry(const CTiglUIDManager& uidMgr, const std::string& uid) + { + const CCPACSElementGeometry* geometry = nullptr; + ((geometry = geometry ? geometry : ResolveGeometry(uidMgr, uid)), ...); + return geometry; + } + + static const boost::optional* GetMassDescription(const CTiglUIDManager& uidMgr, + const std::string& uid) + { + const boost::optional* mass = nullptr; + ((mass = mass ? mass : ResolveMassDescription(uidMgr, uid)), ...); + return mass; + } + }; + + using DeckElementTypes = + SupportedDeckElementTypes; + + const CCPACSElementGeometry* GetGeometry(const CTiglUIDManager& uidMgr, const std::string& uid) + { + return DeckElementTypes::GetGeometry(uidMgr, uid); + } + + const boost::optional* GetMassDescription(const CTiglUIDManager& uidMgr, const std::string& uid) + { + return DeckElementTypes::GetMassDescription(uidMgr, uid); + } + +} // namespace + +CCPACSDeckComponentBase::CCPACSDeckComponentBase(CCPACSCeilingPanels* parent, CTiglUIDManager* uidMgr) + : generated::CPACSDeckComponentBase(parent, uidMgr) + , CTiglRelativelyPositionedComponent(parent->GetParent(), &m_transformation) + , m_mass(*this, &CCPACSDeckComponentBase::BuildMass) + , m_parentDeck(parent->GetParent()) +{ +} + +CCPACSDeckComponentBase::CCPACSDeckComponentBase(CCPACSClassDividers* parent, CTiglUIDManager* uidMgr) + : generated::CPACSDeckComponentBase(parent, uidMgr) + , CTiglRelativelyPositionedComponent(parent->GetParent(), &m_transformation) + , m_mass(*this, &CCPACSDeckComponentBase::BuildMass) + , m_parentDeck(parent->GetParent()) +{ +} + +CCPACSDeckComponentBase::CCPACSDeckComponentBase(CCPACSGalleys* parent, CTiglUIDManager* uidMgr) + : generated::CPACSDeckComponentBase(parent, uidMgr) + , CTiglRelativelyPositionedComponent(parent->GetParent(), &m_transformation) + , m_mass(*this, &CCPACSDeckComponentBase::BuildMass) + , m_parentDeck(parent->GetParent()) +{ +} + +CCPACSDeckComponentBase::CCPACSDeckComponentBase(CCPACSGenericFloorModules* parent, CTiglUIDManager* uidMgr) + : generated::CPACSDeckComponentBase(parent, uidMgr) + , CTiglRelativelyPositionedComponent(parent->GetParent(), &m_transformation) + , m_mass(*this, &CCPACSDeckComponentBase::BuildMass) + , m_parentDeck(parent->GetParent()) +{ +} + +CCPACSDeckComponentBase::CCPACSDeckComponentBase(CCPACSLavatories* parent, CTiglUIDManager* uidMgr) + : generated::CPACSDeckComponentBase(parent, uidMgr) + , CTiglRelativelyPositionedComponent(parent->GetParent(), &m_transformation) + , m_mass(*this, &CCPACSDeckComponentBase::BuildMass) + , m_parentDeck(parent->GetParent()) +{ +} + +CCPACSDeckComponentBase::CCPACSDeckComponentBase(CCPACSLuggageCompartments* parent, CTiglUIDManager* uidMgr) + : generated::CPACSDeckComponentBase(parent, uidMgr) + , CTiglRelativelyPositionedComponent(parent->GetParent(), &m_transformation) + , m_mass(*this, &CCPACSDeckComponentBase::BuildMass) + , m_parentDeck(parent->GetParent()) +{ +} + +CCPACSDeckComponentBase::CCPACSDeckComponentBase(CCPACSSeatModules* parent, CTiglUIDManager* uidMgr) + : generated::CPACSDeckComponentBase(parent, uidMgr) + , CTiglRelativelyPositionedComponent(parent->GetParent(), &m_transformation) + , m_mass(*this, &CCPACSDeckComponentBase::BuildMass) + , m_parentDeck(parent->GetParent()) +{ +} + +CCPACSDeckComponentBase::CCPACSDeckComponentBase(CCPACSSidewallPanels* parent, CTiglUIDManager* uidMgr) + : generated::CPACSDeckComponentBase(parent, uidMgr) + , CTiglRelativelyPositionedComponent(parent->GetParent(), &m_transformation) + , m_mass(*this, &CCPACSDeckComponentBase::BuildMass) + , m_parentDeck(parent->GetParent()) +{ +} + +CCPACSDeckComponentBase::CCPACSDeckComponentBase(CCPACSCargoContainers* parent, CTiglUIDManager* uidMgr) + : generated::CPACSDeckComponentBase(parent, uidMgr) + , CTiglRelativelyPositionedComponent(parent->GetParent(), &m_transformation) + , m_mass(*this, &CCPACSDeckComponentBase::BuildMass) + , m_parentDeck(parent->GetParent()) +{ +} + +std::string CCPACSDeckComponentBase::GetDefaultedUID() const +{ + return generated::CPACSDeckComponentBase::GetUID(); +} + +CCPACSConfiguration const& CCPACSDeckComponentBase::GetConfiguration() const +{ + return m_parentDeck->GetConfiguration(); +} + +TiglGeometricComponentType CCPACSDeckComponentBase::GetComponentType() const +{ + return TIGL_COMPONENT_DECK_COMPONENT; +} + +TiglGeometricComponentIntent CCPACSDeckComponentBase::GetComponentIntent() const +{ + return TIGL_INTENT_PHYSICAL; +} + +TiglGeometryRepresentation CCPACSDeckComponentBase::GetComponentRepresentation() const +{ + using CPACSGeomRep = generated::CPACSGeometryRepresentation; + const auto representation = GetElementGeometry().GetRepresentation().get_value_or(CPACSGeomRep::physical); + + if (representation == CPACSGeomRep::physical) { + return TIGL_GEOMREP_PHYSICAL; + } + if (representation == CPACSGeomRep::envelope) { + return TIGL_GEOMREP_ENVELOPE; + } + + throw CTiglError("Invalid geometry representation for component with uID \"" + + GetObjectUID().get_value_or("unnamed") + "\"."); +} + +std::string CCPACSDeckComponentBase::GetComponentRepresentationAsString() const +{ + const char* representation = ::tiglGeometryRepresentationToString( + static_cast(GetComponentRepresentation())); + + if (!representation) { + throw CTiglError("Invalid geometry representation for component with uID \"" + + GetObjectUID().get_value_or("unnamed") + "\"."); + } + + return representation; +} + +void CCPACSDeckComponentBase::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& objectXPath) +{ + Reset(); + generated::CPACSDeckComponentBase::ReadCPACS(tixiHandle, objectXPath); + + char* cCPACSPath = NULL; + tixiGetDocumentPath(tixiHandle, &cCPACSPath); + _cpacsDocPath = cCPACSPath ? std::string(cCPACSPath) : std::string(); +} + +boost::optional CCPACSDeckComponentBase::GetMass() const +{ + return m_mass->mass; +} + +boost::optional CCPACSDeckComponentBase::GetCenterOfGravityLocal() const +{ + return m_mass->cogLocal; +} + +boost::optional CCPACSDeckComponentBase::GetCenterOfGravityGlobal() const +{ + const auto cogLocal = GetCenterOfGravityLocal(); + if (!cogLocal) { + return boost::none; + } + + return GetTransformationMatrix() * (*cogLocal); +} + +boost::optional CCPACSDeckComponentBase::GetMassInertiaLocal() const +{ + return m_mass->inertiaLocal; +} + +const CCPACSElementGeometry& CCPACSDeckComponentBase::GetElementGeometry() const +{ + const CCPACSElementGeometry* const geom = GetGeometry(*m_uidMgr, m_deckElementUID); + + if (!geom) { + throw CTiglError("Unsupported deck element for uID \"" + m_deckElementUID + "\"."); + } + + return *geom; +} + +PNamedShape CCPACSDeckComponentBase::BuildLocalLoft() const +{ + const CCPACSElementGeometry& geom = GetElementGeometry(); + const std::string compName = GetObjectUID().get_value_or("unnamed"); + + CTiglElementGeometryBuilder builder(*this, GetConfiguration(), geom, compName, _cpacsDocPath); + return builder.BuildShape(); +} + +PNamedShape CCPACSDeckComponentBase::BuildLoft() const +{ + return GetTransformationMatrix().Transform(BuildLocalLoft()); +} + +void CCPACSDeckComponentBase::BuildMass(MassCache& cache) const +{ + const auto* massPtr = GetMassDescription(*m_uidMgr, m_deckElementUID); + if (!massPtr || !*massPtr) { + LOG(WARNING) << "No mass definition for uID \"" + m_deckElementUID + "\"!"; + return; + } + + const CCPACSElementMass& massDef = massPtr->get(); + + CTiglElementMassBuilder builder(massDef, m_deckElementUID, BuildLocalLoft()->Shape()); + + const auto result = builder.EvaluateMass(); + cache.mass = result.mass; + cache.cogLocal = result.cogLocal; + cache.inertiaLocal = result.inertiaLocal; + + if (cache.mass) { + *cache.mass *= GetTransformationMatrix().GetVolumeScaleFactor(); + } +} + +} // namespace tigl diff --git a/src/decks/CCPACSDeckComponentBase.h b/src/decks/CCPACSDeckComponentBase.h new file mode 100644 index 0000000000..9a2bb96afe --- /dev/null +++ b/src/decks/CCPACSDeckComponentBase.h @@ -0,0 +1,187 @@ +/* +* Copyright (C) 2007-2026 German Aerospace Center (DLR/SC) +* +* Created: 2026-03-17 Marko Alder +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#pragma once + +#include "generated/CPACSDeckComponentBase.h" +#include "generated/CPACSMassInertia.h" +#include "CTiglRelativelyPositionedComponent.h" +#include "CTiglPoint.h" +#include "CTiglMassInertia.h" + +namespace tigl +{ +class CCPACSConfiguration; + +/** + * @brief Representing a CPACS element. + * + * Mass properties: + * - The referenced element may define either an explicit mass or a density. + * - The mass returned represents the mass of the transformed component instance. + * If the component is subject to scaling when instantiated at deck level, the returned mass is scaled + * by the corresponding volume scale factor. + * - The center of gravity (CoG) can be given explicitly via CPACS @c location. + * If not provided, it is derived from the geometric centroid of the component. + * + * Coordinate frames: + * - The local center of gravity and local mass inertia are expressed in the component's + * local coordinate system. + */ +class CCPACSDeckComponentBase : public generated::CPACSDeckComponentBase, public CTiglRelativelyPositionedComponent +{ +public: + /** + * @brief Constructs a CCPACSDeckComponent2DBase. + * @param parent Parent CPACS container owning this component. + * @param uidMgr UID manager for resolving referenced deck elements. + */ + TIGL_EXPORT CCPACSDeckComponentBase(CCPACSCeilingPanels* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT CCPACSDeckComponentBase(CCPACSClassDividers* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT CCPACSDeckComponentBase(CCPACSGalleys* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT CCPACSDeckComponentBase(CCPACSGenericFloorModules* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT CCPACSDeckComponentBase(CCPACSLavatories* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT CCPACSDeckComponentBase(CCPACSLuggageCompartments* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT CCPACSDeckComponentBase(CCPACSSeatModules* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT CCPACSDeckComponentBase(CCPACSSidewallPanels* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT CCPACSDeckComponentBase(CCPACSCargoContainers* parent, CTiglUIDManager* uidMgr); + + /** + * @brief Returns the component UID (defaulted if required). + */ + TIGL_EXPORT std::string GetDefaultedUID() const override; + + TIGL_EXPORT CCPACSConfiguration const& GetConfiguration() const; + + /** + * @brief Reads the CPACS subtree of this component. + */ + TIGL_EXPORT void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& objectXPath) override; + + /// @brief Returns the TiGL geometric component type. + TIGL_EXPORT TiglGeometricComponentType GetComponentType() const override; + + /// @brief Returns the TiGL geometric component intent. + TIGL_EXPORT TiglGeometricComponentIntent GetComponentIntent() const override; + + /** + * @brief Returns the geometric representation type of the referenced deck element. + * + * The representation is obtained from the referenced element geometry definition. + * It is returned as one of the TiGL constants + * @c TIGL_GEOMREP_PHYSICAL (1) or @c TIGL_GEOMREP_ENVELOPE (2). + * If no explicit representation is given in CPACS, + * @c TIGL_GEOMREP_PHYSICAL (1) is returned. + * + * @return Geometry representation type of the component. + */ + TIGL_EXPORT TiglGeometryRepresentation GetComponentRepresentation() const; + + /** + * @brief Returns the geometry representation of the referenced system element as string. + * + * Possible return values are: + * - @c "physical" + * - @c "envelope" + * + * If no explicit representation is given in CPACS, @c "physical" is returned. + * + * @return Geometry representation as human-readable string. + */ + TIGL_EXPORT std::string GetComponentRepresentationAsString() const; + + /** + * @brief Returns the component mass. + * + * The mass is obtained from the predefined deck element and represents the mass of the + * transformed component instance at deck level: + * - If an explicit mass is provided in CPACS, it is used as the reference mass. + * - Otherwise, if a density is provided, the reference mass is computed from the local + * component geometry volume. + * - The resulting reference mass is scaled by the transformation at deck level. + * - If neither mass nor density is available, no mass value is returned. + * + * @return Component mass, or boost::none if the mass cannot be determined. + */ + TIGL_EXPORT boost::optional GetMass() const; + + /** + * @brief Returns the center of gravity in the component's local coordinate system. + * + * If a CPACS @c location is provided, that value is used. + * Otherwise, the geometric centroid of the untransformed local component volume is computed. + * + * If the center of gravity cannot be determined (e.g., missing mass definition or + * zero-volume geometry), boost::none is returned. + * + * @return Local CoG (x, y, z), or boost::none if not available. + */ + TIGL_EXPORT boost::optional GetCenterOfGravityLocal() const; + + /** + * @brief Returns the center of gravity in the global coordinate system. + * + * The global CoG is obtained by applying the component transformation hierarchy + * to the local CoG. + * + * @return Global CoG, or boost::none if unavailable. + */ + TIGL_EXPORT boost::optional GetCenterOfGravityGlobal() const; + + /** + * @brief Returns the mass inertia tensor components in the local coordinate system. + * + * If a CPACS @c massInertia definition is present, its values are returned. + * Otherwise, boost::none is returned. Cross terms (Jxy, Jxz, Jyz) are optional + * as in the CPACS schema. + * + * @return Local mass inertia components, or boost::none if not defined. + */ + TIGL_EXPORT boost::optional GetMassInertiaLocal() const; + +protected: + virtual PNamedShape BuildLoft() const override; + +private: + PNamedShape BuildLocalLoft() const; + + std::string _cpacsDocPath; + + struct MassCache { + boost::optional mass = boost::none; + boost::optional cogLocal = boost::none; + boost::optional inertiaLocal = boost::none; + }; + + const CCPACSElementGeometry& GetElementGeometry() const; + + void BuildMass(MassCache& cache) const; + Cache m_mass; + + const CCPACSDeck* m_parentDeck; +}; + +} // namespace tigl diff --git a/src/generated/CPACSBoundingBox.cpp b/src/generated/CPACSBoundingBox.cpp deleted file mode 100644 index 41b3602030..0000000000 --- a/src/generated/CPACSBoundingBox.cpp +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include "CPACSBoundingBox.h" -#include "CPACSDeckElementGeometry.h" -#include "CTiglError.h" -#include "CTiglLogging.h" -#include "CTiglUIDManager.h" -#include "CTiglUIDObject.h" -#include "TixiHelper.h" - -namespace tigl -{ -namespace generated -{ - CPACSBoundingBox::CPACSBoundingBox(CPACSDeckElementGeometry* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_deltaX(0) - , m_deltaY(0) - , m_deltaZ(0) - { - //assert(parent != NULL); - m_parent = parent; - } - - CPACSBoundingBox::~CPACSBoundingBox() - { - } - - const CPACSDeckElementGeometry* CPACSBoundingBox::GetParent() const - { - return m_parent; - } - - CPACSDeckElementGeometry* CPACSBoundingBox::GetParent() - { - return m_parent; - } - - const CTiglUIDObject* CPACSBoundingBox::GetNextUIDParent() const - { - if (m_parent) { - return m_parent->GetNextUIDParent(); - } - return nullptr; - } - - CTiglUIDObject* CPACSBoundingBox::GetNextUIDParent() - { - if (m_parent) { - return m_parent->GetNextUIDParent(); - } - return nullptr; - } - - CTiglUIDManager& CPACSBoundingBox::GetUIDManager() - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - const CTiglUIDManager& CPACSBoundingBox::GetUIDManager() const - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - void CPACSBoundingBox::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) - { - // read element deltaX - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/deltaX")) { - m_deltaX = tixi::TixiGetElement(tixiHandle, xpath + "/deltaX"); - } - else { - LOG(ERROR) << "Required element deltaX is missing at xpath " << xpath; - } - - // read element deltaY - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/deltaY")) { - m_deltaY = tixi::TixiGetElement(tixiHandle, xpath + "/deltaY"); - } - else { - LOG(ERROR) << "Required element deltaY is missing at xpath " << xpath; - } - - // read element deltaZ - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/deltaZ")) { - m_deltaZ = tixi::TixiGetElement(tixiHandle, xpath + "/deltaZ"); - } - else { - LOG(ERROR) << "Required element deltaZ is missing at xpath " << xpath; - } - - // read element origin - if (tixi::TixiCheckElement(tixiHandle, xpath + "/origin")) { - m_origin = boost::in_place(this, m_uidMgr); - try { - m_origin->ReadCPACS(tixiHandle, xpath + "/origin"); - } catch(const std::exception& e) { - LOG(ERROR) << "Failed to read origin at xpath " << xpath << ": " << e.what(); - m_origin = boost::none; - } - } - - } - - void CPACSBoundingBox::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const - { - // write element deltaX - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/deltaX"); - tixi::TixiSaveElement(tixiHandle, xpath + "/deltaX", m_deltaX); - - // write element deltaY - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/deltaY"); - tixi::TixiSaveElement(tixiHandle, xpath + "/deltaY", m_deltaY); - - // write element deltaZ - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/deltaZ"); - tixi::TixiSaveElement(tixiHandle, xpath + "/deltaZ", m_deltaZ); - - // write element origin - if (m_origin) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/origin"); - m_origin->WriteCPACS(tixiHandle, xpath + "/origin"); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/origin")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/origin"); - } - } - - } - - const double& CPACSBoundingBox::GetDeltaX() const - { - return m_deltaX; - } - - void CPACSBoundingBox::SetDeltaX(const double& value) - { - m_deltaX = value; - } - - const double& CPACSBoundingBox::GetDeltaY() const - { - return m_deltaY; - } - - void CPACSBoundingBox::SetDeltaY(const double& value) - { - m_deltaY = value; - } - - const double& CPACSBoundingBox::GetDeltaZ() const - { - return m_deltaZ; - } - - void CPACSBoundingBox::SetDeltaZ(const double& value) - { - m_deltaZ = value; - } - - const boost::optional& CPACSBoundingBox::GetOrigin() const - { - return m_origin; - } - - boost::optional& CPACSBoundingBox::GetOrigin() - { - return m_origin; - } - - CCPACSPoint& CPACSBoundingBox::GetOrigin(CreateIfNotExistsTag) - { - if (!m_origin) - m_origin = boost::in_place(this, m_uidMgr); - return *m_origin; - } - - void CPACSBoundingBox::RemoveOrigin() - { - m_origin = boost::none; - } - -} // namespace generated -} // namespace tigl diff --git a/src/generated/CPACSBoundingBox.h b/src/generated/CPACSBoundingBox.h deleted file mode 100644 index a3c08b868e..0000000000 --- a/src/generated/CPACSBoundingBox.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include -#include -#include -#include -#include -#include "CreateIfNotExists.h" -#include "tigl_internal.h" - -namespace tigl -{ -class CTiglUIDManager; -class CTiglUIDObject; - -namespace generated -{ - class CPACSDeckElementGeometry; - - // This class is used in: - // CPACSDeckElementGeometry - - /// @brief Bounding Box - /// - /// - class CPACSBoundingBox - { - public: - TIGL_EXPORT CPACSBoundingBox(CPACSDeckElementGeometry* parent, CTiglUIDManager* uidMgr); - - TIGL_EXPORT virtual ~CPACSBoundingBox(); - - TIGL_EXPORT CPACSDeckElementGeometry* GetParent(); - - TIGL_EXPORT const CPACSDeckElementGeometry* GetParent() const; - - TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); - TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; - - TIGL_EXPORT CTiglUIDManager& GetUIDManager(); - TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; - - TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); - TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - - TIGL_EXPORT virtual const double& GetDeltaX() const; - TIGL_EXPORT virtual void SetDeltaX(const double& value); - - TIGL_EXPORT virtual const double& GetDeltaY() const; - TIGL_EXPORT virtual void SetDeltaY(const double& value); - - TIGL_EXPORT virtual const double& GetDeltaZ() const; - TIGL_EXPORT virtual void SetDeltaZ(const double& value); - - TIGL_EXPORT virtual const boost::optional& GetOrigin() const; - TIGL_EXPORT virtual boost::optional& GetOrigin(); - - TIGL_EXPORT virtual CCPACSPoint& GetOrigin(CreateIfNotExistsTag); - TIGL_EXPORT virtual void RemoveOrigin(); - - protected: - CPACSDeckElementGeometry* m_parent; - - CTiglUIDManager* m_uidMgr; - - /// Length in x - double m_deltaX; - - /// Length in y - double m_deltaY; - - /// Length in z - double m_deltaZ; - - /// Origin - boost::optional m_origin; - - private: - CPACSBoundingBox(const CPACSBoundingBox&) = delete; - CPACSBoundingBox& operator=(const CPACSBoundingBox&) = delete; - - CPACSBoundingBox(CPACSBoundingBox&&) = delete; - CPACSBoundingBox& operator=(CPACSBoundingBox&&) = delete; - }; -} // namespace generated - -// Aliases in tigl namespace -using CCPACSBoundingBox = generated::CPACSBoundingBox; -using CCPACSDeckElementGeometry = generated::CPACSDeckElementGeometry; -} // namespace tigl diff --git a/src/generated/CPACSCabinAisle.cpp b/src/generated/CPACSCabinAisle.cpp new file mode 100644 index 0000000000..e9a1b3e99a --- /dev/null +++ b/src/generated/CPACSCabinAisle.cpp @@ -0,0 +1,249 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CPACSCabinAisle.h" +#include "CPACSCabinAisles.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSCabinAisle::CPACSCabinAisle(CPACSCabinAisles* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_x(this) + , m_y(this) + , m_widthY(this) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSCabinAisle::~CPACSCabinAisle() + { + if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); + } + + const CPACSCabinAisles* CPACSCabinAisle::GetParent() const + { + return m_parent; + } + + CPACSCabinAisles* CPACSCabinAisle::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSCabinAisle::GetNextUIDParent() const + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDObject* CPACSCabinAisle::GetNextUIDParent() + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDManager& CPACSCabinAisle::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSCabinAisle::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSCabinAisle::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read attribute uID + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { + m_uID = tixi::TixiGetAttribute(tixiHandle, xpath, "uID"); + if (m_uID.empty()) { + LOG(WARNING) << "Required attribute uID is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; + } + + // read element name + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { + m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); + if (m_name.empty()) { + LOG(WARNING) << "Required element name is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required element name is missing at xpath " << xpath; + } + + // read element description + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { + m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); + if (m_description->empty()) { + LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; + } + } + + // read element x + if (tixi::TixiCheckElement(tixiHandle, xpath + "/x")) { + m_x.ReadCPACS(tixiHandle, xpath + "/x"); + } + else { + LOG(ERROR) << "Required element x is missing at xpath " << xpath; + } + + // read element y + if (tixi::TixiCheckElement(tixiHandle, xpath + "/y")) { + m_y.ReadCPACS(tixiHandle, xpath + "/y"); + } + else { + LOG(ERROR) << "Required element y is missing at xpath " << xpath; + } + + // read element widthY + if (tixi::TixiCheckElement(tixiHandle, xpath + "/widthY")) { + m_widthY.ReadCPACS(tixiHandle, xpath + "/widthY"); + } + else { + LOG(ERROR) << "Required element widthY is missing at xpath " << xpath; + } + + if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); + } + + void CPACSCabinAisle::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write attribute uID + tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); + + // write element name + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); + tixi::TixiSaveElement(tixiHandle, xpath + "/name", m_name); + + // write element description + if (m_description) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/description"); + tixi::TixiSaveElement(tixiHandle, xpath + "/description", *m_description); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/description"); + } + } + + // write element x + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/x"); + m_x.WriteCPACS(tixiHandle, xpath + "/x"); + + // write element y + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/y"); + m_y.WriteCPACS(tixiHandle, xpath + "/y"); + + // write element widthY + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/widthY"); + m_widthY.WriteCPACS(tixiHandle, xpath + "/widthY"); + + } + + const std::string& CPACSCabinAisle::GetUID() const + { + return m_uID; + } + + void CPACSCabinAisle::SetUID(const std::string& value) + { + if (m_uidMgr && value != m_uID) { + if (m_uID.empty()) { + m_uidMgr->RegisterObject(value, *this); + } + else { + m_uidMgr->UpdateObjectUID(m_uID, value); + } + } + m_uID = value; + } + + const std::string& CPACSCabinAisle::GetName() const + { + return m_name; + } + + void CPACSCabinAisle::SetName(const std::string& value) + { + m_name = value; + } + + const boost::optional& CPACSCabinAisle::GetDescription() const + { + return m_description; + } + + void CPACSCabinAisle::SetDescription(const boost::optional& value) + { + m_description = value; + } + + const CPACSDoubleVectorBase& CPACSCabinAisle::GetX() const + { + return m_x; + } + + CPACSDoubleVectorBase& CPACSCabinAisle::GetX() + { + return m_x; + } + + const CPACSDoubleVectorBase& CPACSCabinAisle::GetY() const + { + return m_y; + } + + CPACSDoubleVectorBase& CPACSCabinAisle::GetY() + { + return m_y; + } + + const CPACSDoubleVectorBase& CPACSCabinAisle::GetWidthY() const + { + return m_widthY; + } + + CPACSDoubleVectorBase& CPACSCabinAisle::GetWidthY() + { + return m_widthY; + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSCabinAisle.h b/src/generated/CPACSCabinAisle.h new file mode 100644 index 0000000000..2c1ca76ade --- /dev/null +++ b/src/generated/CPACSCabinAisle.h @@ -0,0 +1,122 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "CPACSDoubleVectorBase.h" +#include "CTiglUIDObject.h" +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; + +namespace generated +{ + class CPACSCabinAisles; + + // This class is used in: + // CPACSCabinAisles + + /// @brief Aisle + /// + /// Aisles has as many entries as there are aisles in the + /// cabin. In a normal single aisle there are two aisles: the cabin + /// aisle and the aisle leading to the cockpit. + /// + class CPACSCabinAisle : public CTiglReqUIDObject + { + public: + TIGL_EXPORT CPACSCabinAisle(CPACSCabinAisles* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSCabinAisle(); + + TIGL_EXPORT CPACSCabinAisles* GetParent(); + + TIGL_EXPORT const CPACSCabinAisles* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::string& GetUID() const; + TIGL_EXPORT virtual void SetUID(const std::string& value); + + TIGL_EXPORT virtual const std::string& GetName() const; + TIGL_EXPORT virtual void SetName(const std::string& value); + + TIGL_EXPORT virtual const boost::optional& GetDescription() const; + TIGL_EXPORT virtual void SetDescription(const boost::optional& value); + + TIGL_EXPORT virtual const CPACSDoubleVectorBase& GetX() const; + TIGL_EXPORT virtual CPACSDoubleVectorBase& GetX(); + + TIGL_EXPORT virtual const CPACSDoubleVectorBase& GetY() const; + TIGL_EXPORT virtual CPACSDoubleVectorBase& GetY(); + + TIGL_EXPORT virtual const CPACSDoubleVectorBase& GetWidthY() const; + TIGL_EXPORT virtual CPACSDoubleVectorBase& GetWidthY(); + + protected: + CPACSCabinAisles* m_parent; + + CTiglUIDManager* m_uidMgr; + + std::string m_uID; + + /// Name + std::string m_name; + + /// Description + boost::optional m_description; + + /// Longitudinal coordinates. The + /// number of coordinates can be chosen as appropriate, the minimum + /// number is two. The coordinates are relative to the cabin origin. + CPACSDoubleVectorBase m_x; + + /// Center points of the aisle. The + /// y-vector has to have same length as the x-vector. The aisle + /// stretches equally left and right of the provided y-coordinate. + CPACSDoubleVectorBase m_y; + + /// Width of the aisle at floor level at each + /// y-coordinate + CPACSDoubleVectorBase m_widthY; + + private: + CPACSCabinAisle(const CPACSCabinAisle&) = delete; + CPACSCabinAisle& operator=(const CPACSCabinAisle&) = delete; + + CPACSCabinAisle(CPACSCabinAisle&&) = delete; + CPACSCabinAisle& operator=(CPACSCabinAisle&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSCabinAisle = generated::CPACSCabinAisle; +using CCPACSCabinAisles = generated::CPACSCabinAisles; +} // namespace tigl diff --git a/src/generated/CPACSCabinAisles.cpp b/src/generated/CPACSCabinAisles.cpp new file mode 100644 index 0000000000..421e2c1df8 --- /dev/null +++ b/src/generated/CPACSCabinAisles.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CCPACSDeck.h" +#include "CPACSCabinAisle.h" +#include "CPACSCabinAisles.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSCabinAisles::CPACSCabinAisles(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSCabinAisles::~CPACSCabinAisles() + { + } + + const CCPACSDeck* CPACSCabinAisles::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSCabinAisles::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSCabinAisles::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSCabinAisles::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSCabinAisles::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSCabinAisles::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSCabinAisles::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element aisle + if (tixi::TixiCheckElement(tixiHandle, xpath + "/aisle")) { + tixi::TixiReadElements(tixiHandle, xpath + "/aisle", m_aisles, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSCabinAisles::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element aisle + tixi::TixiSaveElements(tixiHandle, xpath + "/aisle", m_aisles); + + } + + const std::vector>& CPACSCabinAisles::GetAisles() const + { + return m_aisles; + } + + std::vector>& CPACSCabinAisles::GetAisles() + { + return m_aisles; + } + + size_t CPACSCabinAisles::GetAisleCount() const + { + return m_aisles.size(); + } + + size_t CPACSCabinAisles::GetAisleIndex(const std::string& UID) const + { + for (size_t i=0; i < GetAisleCount(); i++) { + const std::string tmpUID(m_aisles[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSCabinAisles::GetAisleIndex", TIGL_UID_ERROR); + } + + CPACSCabinAisle& CPACSCabinAisles::GetAisle(size_t index) + { + if (index < 1 || index > GetAisleCount()) { + throw CTiglError("Invalid index in std::vector>::GetAisle", TIGL_INDEX_ERROR); + } + index--; + return *m_aisles[index]; + } + + const CPACSCabinAisle& CPACSCabinAisles::GetAisle(size_t index) const + { + if (index < 1 || index > GetAisleCount()) { + throw CTiglError("Invalid index in std::vector>::GetAisle", TIGL_INDEX_ERROR); + } + index--; + return *m_aisles[index]; + } + + CPACSCabinAisle& CPACSCabinAisles::GetAisle(const std::string& UID) + { + for (auto& elem : m_aisles ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSCabinAisles::GetAisle. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CPACSCabinAisle& CPACSCabinAisles::GetAisle(const std::string& UID) const + { + for (auto& elem : m_aisles ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSCabinAisles::GetAisle. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CPACSCabinAisle& CPACSCabinAisles::AddAisle() + { + m_aisles.push_back(std::make_unique(this, m_uidMgr)); + return *m_aisles.back(); + } + + void CPACSCabinAisles::RemoveAisle(CPACSCabinAisle& ref) + { + for (std::size_t i = 0; i < m_aisles.size(); i++) { + if (m_aisles[i].get() == &ref) { + m_aisles.erase(m_aisles.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSCabinAisles.h b/src/generated/CPACSCabinAisles.h new file mode 100644 index 0000000000..14456315b6 --- /dev/null +++ b/src/generated/CPACSCabinAisles.h @@ -0,0 +1,97 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeck; + +namespace generated +{ + class CPACSCabinAisle; + + // This class is used in: + // CPACSDeck + + /// @brief Cabin aisles + /// + /// + /// + class CPACSCabinAisles + { + public: + TIGL_EXPORT CPACSCabinAisles(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSCabinAisles(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetAisles() const; + TIGL_EXPORT virtual std::vector>& GetAisles(); + + TIGL_EXPORT virtual size_t GetAisleCount() const; + TIGL_EXPORT virtual size_t GetAisleIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CPACSCabinAisle& GetAisle(size_t index) const; + TIGL_EXPORT virtual CPACSCabinAisle& GetAisle(size_t index); + + TIGL_EXPORT virtual const CPACSCabinAisle& GetAisle(const std::string& UID) const; + TIGL_EXPORT virtual CPACSCabinAisle& GetAisle(const std::string& UID); + + TIGL_EXPORT virtual CPACSCabinAisle& AddAisle(); + TIGL_EXPORT virtual void RemoveAisle(CPACSCabinAisle& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + std::vector> m_aisles; + + private: + CPACSCabinAisles(const CPACSCabinAisles&) = delete; + CPACSCabinAisles& operator=(const CPACSCabinAisles&) = delete; + + CPACSCabinAisles(CPACSCabinAisles&&) = delete; + CPACSCabinAisles& operator=(CPACSCabinAisles&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSCabinAisles = generated::CPACSCabinAisles; +using CCPACSCabinAisle = generated::CPACSCabinAisle; +} // namespace tigl diff --git a/src/generated/CPACSCabinGeometry.cpp b/src/generated/CPACSCabinGeometry.cpp new file mode 100644 index 0000000000..dcb822cb84 --- /dev/null +++ b/src/generated/CPACSCabinGeometry.cpp @@ -0,0 +1,169 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CCPACSDeck.h" +#include "CPACSCabinGeometry.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSCabinGeometry::CPACSCabinGeometry(CCPACSDeck* parent) + : m_contours(this) + , m_x(this) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSCabinGeometry::~CPACSCabinGeometry() + { + } + + const CCPACSDeck* CPACSCabinGeometry::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSCabinGeometry::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSCabinGeometry::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSCabinGeometry::GetNextUIDParent() + { + return m_parent; + } + + void CPACSCabinGeometry::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element name + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { + m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); + if (m_name.empty()) { + LOG(WARNING) << "Required element name is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required element name is missing at xpath " << xpath; + } + + // read element description + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { + m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); + if (m_description->empty()) { + LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; + } + } + + // read element contours + if (tixi::TixiCheckElement(tixiHandle, xpath + "/contours")) { + m_contours.ReadCPACS(tixiHandle, xpath + "/contours"); + } + else { + LOG(ERROR) << "Required element contours is missing at xpath " << xpath; + } + + // read element x + if (tixi::TixiCheckElement(tixiHandle, xpath + "/x")) { + m_x.ReadCPACS(tixiHandle, xpath + "/x"); + } + else { + LOG(ERROR) << "Required element x is missing at xpath " << xpath; + } + + } + + void CPACSCabinGeometry::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element name + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); + tixi::TixiSaveElement(tixiHandle, xpath + "/name", m_name); + + // write element description + if (m_description) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/description"); + tixi::TixiSaveElement(tixiHandle, xpath + "/description", *m_description); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/description"); + } + } + + // write element contours + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/contours"); + m_contours.WriteCPACS(tixiHandle, xpath + "/contours"); + + // write element x + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/x"); + m_x.WriteCPACS(tixiHandle, xpath + "/x"); + + } + + const std::string& CPACSCabinGeometry::GetName() const + { + return m_name; + } + + void CPACSCabinGeometry::SetName(const std::string& value) + { + m_name = value; + } + + const boost::optional& CPACSCabinGeometry::GetDescription() const + { + return m_description; + } + + void CPACSCabinGeometry::SetDescription(const boost::optional& value) + { + m_description = value; + } + + const CPACSCabinGeometryContours& CPACSCabinGeometry::GetContours() const + { + return m_contours; + } + + CPACSCabinGeometryContours& CPACSCabinGeometry::GetContours() + { + return m_contours; + } + + const CPACSDoubleVectorBase& CPACSCabinGeometry::GetX() const + { + return m_x; + } + + CPACSDoubleVectorBase& CPACSCabinGeometry::GetX() + { + return m_x; + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSCabinGeometry.h b/src/generated/CPACSCabinGeometry.h new file mode 100644 index 0000000000..54ff4b9189 --- /dev/null +++ b/src/generated/CPACSCabinGeometry.h @@ -0,0 +1,105 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "CPACSCabinGeometryContours.h" +#include "CPACSDoubleVectorBase.h" +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDObject; +class CCPACSDeck; + +namespace generated +{ + // This class is used in: + // CPACSDeck + + /// @brief Geometry + /// + /// [ WARNING: This type is known to be susceptible to + /// inconsistencies and might therefore be removed in a future version of CPACS] + /// The geometry of the cabin roughly corresponds to the available design space in the cabin. + /// It is given in terms of constant height contour lines. + /// The lines all share a common x -vector. + /// The y vector provides the lateral + /// contour at Z-coordinate provided by the constant value z . + /// One or more contour lines can be given. + /// The cabin geometry is assumed to be symmetric. + /// @see deckContours + /// + class CPACSCabinGeometry + { + public: + TIGL_EXPORT CPACSCabinGeometry(CCPACSDeck* parent); + + TIGL_EXPORT virtual ~CPACSCabinGeometry(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::string& GetName() const; + TIGL_EXPORT virtual void SetName(const std::string& value); + + TIGL_EXPORT virtual const boost::optional& GetDescription() const; + TIGL_EXPORT virtual void SetDescription(const boost::optional& value); + + TIGL_EXPORT virtual const CPACSCabinGeometryContours& GetContours() const; + TIGL_EXPORT virtual CPACSCabinGeometryContours& GetContours(); + + TIGL_EXPORT virtual const CPACSDoubleVectorBase& GetX() const; + TIGL_EXPORT virtual CPACSDoubleVectorBase& GetX(); + + protected: + CCPACSDeck* m_parent; + + /// Name + std::string m_name; + + /// Description + boost::optional m_description; + + CPACSCabinGeometryContours m_contours; + + /// Vector of x coordinates + CPACSDoubleVectorBase m_x; + + private: + CPACSCabinGeometry(const CPACSCabinGeometry&) = delete; + CPACSCabinGeometry& operator=(const CPACSCabinGeometry&) = delete; + + CPACSCabinGeometry(CPACSCabinGeometry&&) = delete; + CPACSCabinGeometry& operator=(CPACSCabinGeometry&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSCabinGeometry = generated::CPACSCabinGeometry; +} // namespace tigl diff --git a/src/generated/CPACSCabinGeometryContour.cpp b/src/generated/CPACSCabinGeometryContour.cpp new file mode 100644 index 0000000000..70d2b71e53 --- /dev/null +++ b/src/generated/CPACSCabinGeometryContour.cpp @@ -0,0 +1,121 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CPACSCabinGeometryContour.h" +#include "CPACSCabinGeometryContours.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSCabinGeometryContour::CPACSCabinGeometryContour(CPACSCabinGeometryContours* parent) + : m_y(this) + , m_z(0) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSCabinGeometryContour::~CPACSCabinGeometryContour() + { + } + + const CPACSCabinGeometryContours* CPACSCabinGeometryContour::GetParent() const + { + return m_parent; + } + + CPACSCabinGeometryContours* CPACSCabinGeometryContour::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSCabinGeometryContour::GetNextUIDParent() const + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDObject* CPACSCabinGeometryContour::GetNextUIDParent() + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + void CPACSCabinGeometryContour::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element y + if (tixi::TixiCheckElement(tixiHandle, xpath + "/y")) { + m_y.ReadCPACS(tixiHandle, xpath + "/y"); + } + else { + LOG(ERROR) << "Required element y is missing at xpath " << xpath; + } + + // read element z + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/z")) { + m_z = tixi::TixiGetElement(tixiHandle, xpath + "/z"); + } + else { + LOG(ERROR) << "Required element z is missing at xpath " << xpath; + } + + } + + void CPACSCabinGeometryContour::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element y + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/y"); + m_y.WriteCPACS(tixiHandle, xpath + "/y"); + + // write element z + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/z"); + tixi::TixiSaveElement(tixiHandle, xpath + "/z", m_z); + + } + + const CPACSDoubleVectorBase& CPACSCabinGeometryContour::GetY() const + { + return m_y; + } + + CPACSDoubleVectorBase& CPACSCabinGeometryContour::GetY() + { + return m_y; + } + + const double& CPACSCabinGeometryContour::GetZ() const + { + return m_z; + } + + void CPACSCabinGeometryContour::SetZ(const double& value) + { + m_z = value; + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSCabinGeometryContour.h b/src/generated/CPACSCabinGeometryContour.h new file mode 100644 index 0000000000..6ea876d0cc --- /dev/null +++ b/src/generated/CPACSCabinGeometryContour.h @@ -0,0 +1,85 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include "CPACSDoubleVectorBase.h" +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDObject; + +namespace generated +{ + class CPACSCabinGeometryContours; + + // This class is used in: + // CPACSCabinGeometryContours + + /// @brief Cabin geometry contour + /// + /// Type to define a lateral position value "y" at a given height "z" (in the parent deck coordinate system) + /// for each entry "x" in the parent cabin geometry definition. + /// + class CPACSCabinGeometryContour + { + public: + TIGL_EXPORT CPACSCabinGeometryContour(CPACSCabinGeometryContours* parent); + + TIGL_EXPORT virtual ~CPACSCabinGeometryContour(); + + TIGL_EXPORT CPACSCabinGeometryContours* GetParent(); + + TIGL_EXPORT const CPACSCabinGeometryContours* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const CPACSDoubleVectorBase& GetY() const; + TIGL_EXPORT virtual CPACSDoubleVectorBase& GetY(); + + TIGL_EXPORT virtual const double& GetZ() const; + TIGL_EXPORT virtual void SetZ(const double& value); + + protected: + CPACSCabinGeometryContours* m_parent; + + /// Vector with y-coordinates + CPACSDoubleVectorBase m_y; + + /// Height z + double m_z; + + private: + CPACSCabinGeometryContour(const CPACSCabinGeometryContour&) = delete; + CPACSCabinGeometryContour& operator=(const CPACSCabinGeometryContour&) = delete; + + CPACSCabinGeometryContour(CPACSCabinGeometryContour&&) = delete; + CPACSCabinGeometryContour& operator=(CPACSCabinGeometryContour&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSCabinGeometryContour = generated::CPACSCabinGeometryContour; +using CCPACSCabinGeometryContours = generated::CPACSCabinGeometryContours; +} // namespace tigl diff --git a/src/generated/CPACSCabinGeometryContours.cpp b/src/generated/CPACSCabinGeometryContours.cpp new file mode 100644 index 0000000000..344c0d0ca7 --- /dev/null +++ b/src/generated/CPACSCabinGeometryContours.cpp @@ -0,0 +1,135 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CPACSCabinGeometry.h" +#include "CPACSCabinGeometryContour.h" +#include "CPACSCabinGeometryContours.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSCabinGeometryContours::CPACSCabinGeometryContours(CPACSCabinGeometry* parent) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSCabinGeometryContours::~CPACSCabinGeometryContours() + { + } + + const CPACSCabinGeometry* CPACSCabinGeometryContours::GetParent() const + { + return m_parent; + } + + CPACSCabinGeometry* CPACSCabinGeometryContours::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSCabinGeometryContours::GetNextUIDParent() const + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDObject* CPACSCabinGeometryContours::GetNextUIDParent() + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + void CPACSCabinGeometryContours::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element contour + if (tixi::TixiCheckElement(tixiHandle, xpath + "/contour")) { + tixi::TixiReadElements(tixiHandle, xpath + "/contour", m_contours, 1, tixi::xsdUnbounded, this); + } + + } + + void CPACSCabinGeometryContours::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element contour + tixi::TixiSaveElements(tixiHandle, xpath + "/contour", m_contours); + + } + + const std::vector>& CPACSCabinGeometryContours::GetContours() const + { + return m_contours; + } + + std::vector>& CPACSCabinGeometryContours::GetContours() + { + return m_contours; + } + + size_t CPACSCabinGeometryContours::GetContourCount() const + { + return m_contours.size(); + } + + CPACSCabinGeometryContour& CPACSCabinGeometryContours::GetContour(size_t index) + { + if (index < 1 || index > GetContourCount()) { + throw CTiglError("Invalid index in std::vector>::GetContour", TIGL_INDEX_ERROR); + } + index--; + return *m_contours[index]; + } + + const CPACSCabinGeometryContour& CPACSCabinGeometryContours::GetContour(size_t index) const + { + if (index < 1 || index > GetContourCount()) { + throw CTiglError("Invalid index in std::vector>::GetContour", TIGL_INDEX_ERROR); + } + index--; + return *m_contours[index]; + } + + + CPACSCabinGeometryContour& CPACSCabinGeometryContours::AddContour() + { + m_contours.push_back(std::make_unique(this)); + return *m_contours.back(); + } + + void CPACSCabinGeometryContours::RemoveContour(CPACSCabinGeometryContour& ref) + { + for (std::size_t i = 0; i < m_contours.size(); i++) { + if (m_contours[i].get() == &ref) { + m_contours.erase(m_contours.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSCabinGeometryContours.h b/src/generated/CPACSCabinGeometryContours.h new file mode 100644 index 0000000000..61eb8ecbd8 --- /dev/null +++ b/src/generated/CPACSCabinGeometryContours.h @@ -0,0 +1,89 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDObject; + +namespace generated +{ + class CPACSCabinGeometryContour; + class CPACSCabinGeometry; + + // This class is used in: + // CPACSCabinGeometry + + /// @brief Cabin geometry contours + /// + /// Cabin geometry contour line collection type. By providing more than one entry, + /// a 3D cabin space can be described. + /// + class CPACSCabinGeometryContours + { + public: + TIGL_EXPORT CPACSCabinGeometryContours(CPACSCabinGeometry* parent); + + TIGL_EXPORT virtual ~CPACSCabinGeometryContours(); + + TIGL_EXPORT CPACSCabinGeometry* GetParent(); + + TIGL_EXPORT const CPACSCabinGeometry* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetContours() const; + TIGL_EXPORT virtual std::vector>& GetContours(); + + TIGL_EXPORT virtual size_t GetContourCount() const; + + TIGL_EXPORT virtual const CPACSCabinGeometryContour& GetContour(size_t index) const; + TIGL_EXPORT virtual CPACSCabinGeometryContour& GetContour(size_t index); + + TIGL_EXPORT virtual CPACSCabinGeometryContour& AddContour(); + TIGL_EXPORT virtual void RemoveContour(CPACSCabinGeometryContour& ref); + + protected: + CPACSCabinGeometry* m_parent; + + std::vector> m_contours; + + private: + CPACSCabinGeometryContours(const CPACSCabinGeometryContours&) = delete; + CPACSCabinGeometryContours& operator=(const CPACSCabinGeometryContours&) = delete; + + CPACSCabinGeometryContours(CPACSCabinGeometryContours&&) = delete; + CPACSCabinGeometryContours& operator=(CPACSCabinGeometryContours&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSCabinGeometryContours = generated::CPACSCabinGeometryContours; +using CCPACSCabinGeometryContour = generated::CPACSCabinGeometryContour; +using CCPACSCabinGeometry = generated::CPACSCabinGeometry; +} // namespace tigl diff --git a/src/generated/CPACSCabinSpace.cpp b/src/generated/CPACSCabinSpace.cpp new file mode 100644 index 0000000000..a00df02cca --- /dev/null +++ b/src/generated/CPACSCabinSpace.cpp @@ -0,0 +1,249 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CPACSCabinSpace.h" +#include "CPACSCabinSpaces.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSCabinSpace::CPACSCabinSpace(CPACSCabinSpaces* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_x(this) + , m_y(this) + , m_height(0) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSCabinSpace::~CPACSCabinSpace() + { + if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); + } + + const CPACSCabinSpaces* CPACSCabinSpace::GetParent() const + { + return m_parent; + } + + CPACSCabinSpaces* CPACSCabinSpace::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSCabinSpace::GetNextUIDParent() const + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDObject* CPACSCabinSpace::GetNextUIDParent() + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDManager& CPACSCabinSpace::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSCabinSpace::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSCabinSpace::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read attribute uID + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { + m_uID = tixi::TixiGetAttribute(tixiHandle, xpath, "uID"); + if (m_uID.empty()) { + LOG(WARNING) << "Required attribute uID is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; + } + + // read element name + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { + m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); + if (m_name.empty()) { + LOG(WARNING) << "Required element name is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required element name is missing at xpath " << xpath; + } + + // read element description + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { + m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); + if (m_description->empty()) { + LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; + } + } + + // read element x + if (tixi::TixiCheckElement(tixiHandle, xpath + "/x")) { + m_x.ReadCPACS(tixiHandle, xpath + "/x"); + } + else { + LOG(ERROR) << "Required element x is missing at xpath " << xpath; + } + + // read element y + if (tixi::TixiCheckElement(tixiHandle, xpath + "/y")) { + m_y.ReadCPACS(tixiHandle, xpath + "/y"); + } + else { + LOG(ERROR) << "Required element y is missing at xpath " << xpath; + } + + // read element height + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/height")) { + m_height = tixi::TixiGetElement(tixiHandle, xpath + "/height"); + } + else { + LOG(ERROR) << "Required element height is missing at xpath " << xpath; + } + + if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); + } + + void CPACSCabinSpace::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write attribute uID + tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); + + // write element name + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); + tixi::TixiSaveElement(tixiHandle, xpath + "/name", m_name); + + // write element description + if (m_description) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/description"); + tixi::TixiSaveElement(tixiHandle, xpath + "/description", *m_description); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/description"); + } + } + + // write element x + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/x"); + m_x.WriteCPACS(tixiHandle, xpath + "/x"); + + // write element y + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/y"); + m_y.WriteCPACS(tixiHandle, xpath + "/y"); + + // write element height + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/height"); + tixi::TixiSaveElement(tixiHandle, xpath + "/height", m_height); + + } + + const std::string& CPACSCabinSpace::GetUID() const + { + return m_uID; + } + + void CPACSCabinSpace::SetUID(const std::string& value) + { + if (m_uidMgr && value != m_uID) { + if (m_uID.empty()) { + m_uidMgr->RegisterObject(value, *this); + } + else { + m_uidMgr->UpdateObjectUID(m_uID, value); + } + } + m_uID = value; + } + + const std::string& CPACSCabinSpace::GetName() const + { + return m_name; + } + + void CPACSCabinSpace::SetName(const std::string& value) + { + m_name = value; + } + + const boost::optional& CPACSCabinSpace::GetDescription() const + { + return m_description; + } + + void CPACSCabinSpace::SetDescription(const boost::optional& value) + { + m_description = value; + } + + const CPACSDoubleVectorBase& CPACSCabinSpace::GetX() const + { + return m_x; + } + + CPACSDoubleVectorBase& CPACSCabinSpace::GetX() + { + return m_x; + } + + const CPACSDoubleVectorBase& CPACSCabinSpace::GetY() const + { + return m_y; + } + + CPACSDoubleVectorBase& CPACSCabinSpace::GetY() + { + return m_y; + } + + const double& CPACSCabinSpace::GetHeight() const + { + return m_height; + } + + void CPACSCabinSpace::SetHeight(const double& value) + { + m_height = value; + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSCabinSpace.h b/src/generated/CPACSCabinSpace.h new file mode 100644 index 0000000000..1c0a011f01 --- /dev/null +++ b/src/generated/CPACSCabinSpace.h @@ -0,0 +1,122 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "CPACSDoubleVectorBase.h" +#include "CTiglUIDObject.h" +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; + +namespace generated +{ + class CPACSCabinSpaces; + + // This class is used in: + // CPACSCabinSpaces + + /// @brief Space + /// + /// spaces describe areas in the cabin that need to be + /// clear for use as emergency area. Depending on the type of area, + /// it can have a height limit. The spaces are required for + /// downstream cabin design, for example to describe an empty cabin. + /// + class CPACSCabinSpace : public CTiglReqUIDObject + { + public: + TIGL_EXPORT CPACSCabinSpace(CPACSCabinSpaces* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSCabinSpace(); + + TIGL_EXPORT CPACSCabinSpaces* GetParent(); + + TIGL_EXPORT const CPACSCabinSpaces* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::string& GetUID() const; + TIGL_EXPORT virtual void SetUID(const std::string& value); + + TIGL_EXPORT virtual const std::string& GetName() const; + TIGL_EXPORT virtual void SetName(const std::string& value); + + TIGL_EXPORT virtual const boost::optional& GetDescription() const; + TIGL_EXPORT virtual void SetDescription(const boost::optional& value); + + TIGL_EXPORT virtual const CPACSDoubleVectorBase& GetX() const; + TIGL_EXPORT virtual CPACSDoubleVectorBase& GetX(); + + TIGL_EXPORT virtual const CPACSDoubleVectorBase& GetY() const; + TIGL_EXPORT virtual CPACSDoubleVectorBase& GetY(); + + TIGL_EXPORT virtual const double& GetHeight() const; + TIGL_EXPORT virtual void SetHeight(const double& value); + + protected: + CPACSCabinSpaces* m_parent; + + CTiglUIDManager* m_uidMgr; + + std::string m_uID; + + /// Name + std::string m_name; + + /// Description + boost::optional m_description; + + /// Vector with x-coordinates. These describe an area, so they + /// are not monotonous ascending. + CPACSDoubleVectorBase m_x; + + /// Vector with y-coordinates at given x-coordinates. Warning: + /// x-y do not represent a function as single x-positions can have + /// multiple y-coordinates. Hence, no interpolation is possible. + CPACSDoubleVectorBase m_y; + + /// Height above the floor that is required to + /// be empty of any objects + double m_height; + + private: + CPACSCabinSpace(const CPACSCabinSpace&) = delete; + CPACSCabinSpace& operator=(const CPACSCabinSpace&) = delete; + + CPACSCabinSpace(CPACSCabinSpace&&) = delete; + CPACSCabinSpace& operator=(CPACSCabinSpace&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSCabinSpace = generated::CPACSCabinSpace; +using CCPACSCabinSpaces = generated::CPACSCabinSpaces; +} // namespace tigl diff --git a/src/generated/CPACSCabinSpaces.cpp b/src/generated/CPACSCabinSpaces.cpp new file mode 100644 index 0000000000..68c71b2ec9 --- /dev/null +++ b/src/generated/CPACSCabinSpaces.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CCPACSDeck.h" +#include "CPACSCabinSpace.h" +#include "CPACSCabinSpaces.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSCabinSpaces::CPACSCabinSpaces(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSCabinSpaces::~CPACSCabinSpaces() + { + } + + const CCPACSDeck* CPACSCabinSpaces::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSCabinSpaces::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSCabinSpaces::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSCabinSpaces::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSCabinSpaces::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSCabinSpaces::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSCabinSpaces::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element space + if (tixi::TixiCheckElement(tixiHandle, xpath + "/space")) { + tixi::TixiReadElements(tixiHandle, xpath + "/space", m_spaces, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSCabinSpaces::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element space + tixi::TixiSaveElements(tixiHandle, xpath + "/space", m_spaces); + + } + + const std::vector>& CPACSCabinSpaces::GetSpaces() const + { + return m_spaces; + } + + std::vector>& CPACSCabinSpaces::GetSpaces() + { + return m_spaces; + } + + size_t CPACSCabinSpaces::GetSpaceCount() const + { + return m_spaces.size(); + } + + size_t CPACSCabinSpaces::GetSpaceIndex(const std::string& UID) const + { + for (size_t i=0; i < GetSpaceCount(); i++) { + const std::string tmpUID(m_spaces[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSCabinSpaces::GetSpaceIndex", TIGL_UID_ERROR); + } + + CPACSCabinSpace& CPACSCabinSpaces::GetSpace(size_t index) + { + if (index < 1 || index > GetSpaceCount()) { + throw CTiglError("Invalid index in std::vector>::GetSpace", TIGL_INDEX_ERROR); + } + index--; + return *m_spaces[index]; + } + + const CPACSCabinSpace& CPACSCabinSpaces::GetSpace(size_t index) const + { + if (index < 1 || index > GetSpaceCount()) { + throw CTiglError("Invalid index in std::vector>::GetSpace", TIGL_INDEX_ERROR); + } + index--; + return *m_spaces[index]; + } + + CPACSCabinSpace& CPACSCabinSpaces::GetSpace(const std::string& UID) + { + for (auto& elem : m_spaces ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSCabinSpaces::GetSpace. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CPACSCabinSpace& CPACSCabinSpaces::GetSpace(const std::string& UID) const + { + for (auto& elem : m_spaces ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSCabinSpaces::GetSpace. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CPACSCabinSpace& CPACSCabinSpaces::AddSpace() + { + m_spaces.push_back(std::make_unique(this, m_uidMgr)); + return *m_spaces.back(); + } + + void CPACSCabinSpaces::RemoveSpace(CPACSCabinSpace& ref) + { + for (std::size_t i = 0; i < m_spaces.size(); i++) { + if (m_spaces[i].get() == &ref) { + m_spaces.erase(m_spaces.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSCabinSpaces.h b/src/generated/CPACSCabinSpaces.h new file mode 100644 index 0000000000..d9be0ea7bc --- /dev/null +++ b/src/generated/CPACSCabinSpaces.h @@ -0,0 +1,97 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeck; + +namespace generated +{ + class CPACSCabinSpace; + + // This class is used in: + // CPACSDeck + + /// @brief Cabin spaces + /// + /// + /// + class CPACSCabinSpaces + { + public: + TIGL_EXPORT CPACSCabinSpaces(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSCabinSpaces(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetSpaces() const; + TIGL_EXPORT virtual std::vector>& GetSpaces(); + + TIGL_EXPORT virtual size_t GetSpaceCount() const; + TIGL_EXPORT virtual size_t GetSpaceIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CPACSCabinSpace& GetSpace(size_t index) const; + TIGL_EXPORT virtual CPACSCabinSpace& GetSpace(size_t index); + + TIGL_EXPORT virtual const CPACSCabinSpace& GetSpace(const std::string& UID) const; + TIGL_EXPORT virtual CPACSCabinSpace& GetSpace(const std::string& UID); + + TIGL_EXPORT virtual CPACSCabinSpace& AddSpace(); + TIGL_EXPORT virtual void RemoveSpace(CPACSCabinSpace& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + std::vector> m_spaces; + + private: + CPACSCabinSpaces(const CPACSCabinSpaces&) = delete; + CPACSCabinSpaces& operator=(const CPACSCabinSpaces&) = delete; + + CPACSCabinSpaces(CPACSCabinSpaces&&) = delete; + CPACSCabinSpaces& operator=(CPACSCabinSpaces&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSCabinSpaces = generated::CPACSCabinSpaces; +using CCPACSCabinSpace = generated::CPACSCabinSpace; +} // namespace tigl diff --git a/src/generated/CPACSCargoContainerElement.cpp b/src/generated/CPACSCargoContainerElement.cpp deleted file mode 100644 index 696955997a..0000000000 --- a/src/generated/CPACSCargoContainerElement.cpp +++ /dev/null @@ -1,342 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include "CPACSCargoContainerElement.h" -#include "CPACSCargoContainerElements.h" -#include "CTiglError.h" -#include "CTiglLogging.h" -#include "CTiglUIDManager.h" -#include "TixiHelper.h" - -namespace tigl -{ -namespace generated -{ - CPACSCargoContainerElement::CPACSCargoContainerElement(CPACSCargoContainerElements* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_deltaX(0) - , m_deltaY(0) - , m_deltaZ(0) - { - //assert(parent != NULL); - m_parent = parent; - } - - CPACSCargoContainerElement::~CPACSCargoContainerElement() - { - if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); - } - - const CPACSCargoContainerElements* CPACSCargoContainerElement::GetParent() const - { - return m_parent; - } - - CPACSCargoContainerElements* CPACSCargoContainerElement::GetParent() - { - return m_parent; - } - - const CTiglUIDObject* CPACSCargoContainerElement::GetNextUIDParent() const - { - if (m_parent) { - return m_parent->GetNextUIDParent(); - } - return nullptr; - } - - CTiglUIDObject* CPACSCargoContainerElement::GetNextUIDParent() - { - if (m_parent) { - return m_parent->GetNextUIDParent(); - } - return nullptr; - } - - CTiglUIDManager& CPACSCargoContainerElement::GetUIDManager() - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - const CTiglUIDManager& CPACSCargoContainerElement::GetUIDManager() const - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - void CPACSCargoContainerElement::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) - { - // read attribute uID - if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { - m_uID = tixi::TixiGetAttribute(tixiHandle, xpath, "uID"); - if (m_uID.empty()) { - LOG(WARNING) << "Required attribute uID is empty at xpath " << xpath; - } - } - else { - LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; - } - - // read element description - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { - m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); - if (m_description->empty()) { - LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; - } - } - - // read element mass - if (tixi::TixiCheckElement(tixiHandle, xpath + "/mass")) { - m_mass = boost::in_place(this, m_uidMgr); - try { - m_mass->ReadCPACS(tixiHandle, xpath + "/mass"); - } catch(const std::exception& e) { - LOG(ERROR) << "Failed to read mass at xpath " << xpath << ": " << e.what(); - m_mass = boost::none; - } - } - - // read element contour - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/contour")) { - m_contour = stringToCPACSCargoContainerElement_contour(tixi::TixiGetElement(tixiHandle, xpath + "/contour")); - } - else { - LOG(ERROR) << "Required element contour is missing at xpath " << xpath; - } - - // read element deltaX - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/deltaX")) { - m_deltaX = tixi::TixiGetElement(tixiHandle, xpath + "/deltaX"); - } - else { - LOG(ERROR) << "Required element deltaX is missing at xpath " << xpath; - } - - // read element deltaY - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/deltaY")) { - m_deltaY = tixi::TixiGetElement(tixiHandle, xpath + "/deltaY"); - } - else { - LOG(ERROR) << "Required element deltaY is missing at xpath " << xpath; - } - - // read element deltaYBase - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/deltaYBase")) { - m_deltaYBase = tixi::TixiGetElement(tixiHandle, xpath + "/deltaYBase"); - } - - // read element deltaZ - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/deltaZ")) { - m_deltaZ = tixi::TixiGetElement(tixiHandle, xpath + "/deltaZ"); - } - else { - LOG(ERROR) << "Required element deltaZ is missing at xpath " << xpath; - } - - // read element deltaZKink - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/deltaZKink")) { - m_deltaZKink = tixi::TixiGetElement(tixiHandle, xpath + "/deltaZKink"); - } - - if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); - } - - void CPACSCargoContainerElement::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const - { - // write attribute uID - tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); - - // write element description - if (m_description) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/description"); - tixi::TixiSaveElement(tixiHandle, xpath + "/description", *m_description); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/description"); - } - } - - // write element mass - if (m_mass) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/mass"); - m_mass->WriteCPACS(tixiHandle, xpath + "/mass"); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/mass")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/mass"); - } - } - - // write element contour - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/contour"); - tixi::TixiSaveElement(tixiHandle, xpath + "/contour", CPACSCargoContainerElement_contourToString(m_contour)); - - // write element deltaX - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/deltaX"); - tixi::TixiSaveElement(tixiHandle, xpath + "/deltaX", m_deltaX); - - // write element deltaY - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/deltaY"); - tixi::TixiSaveElement(tixiHandle, xpath + "/deltaY", m_deltaY); - - // write element deltaYBase - if (m_deltaYBase) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/deltaYBase"); - tixi::TixiSaveElement(tixiHandle, xpath + "/deltaYBase", *m_deltaYBase); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/deltaYBase")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/deltaYBase"); - } - } - - // write element deltaZ - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/deltaZ"); - tixi::TixiSaveElement(tixiHandle, xpath + "/deltaZ", m_deltaZ); - - // write element deltaZKink - if (m_deltaZKink) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/deltaZKink"); - tixi::TixiSaveElement(tixiHandle, xpath + "/deltaZKink", *m_deltaZKink); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/deltaZKink")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/deltaZKink"); - } - } - - } - - const std::string& CPACSCargoContainerElement::GetUID() const - { - return m_uID; - } - - void CPACSCargoContainerElement::SetUID(const std::string& value) - { - if (m_uidMgr && value != m_uID) { - if (m_uID.empty()) { - m_uidMgr->RegisterObject(value, *this); - } - else { - m_uidMgr->UpdateObjectUID(m_uID, value); - } - } - m_uID = value; - } - - const boost::optional& CPACSCargoContainerElement::GetDescription() const - { - return m_description; - } - - void CPACSCargoContainerElement::SetDescription(const boost::optional& value) - { - m_description = value; - } - - const boost::optional& CPACSCargoContainerElement::GetMass() const - { - return m_mass; - } - - boost::optional& CPACSCargoContainerElement::GetMass() - { - return m_mass; - } - - const CPACSCargoContainerElement_contour& CPACSCargoContainerElement::GetContour() const - { - return m_contour; - } - - void CPACSCargoContainerElement::SetContour(const CPACSCargoContainerElement_contour& value) - { - m_contour = value; - } - - const double& CPACSCargoContainerElement::GetDeltaX() const - { - return m_deltaX; - } - - void CPACSCargoContainerElement::SetDeltaX(const double& value) - { - m_deltaX = value; - } - - const double& CPACSCargoContainerElement::GetDeltaY() const - { - return m_deltaY; - } - - void CPACSCargoContainerElement::SetDeltaY(const double& value) - { - m_deltaY = value; - } - - const boost::optional& CPACSCargoContainerElement::GetDeltaYBase() const - { - return m_deltaYBase; - } - - void CPACSCargoContainerElement::SetDeltaYBase(const boost::optional& value) - { - m_deltaYBase = value; - } - - const double& CPACSCargoContainerElement::GetDeltaZ() const - { - return m_deltaZ; - } - - void CPACSCargoContainerElement::SetDeltaZ(const double& value) - { - m_deltaZ = value; - } - - const boost::optional& CPACSCargoContainerElement::GetDeltaZKink() const - { - return m_deltaZKink; - } - - void CPACSCargoContainerElement::SetDeltaZKink(const boost::optional& value) - { - m_deltaZKink = value; - } - - CPACSDeckElementMass& CPACSCargoContainerElement::GetMass(CreateIfNotExistsTag) - { - if (!m_mass) - m_mass = boost::in_place(this, m_uidMgr); - return *m_mass; - } - - void CPACSCargoContainerElement::RemoveMass() - { - m_mass = boost::none; - } - -} // namespace generated -} // namespace tigl diff --git a/src/generated/CPACSCargoContainerElement.h b/src/generated/CPACSCargoContainerElement.h deleted file mode 100644 index 221305f0ed..0000000000 --- a/src/generated/CPACSCargoContainerElement.h +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include -#include -#include -#include -#include "CPACSCargoContainerElement_contour.h" -#include "CPACSDeckElementMass.h" -#include "CreateIfNotExists.h" -#include "CTiglUIDObject.h" -#include "tigl_internal.h" - -namespace tigl -{ -class CTiglUIDManager; - -namespace generated -{ - class CPACSCargoContainerElements; - - // This class is used in: - // CPACSCargoContainerElements - - /// @brief Cargo container element for use in the decks - /// - /// @see cargoContainer - /// - class CPACSCargoContainerElement : public CTiglReqUIDObject - { - public: - TIGL_EXPORT CPACSCargoContainerElement(CPACSCargoContainerElements* parent, CTiglUIDManager* uidMgr); - - TIGL_EXPORT virtual ~CPACSCargoContainerElement(); - - TIGL_EXPORT CPACSCargoContainerElements* GetParent(); - - TIGL_EXPORT const CPACSCargoContainerElements* GetParent() const; - - TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); - TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; - - TIGL_EXPORT CTiglUIDManager& GetUIDManager(); - TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; - - TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); - TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - - TIGL_EXPORT virtual const std::string& GetUID() const; - TIGL_EXPORT virtual void SetUID(const std::string& value); - - TIGL_EXPORT virtual const boost::optional& GetDescription() const; - TIGL_EXPORT virtual void SetDescription(const boost::optional& value); - - TIGL_EXPORT virtual const boost::optional& GetMass() const; - TIGL_EXPORT virtual boost::optional& GetMass(); - - TIGL_EXPORT virtual const CPACSCargoContainerElement_contour& GetContour() const; - TIGL_EXPORT virtual void SetContour(const CPACSCargoContainerElement_contour& value); - - TIGL_EXPORT virtual const double& GetDeltaX() const; - TIGL_EXPORT virtual void SetDeltaX(const double& value); - - TIGL_EXPORT virtual const double& GetDeltaY() const; - TIGL_EXPORT virtual void SetDeltaY(const double& value); - - TIGL_EXPORT virtual const boost::optional& GetDeltaYBase() const; - TIGL_EXPORT virtual void SetDeltaYBase(const boost::optional& value); - - TIGL_EXPORT virtual const double& GetDeltaZ() const; - TIGL_EXPORT virtual void SetDeltaZ(const double& value); - - TIGL_EXPORT virtual const boost::optional& GetDeltaZKink() const; - TIGL_EXPORT virtual void SetDeltaZKink(const boost::optional& value); - - TIGL_EXPORT virtual CPACSDeckElementMass& GetMass(CreateIfNotExistsTag); - TIGL_EXPORT virtual void RemoveMass(); - - protected: - CPACSCargoContainerElements* m_parent; - - CTiglUIDManager* m_uidMgr; - - std::string m_uID; - - /// Description - boost::optional m_description; - - boost::optional m_mass; - - /// Contour: single or double - CPACSCargoContainerElement_contour m_contour; - - /// Delta x - double m_deltaX; - - /// Delta y - double m_deltaY; - - /// Delta y of the base - boost::optional m_deltaYBase; - - /// Delta z - double m_deltaZ; - - /// Delta z kink - boost::optional m_deltaZKink; - - private: - CPACSCargoContainerElement(const CPACSCargoContainerElement&) = delete; - CPACSCargoContainerElement& operator=(const CPACSCargoContainerElement&) = delete; - - CPACSCargoContainerElement(CPACSCargoContainerElement&&) = delete; - CPACSCargoContainerElement& operator=(CPACSCargoContainerElement&&) = delete; - }; -} // namespace generated - -// Aliases in tigl namespace -using CCPACSCargoContainerElement = generated::CPACSCargoContainerElement; -using CCPACSCargoContainerElements = generated::CPACSCargoContainerElements; -} // namespace tigl diff --git a/src/generated/CPACSCargoContainerElements.cpp b/src/generated/CPACSCargoContainerElements.cpp index 4330c6d3c6..2abd71ff2e 100644 --- a/src/generated/CPACSCargoContainerElements.cpp +++ b/src/generated/CPACSCargoContainerElements.cpp @@ -16,9 +16,9 @@ // limitations under the License. #include -#include "CPACSCargoContainerElement.h" #include "CPACSCargoContainerElements.h" #include "CPACSDeckElements.h" +#include "CPACSVehicleElementBase.h" #include "CTiglError.h" #include "CTiglLogging.h" #include "CTiglUIDManager.h" @@ -98,12 +98,12 @@ namespace generated } - const std::vector>& CPACSCargoContainerElements::GetCargoContainerElements() const + const std::vector>& CPACSCargoContainerElements::GetCargoContainerElements() const { return m_cargoContainerElements; } - std::vector>& CPACSCargoContainerElements::GetCargoContainerElements() + std::vector>& CPACSCargoContainerElements::GetCargoContainerElements() { return m_cargoContainerElements; } @@ -124,25 +124,25 @@ namespace generated throw CTiglError("Invalid UID in CPACSCargoContainerElements::GetCargoContainerElementIndex", TIGL_UID_ERROR); } - CPACSCargoContainerElement& CPACSCargoContainerElements::GetCargoContainerElement(size_t index) + CPACSVehicleElementBase& CPACSCargoContainerElements::GetCargoContainerElement(size_t index) { if (index < 1 || index > GetCargoContainerElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetCargoContainerElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetCargoContainerElement", TIGL_INDEX_ERROR); } index--; return *m_cargoContainerElements[index]; } - const CPACSCargoContainerElement& CPACSCargoContainerElements::GetCargoContainerElement(size_t index) const + const CPACSVehicleElementBase& CPACSCargoContainerElements::GetCargoContainerElement(size_t index) const { if (index < 1 || index > GetCargoContainerElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetCargoContainerElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetCargoContainerElement", TIGL_INDEX_ERROR); } index--; return *m_cargoContainerElements[index]; } - CPACSCargoContainerElement& CPACSCargoContainerElements::GetCargoContainerElement(const std::string& UID) + CPACSVehicleElementBase& CPACSCargoContainerElements::GetCargoContainerElement(const std::string& UID) { for (auto& elem : m_cargoContainerElements ) { if (elem->GetUID() == UID) @@ -151,7 +151,7 @@ namespace generated throw CTiglError("Invalid UID in CPACSCargoContainerElements::GetCargoContainerElement. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); } - const CPACSCargoContainerElement& CPACSCargoContainerElements::GetCargoContainerElement(const std::string& UID) const + const CPACSVehicleElementBase& CPACSCargoContainerElements::GetCargoContainerElement(const std::string& UID) const { for (auto& elem : m_cargoContainerElements ) { if (elem->GetUID() == UID) @@ -161,13 +161,13 @@ namespace generated } - CPACSCargoContainerElement& CPACSCargoContainerElements::AddCargoContainerElement() + CPACSVehicleElementBase& CPACSCargoContainerElements::AddCargoContainerElement() { - m_cargoContainerElements.push_back(std::make_unique(this, m_uidMgr)); + m_cargoContainerElements.push_back(std::make_unique(this, m_uidMgr)); return *m_cargoContainerElements.back(); } - void CPACSCargoContainerElements::RemoveCargoContainerElement(CPACSCargoContainerElement& ref) + void CPACSCargoContainerElements::RemoveCargoContainerElement(CPACSVehicleElementBase& ref) { for (std::size_t i = 0; i < m_cargoContainerElements.size(); i++) { if (m_cargoContainerElements[i].get() == &ref) { diff --git a/src/generated/CPACSCargoContainerElements.h b/src/generated/CPACSCargoContainerElements.h index ca51f28636..80b85534f1 100644 --- a/src/generated/CPACSCargoContainerElements.h +++ b/src/generated/CPACSCargoContainerElements.h @@ -30,7 +30,7 @@ class CTiglUIDObject; namespace generated { - class CPACSCargoContainerElement; + class CPACSVehicleElementBase; class CPACSDeckElements; // This class is used in: @@ -60,27 +60,27 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const std::vector>& GetCargoContainerElements() const; - TIGL_EXPORT virtual std::vector>& GetCargoContainerElements(); + TIGL_EXPORT virtual const std::vector>& GetCargoContainerElements() const; + TIGL_EXPORT virtual std::vector>& GetCargoContainerElements(); TIGL_EXPORT virtual size_t GetCargoContainerElementCount() const; TIGL_EXPORT virtual size_t GetCargoContainerElementIndex(const std::string& UID) const; - TIGL_EXPORT virtual const CPACSCargoContainerElement& GetCargoContainerElement(size_t index) const; - TIGL_EXPORT virtual CPACSCargoContainerElement& GetCargoContainerElement(size_t index); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetCargoContainerElement(size_t index) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetCargoContainerElement(size_t index); - TIGL_EXPORT virtual const CPACSCargoContainerElement& GetCargoContainerElement(const std::string& UID) const; - TIGL_EXPORT virtual CPACSCargoContainerElement& GetCargoContainerElement(const std::string& UID); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetCargoContainerElement(const std::string& UID) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetCargoContainerElement(const std::string& UID); - TIGL_EXPORT virtual CPACSCargoContainerElement& AddCargoContainerElement(); - TIGL_EXPORT virtual void RemoveCargoContainerElement(CPACSCargoContainerElement& ref); + TIGL_EXPORT virtual CPACSVehicleElementBase& AddCargoContainerElement(); + TIGL_EXPORT virtual void RemoveCargoContainerElement(CPACSVehicleElementBase& ref); protected: CPACSDeckElements* m_parent; CTiglUIDManager* m_uidMgr; - std::vector> m_cargoContainerElements; + std::vector> m_cargoContainerElements; private: CPACSCargoContainerElements(const CPACSCargoContainerElements&) = delete; @@ -93,6 +93,6 @@ namespace generated // Aliases in tigl namespace using CCPACSCargoContainerElements = generated::CPACSCargoContainerElements; -using CCPACSCargoContainerElement = generated::CPACSCargoContainerElement; +using CCPACSVehicleElementBase = generated::CPACSVehicleElementBase; using CCPACSDeckElements = generated::CPACSDeckElements; } // namespace tigl diff --git a/src/generated/CPACSCargoContainers.cpp b/src/generated/CPACSCargoContainers.cpp new file mode 100644 index 0000000000..333daf7a94 --- /dev/null +++ b/src/generated/CPACSCargoContainers.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "CCPACSDeck.h" +#include "CPACSCargoContainers.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSCargoContainers::CPACSCargoContainers(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSCargoContainers::~CPACSCargoContainers() + { + } + + const CCPACSDeck* CPACSCargoContainers::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSCargoContainers::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSCargoContainers::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSCargoContainers::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSCargoContainers::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSCargoContainers::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSCargoContainers::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element cargoContainer + if (tixi::TixiCheckElement(tixiHandle, xpath + "/cargoContainer")) { + tixi::TixiReadElements(tixiHandle, xpath + "/cargoContainer", m_cargoContainers, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSCargoContainers::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element cargoContainer + tixi::TixiSaveElements(tixiHandle, xpath + "/cargoContainer", m_cargoContainers); + + } + + const std::vector>& CPACSCargoContainers::GetCargoContainers() const + { + return m_cargoContainers; + } + + std::vector>& CPACSCargoContainers::GetCargoContainers() + { + return m_cargoContainers; + } + + size_t CPACSCargoContainers::GetCargoContainerCount() const + { + return m_cargoContainers.size(); + } + + size_t CPACSCargoContainers::GetCargoContainerIndex(const std::string& UID) const + { + for (size_t i=0; i < GetCargoContainerCount(); i++) { + const std::string tmpUID(m_cargoContainers[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSCargoContainers::GetCargoContainerIndex", TIGL_UID_ERROR); + } + + CCPACSDeckComponentBase& CPACSCargoContainers::GetCargoContainer(size_t index) + { + if (index < 1 || index > GetCargoContainerCount()) { + throw CTiglError("Invalid index in std::vector>::GetCargoContainer", TIGL_INDEX_ERROR); + } + index--; + return *m_cargoContainers[index]; + } + + const CCPACSDeckComponentBase& CPACSCargoContainers::GetCargoContainer(size_t index) const + { + if (index < 1 || index > GetCargoContainerCount()) { + throw CTiglError("Invalid index in std::vector>::GetCargoContainer", TIGL_INDEX_ERROR); + } + index--; + return *m_cargoContainers[index]; + } + + CCPACSDeckComponentBase& CPACSCargoContainers::GetCargoContainer(const std::string& UID) + { + for (auto& elem : m_cargoContainers ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSCargoContainers::GetCargoContainer. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CCPACSDeckComponentBase& CPACSCargoContainers::GetCargoContainer(const std::string& UID) const + { + for (auto& elem : m_cargoContainers ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSCargoContainers::GetCargoContainer. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CCPACSDeckComponentBase& CPACSCargoContainers::AddCargoContainer() + { + m_cargoContainers.push_back(std::make_unique(this, m_uidMgr)); + return *m_cargoContainers.back(); + } + + void CPACSCargoContainers::RemoveCargoContainer(CCPACSDeckComponentBase& ref) + { + for (std::size_t i = 0; i < m_cargoContainers.size(); i++) { + if (m_cargoContainers[i].get() == &ref) { + m_cargoContainers.erase(m_cargoContainers.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSCargoContainers.h b/src/generated/CPACSCargoContainers.h new file mode 100644 index 0000000000..79c1599e71 --- /dev/null +++ b/src/generated/CPACSCargoContainers.h @@ -0,0 +1,95 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeckComponentBase; +class CCPACSDeck; + +namespace generated +{ + // This class is used in: + // CPACSDeck + + /// @brief Cargo containers + /// + /// Cargo container instance collection type. + /// + class CPACSCargoContainers + { + public: + TIGL_EXPORT CPACSCargoContainers(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSCargoContainers(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetCargoContainers() const; + TIGL_EXPORT virtual std::vector>& GetCargoContainers(); + + TIGL_EXPORT virtual size_t GetCargoContainerCount() const; + TIGL_EXPORT virtual size_t GetCargoContainerIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetCargoContainer(size_t index) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetCargoContainer(size_t index); + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetCargoContainer(const std::string& UID) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetCargoContainer(const std::string& UID); + + TIGL_EXPORT virtual CCPACSDeckComponentBase& AddCargoContainer(); + TIGL_EXPORT virtual void RemoveCargoContainer(CCPACSDeckComponentBase& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + std::vector> m_cargoContainers; + + private: + CPACSCargoContainers(const CPACSCargoContainers&) = delete; + CPACSCargoContainers& operator=(const CPACSCargoContainers&) = delete; + + CPACSCargoContainers(CPACSCargoContainers&&) = delete; + CPACSCargoContainers& operator=(CPACSCargoContainers&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSCargoContainers = generated::CPACSCargoContainers; +} // namespace tigl diff --git a/src/generated/CPACSCeilingPanelElements.cpp b/src/generated/CPACSCeilingPanelElements.cpp index a462df1d4b..41f5451aa5 100644 --- a/src/generated/CPACSCeilingPanelElements.cpp +++ b/src/generated/CPACSCeilingPanelElements.cpp @@ -17,8 +17,8 @@ #include #include "CPACSCeilingPanelElements.h" -#include "CPACSDeckElementBase.h" #include "CPACSDeckElements.h" +#include "CPACSVehicleElementBase.h" #include "CTiglError.h" #include "CTiglLogging.h" #include "CTiglUIDManager.h" @@ -98,12 +98,12 @@ namespace generated } - const std::vector>& CPACSCeilingPanelElements::GetCeilingPanelElements() const + const std::vector>& CPACSCeilingPanelElements::GetCeilingPanelElements() const { return m_ceilingPanelElements; } - std::vector>& CPACSCeilingPanelElements::GetCeilingPanelElements() + std::vector>& CPACSCeilingPanelElements::GetCeilingPanelElements() { return m_ceilingPanelElements; } @@ -124,25 +124,25 @@ namespace generated throw CTiglError("Invalid UID in CPACSCeilingPanelElements::GetCeilingPanelElementIndex", TIGL_UID_ERROR); } - CPACSDeckElementBase& CPACSCeilingPanelElements::GetCeilingPanelElement(size_t index) + CPACSVehicleElementBase& CPACSCeilingPanelElements::GetCeilingPanelElement(size_t index) { if (index < 1 || index > GetCeilingPanelElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetCeilingPanelElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetCeilingPanelElement", TIGL_INDEX_ERROR); } index--; return *m_ceilingPanelElements[index]; } - const CPACSDeckElementBase& CPACSCeilingPanelElements::GetCeilingPanelElement(size_t index) const + const CPACSVehicleElementBase& CPACSCeilingPanelElements::GetCeilingPanelElement(size_t index) const { if (index < 1 || index > GetCeilingPanelElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetCeilingPanelElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetCeilingPanelElement", TIGL_INDEX_ERROR); } index--; return *m_ceilingPanelElements[index]; } - CPACSDeckElementBase& CPACSCeilingPanelElements::GetCeilingPanelElement(const std::string& UID) + CPACSVehicleElementBase& CPACSCeilingPanelElements::GetCeilingPanelElement(const std::string& UID) { for (auto& elem : m_ceilingPanelElements ) { if (elem->GetUID() == UID) @@ -151,7 +151,7 @@ namespace generated throw CTiglError("Invalid UID in CPACSCeilingPanelElements::GetCeilingPanelElement. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); } - const CPACSDeckElementBase& CPACSCeilingPanelElements::GetCeilingPanelElement(const std::string& UID) const + const CPACSVehicleElementBase& CPACSCeilingPanelElements::GetCeilingPanelElement(const std::string& UID) const { for (auto& elem : m_ceilingPanelElements ) { if (elem->GetUID() == UID) @@ -161,13 +161,13 @@ namespace generated } - CPACSDeckElementBase& CPACSCeilingPanelElements::AddCeilingPanelElement() + CPACSVehicleElementBase& CPACSCeilingPanelElements::AddCeilingPanelElement() { - m_ceilingPanelElements.push_back(std::make_unique(this, m_uidMgr)); + m_ceilingPanelElements.push_back(std::make_unique(this, m_uidMgr)); return *m_ceilingPanelElements.back(); } - void CPACSCeilingPanelElements::RemoveCeilingPanelElement(CPACSDeckElementBase& ref) + void CPACSCeilingPanelElements::RemoveCeilingPanelElement(CPACSVehicleElementBase& ref) { for (std::size_t i = 0; i < m_ceilingPanelElements.size(); i++) { if (m_ceilingPanelElements[i].get() == &ref) { diff --git a/src/generated/CPACSCeilingPanelElements.h b/src/generated/CPACSCeilingPanelElements.h index 9121591d4b..33116ccb6c 100644 --- a/src/generated/CPACSCeilingPanelElements.h +++ b/src/generated/CPACSCeilingPanelElements.h @@ -30,7 +30,7 @@ class CTiglUIDObject; namespace generated { - class CPACSDeckElementBase; + class CPACSVehicleElementBase; class CPACSDeckElements; // This class is used in: @@ -60,20 +60,20 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const std::vector>& GetCeilingPanelElements() const; - TIGL_EXPORT virtual std::vector>& GetCeilingPanelElements(); + TIGL_EXPORT virtual const std::vector>& GetCeilingPanelElements() const; + TIGL_EXPORT virtual std::vector>& GetCeilingPanelElements(); TIGL_EXPORT virtual size_t GetCeilingPanelElementCount() const; TIGL_EXPORT virtual size_t GetCeilingPanelElementIndex(const std::string& UID) const; - TIGL_EXPORT virtual const CPACSDeckElementBase& GetCeilingPanelElement(size_t index) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetCeilingPanelElement(size_t index); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetCeilingPanelElement(size_t index) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetCeilingPanelElement(size_t index); - TIGL_EXPORT virtual const CPACSDeckElementBase& GetCeilingPanelElement(const std::string& UID) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetCeilingPanelElement(const std::string& UID); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetCeilingPanelElement(const std::string& UID) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetCeilingPanelElement(const std::string& UID); - TIGL_EXPORT virtual CPACSDeckElementBase& AddCeilingPanelElement(); - TIGL_EXPORT virtual void RemoveCeilingPanelElement(CPACSDeckElementBase& ref); + TIGL_EXPORT virtual CPACSVehicleElementBase& AddCeilingPanelElement(); + TIGL_EXPORT virtual void RemoveCeilingPanelElement(CPACSVehicleElementBase& ref); protected: CPACSDeckElements* m_parent; @@ -81,7 +81,7 @@ namespace generated CTiglUIDManager* m_uidMgr; /// Ceiling panel element for use in the decks - std::vector> m_ceilingPanelElements; + std::vector> m_ceilingPanelElements; private: CPACSCeilingPanelElements(const CPACSCeilingPanelElements&) = delete; @@ -94,6 +94,6 @@ namespace generated // Aliases in tigl namespace using CCPACSCeilingPanelElements = generated::CPACSCeilingPanelElements; -using CCPACSDeckElementBase = generated::CPACSDeckElementBase; +using CCPACSVehicleElementBase = generated::CPACSVehicleElementBase; using CCPACSDeckElements = generated::CPACSDeckElements; } // namespace tigl diff --git a/src/generated/CPACSCeilingPanels.cpp b/src/generated/CPACSCeilingPanels.cpp new file mode 100644 index 0000000000..0128417203 --- /dev/null +++ b/src/generated/CPACSCeilingPanels.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "CCPACSDeck.h" +#include "CPACSCeilingPanels.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSCeilingPanels::CPACSCeilingPanels(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSCeilingPanels::~CPACSCeilingPanels() + { + } + + const CCPACSDeck* CPACSCeilingPanels::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSCeilingPanels::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSCeilingPanels::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSCeilingPanels::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSCeilingPanels::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSCeilingPanels::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSCeilingPanels::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element ceilingPanel + if (tixi::TixiCheckElement(tixiHandle, xpath + "/ceilingPanel")) { + tixi::TixiReadElements(tixiHandle, xpath + "/ceilingPanel", m_ceilingPanels, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSCeilingPanels::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element ceilingPanel + tixi::TixiSaveElements(tixiHandle, xpath + "/ceilingPanel", m_ceilingPanels); + + } + + const std::vector>& CPACSCeilingPanels::GetCeilingPanels() const + { + return m_ceilingPanels; + } + + std::vector>& CPACSCeilingPanels::GetCeilingPanels() + { + return m_ceilingPanels; + } + + size_t CPACSCeilingPanels::GetCeilingPanelCount() const + { + return m_ceilingPanels.size(); + } + + size_t CPACSCeilingPanels::GetCeilingPanelIndex(const std::string& UID) const + { + for (size_t i=0; i < GetCeilingPanelCount(); i++) { + const std::string tmpUID(m_ceilingPanels[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSCeilingPanels::GetCeilingPanelIndex", TIGL_UID_ERROR); + } + + CCPACSDeckComponentBase& CPACSCeilingPanels::GetCeilingPanel(size_t index) + { + if (index < 1 || index > GetCeilingPanelCount()) { + throw CTiglError("Invalid index in std::vector>::GetCeilingPanel", TIGL_INDEX_ERROR); + } + index--; + return *m_ceilingPanels[index]; + } + + const CCPACSDeckComponentBase& CPACSCeilingPanels::GetCeilingPanel(size_t index) const + { + if (index < 1 || index > GetCeilingPanelCount()) { + throw CTiglError("Invalid index in std::vector>::GetCeilingPanel", TIGL_INDEX_ERROR); + } + index--; + return *m_ceilingPanels[index]; + } + + CCPACSDeckComponentBase& CPACSCeilingPanels::GetCeilingPanel(const std::string& UID) + { + for (auto& elem : m_ceilingPanels ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSCeilingPanels::GetCeilingPanel. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CCPACSDeckComponentBase& CPACSCeilingPanels::GetCeilingPanel(const std::string& UID) const + { + for (auto& elem : m_ceilingPanels ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSCeilingPanels::GetCeilingPanel. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CCPACSDeckComponentBase& CPACSCeilingPanels::AddCeilingPanel() + { + m_ceilingPanels.push_back(std::make_unique(this, m_uidMgr)); + return *m_ceilingPanels.back(); + } + + void CPACSCeilingPanels::RemoveCeilingPanel(CCPACSDeckComponentBase& ref) + { + for (std::size_t i = 0; i < m_ceilingPanels.size(); i++) { + if (m_ceilingPanels[i].get() == &ref) { + m_ceilingPanels.erase(m_ceilingPanels.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSCeilingPanels.h b/src/generated/CPACSCeilingPanels.h new file mode 100644 index 0000000000..641d30ec62 --- /dev/null +++ b/src/generated/CPACSCeilingPanels.h @@ -0,0 +1,96 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeckComponentBase; +class CCPACSDeck; + +namespace generated +{ + // This class is used in: + // CPACSDeck + + /// @brief Ceiling panels + /// + /// Ceiling panel instance collection type. + /// + class CPACSCeilingPanels + { + public: + TIGL_EXPORT CPACSCeilingPanels(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSCeilingPanels(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetCeilingPanels() const; + TIGL_EXPORT virtual std::vector>& GetCeilingPanels(); + + TIGL_EXPORT virtual size_t GetCeilingPanelCount() const; + TIGL_EXPORT virtual size_t GetCeilingPanelIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetCeilingPanel(size_t index) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetCeilingPanel(size_t index); + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetCeilingPanel(const std::string& UID) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetCeilingPanel(const std::string& UID); + + TIGL_EXPORT virtual CCPACSDeckComponentBase& AddCeilingPanel(); + TIGL_EXPORT virtual void RemoveCeilingPanel(CCPACSDeckComponentBase& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + /// Ceiling panel + std::vector> m_ceilingPanels; + + private: + CPACSCeilingPanels(const CPACSCeilingPanels&) = delete; + CPACSCeilingPanels& operator=(const CPACSCeilingPanels&) = delete; + + CPACSCeilingPanels(CPACSCeilingPanels&&) = delete; + CPACSCeilingPanels& operator=(CPACSCeilingPanels&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSCeilingPanels = generated::CPACSCeilingPanels; +} // namespace tigl diff --git a/src/generated/CPACSClassDividerElements.cpp b/src/generated/CPACSClassDividerElements.cpp index f7d0e3c216..74b531f572 100644 --- a/src/generated/CPACSClassDividerElements.cpp +++ b/src/generated/CPACSClassDividerElements.cpp @@ -17,8 +17,8 @@ #include #include "CPACSClassDividerElements.h" -#include "CPACSDeckElementBase.h" #include "CPACSDeckElements.h" +#include "CPACSVehicleElementBase.h" #include "CTiglError.h" #include "CTiglLogging.h" #include "CTiglUIDManager.h" @@ -98,12 +98,12 @@ namespace generated } - const std::vector>& CPACSClassDividerElements::GetClassDividerElements() const + const std::vector>& CPACSClassDividerElements::GetClassDividerElements() const { return m_classDividerElements; } - std::vector>& CPACSClassDividerElements::GetClassDividerElements() + std::vector>& CPACSClassDividerElements::GetClassDividerElements() { return m_classDividerElements; } @@ -124,25 +124,25 @@ namespace generated throw CTiglError("Invalid UID in CPACSClassDividerElements::GetClassDividerElementIndex", TIGL_UID_ERROR); } - CPACSDeckElementBase& CPACSClassDividerElements::GetClassDividerElement(size_t index) + CPACSVehicleElementBase& CPACSClassDividerElements::GetClassDividerElement(size_t index) { if (index < 1 || index > GetClassDividerElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetClassDividerElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetClassDividerElement", TIGL_INDEX_ERROR); } index--; return *m_classDividerElements[index]; } - const CPACSDeckElementBase& CPACSClassDividerElements::GetClassDividerElement(size_t index) const + const CPACSVehicleElementBase& CPACSClassDividerElements::GetClassDividerElement(size_t index) const { if (index < 1 || index > GetClassDividerElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetClassDividerElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetClassDividerElement", TIGL_INDEX_ERROR); } index--; return *m_classDividerElements[index]; } - CPACSDeckElementBase& CPACSClassDividerElements::GetClassDividerElement(const std::string& UID) + CPACSVehicleElementBase& CPACSClassDividerElements::GetClassDividerElement(const std::string& UID) { for (auto& elem : m_classDividerElements ) { if (elem->GetUID() == UID) @@ -151,7 +151,7 @@ namespace generated throw CTiglError("Invalid UID in CPACSClassDividerElements::GetClassDividerElement. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); } - const CPACSDeckElementBase& CPACSClassDividerElements::GetClassDividerElement(const std::string& UID) const + const CPACSVehicleElementBase& CPACSClassDividerElements::GetClassDividerElement(const std::string& UID) const { for (auto& elem : m_classDividerElements ) { if (elem->GetUID() == UID) @@ -161,13 +161,13 @@ namespace generated } - CPACSDeckElementBase& CPACSClassDividerElements::AddClassDividerElement() + CPACSVehicleElementBase& CPACSClassDividerElements::AddClassDividerElement() { - m_classDividerElements.push_back(std::make_unique(this, m_uidMgr)); + m_classDividerElements.push_back(std::make_unique(this, m_uidMgr)); return *m_classDividerElements.back(); } - void CPACSClassDividerElements::RemoveClassDividerElement(CPACSDeckElementBase& ref) + void CPACSClassDividerElements::RemoveClassDividerElement(CPACSVehicleElementBase& ref) { for (std::size_t i = 0; i < m_classDividerElements.size(); i++) { if (m_classDividerElements[i].get() == &ref) { diff --git a/src/generated/CPACSClassDividerElements.h b/src/generated/CPACSClassDividerElements.h index 320fd68ace..ef52c802c0 100644 --- a/src/generated/CPACSClassDividerElements.h +++ b/src/generated/CPACSClassDividerElements.h @@ -30,7 +30,7 @@ class CTiglUIDObject; namespace generated { - class CPACSDeckElementBase; + class CPACSVehicleElementBase; class CPACSDeckElements; // This class is used in: @@ -60,20 +60,20 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const std::vector>& GetClassDividerElements() const; - TIGL_EXPORT virtual std::vector>& GetClassDividerElements(); + TIGL_EXPORT virtual const std::vector>& GetClassDividerElements() const; + TIGL_EXPORT virtual std::vector>& GetClassDividerElements(); TIGL_EXPORT virtual size_t GetClassDividerElementCount() const; TIGL_EXPORT virtual size_t GetClassDividerElementIndex(const std::string& UID) const; - TIGL_EXPORT virtual const CPACSDeckElementBase& GetClassDividerElement(size_t index) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetClassDividerElement(size_t index); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetClassDividerElement(size_t index) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetClassDividerElement(size_t index); - TIGL_EXPORT virtual const CPACSDeckElementBase& GetClassDividerElement(const std::string& UID) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetClassDividerElement(const std::string& UID); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetClassDividerElement(const std::string& UID) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetClassDividerElement(const std::string& UID); - TIGL_EXPORT virtual CPACSDeckElementBase& AddClassDividerElement(); - TIGL_EXPORT virtual void RemoveClassDividerElement(CPACSDeckElementBase& ref); + TIGL_EXPORT virtual CPACSVehicleElementBase& AddClassDividerElement(); + TIGL_EXPORT virtual void RemoveClassDividerElement(CPACSVehicleElementBase& ref); protected: CPACSDeckElements* m_parent; @@ -81,7 +81,7 @@ namespace generated CTiglUIDManager* m_uidMgr; /// Class divider element for use in the decks - std::vector> m_classDividerElements; + std::vector> m_classDividerElements; private: CPACSClassDividerElements(const CPACSClassDividerElements&) = delete; @@ -94,6 +94,6 @@ namespace generated // Aliases in tigl namespace using CCPACSClassDividerElements = generated::CPACSClassDividerElements; -using CCPACSDeckElementBase = generated::CPACSDeckElementBase; +using CCPACSVehicleElementBase = generated::CPACSVehicleElementBase; using CCPACSDeckElements = generated::CPACSDeckElements; } // namespace tigl diff --git a/src/generated/CPACSClassDividers.cpp b/src/generated/CPACSClassDividers.cpp new file mode 100644 index 0000000000..96b6f8054c --- /dev/null +++ b/src/generated/CPACSClassDividers.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "CCPACSDeck.h" +#include "CPACSClassDividers.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSClassDividers::CPACSClassDividers(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSClassDividers::~CPACSClassDividers() + { + } + + const CCPACSDeck* CPACSClassDividers::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSClassDividers::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSClassDividers::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSClassDividers::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSClassDividers::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSClassDividers::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSClassDividers::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element classDivider + if (tixi::TixiCheckElement(tixiHandle, xpath + "/classDivider")) { + tixi::TixiReadElements(tixiHandle, xpath + "/classDivider", m_classDividers, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSClassDividers::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element classDivider + tixi::TixiSaveElements(tixiHandle, xpath + "/classDivider", m_classDividers); + + } + + const std::vector>& CPACSClassDividers::GetClassDividers() const + { + return m_classDividers; + } + + std::vector>& CPACSClassDividers::GetClassDividers() + { + return m_classDividers; + } + + size_t CPACSClassDividers::GetClassDividerCount() const + { + return m_classDividers.size(); + } + + size_t CPACSClassDividers::GetClassDividerIndex(const std::string& UID) const + { + for (size_t i=0; i < GetClassDividerCount(); i++) { + const std::string tmpUID(m_classDividers[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSClassDividers::GetClassDividerIndex", TIGL_UID_ERROR); + } + + CCPACSDeckComponentBase& CPACSClassDividers::GetClassDivider(size_t index) + { + if (index < 1 || index > GetClassDividerCount()) { + throw CTiglError("Invalid index in std::vector>::GetClassDivider", TIGL_INDEX_ERROR); + } + index--; + return *m_classDividers[index]; + } + + const CCPACSDeckComponentBase& CPACSClassDividers::GetClassDivider(size_t index) const + { + if (index < 1 || index > GetClassDividerCount()) { + throw CTiglError("Invalid index in std::vector>::GetClassDivider", TIGL_INDEX_ERROR); + } + index--; + return *m_classDividers[index]; + } + + CCPACSDeckComponentBase& CPACSClassDividers::GetClassDivider(const std::string& UID) + { + for (auto& elem : m_classDividers ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSClassDividers::GetClassDivider. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CCPACSDeckComponentBase& CPACSClassDividers::GetClassDivider(const std::string& UID) const + { + for (auto& elem : m_classDividers ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSClassDividers::GetClassDivider. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CCPACSDeckComponentBase& CPACSClassDividers::AddClassDivider() + { + m_classDividers.push_back(std::make_unique(this, m_uidMgr)); + return *m_classDividers.back(); + } + + void CPACSClassDividers::RemoveClassDivider(CCPACSDeckComponentBase& ref) + { + for (std::size_t i = 0; i < m_classDividers.size(); i++) { + if (m_classDividers[i].get() == &ref) { + m_classDividers.erase(m_classDividers.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSClassDividers.h b/src/generated/CPACSClassDividers.h new file mode 100644 index 0000000000..630571be78 --- /dev/null +++ b/src/generated/CPACSClassDividers.h @@ -0,0 +1,96 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeckComponentBase; +class CCPACSDeck; + +namespace generated +{ + // This class is used in: + // CPACSDeck + + /// @brief Class dividers + /// + /// Class divider instance collection type. + /// + class CPACSClassDividers + { + public: + TIGL_EXPORT CPACSClassDividers(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSClassDividers(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetClassDividers() const; + TIGL_EXPORT virtual std::vector>& GetClassDividers(); + + TIGL_EXPORT virtual size_t GetClassDividerCount() const; + TIGL_EXPORT virtual size_t GetClassDividerIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetClassDivider(size_t index) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetClassDivider(size_t index); + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetClassDivider(const std::string& UID) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetClassDivider(const std::string& UID); + + TIGL_EXPORT virtual CCPACSDeckComponentBase& AddClassDivider(); + TIGL_EXPORT virtual void RemoveClassDivider(CCPACSDeckComponentBase& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + /// Class divider + std::vector> m_classDividers; + + private: + CPACSClassDividers(const CPACSClassDividers&) = delete; + CPACSClassDividers& operator=(const CPACSClassDividers&) = delete; + + CPACSClassDividers(CPACSClassDividers&&) = delete; + CPACSClassDividers& operator=(CPACSClassDividers&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSClassDividers = generated::CPACSClassDividers; +} // namespace tigl diff --git a/src/generated/CPACSComponent.cpp b/src/generated/CPACSComponent.cpp index 6d2d9fcd6d..2bdd127633 100644 --- a/src/generated/CPACSComponent.cpp +++ b/src/generated/CPACSComponent.cpp @@ -99,7 +99,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -110,7 +110,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; @@ -118,7 +118,7 @@ namespace generated } // read element systemElementUID - if (tixi::TixiCheckElement(tixiHandle, xpath + "/systemElementUID")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/systemElementUID")) { m_systemElementUID = tixi::TixiGetElement(tixiHandle, xpath + "/systemElementUID"); if (m_systemElementUID.empty()) { LOG(WARNING) << "Required element systemElementUID is empty at xpath " << xpath; @@ -130,7 +130,7 @@ namespace generated } // read element parentUID - if (tixi::TixiCheckElement(tixiHandle, xpath + "/parentUID")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/parentUID")) { m_parentUID = tixi::TixiGetElement(tixiHandle, xpath + "/parentUID"); if (m_parentUID->empty()) { LOG(WARNING) << "Optional element parentUID is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSCone.cpp b/src/generated/CPACSCone.cpp index fd672c2fa8..693da7c6e4 100644 --- a/src/generated/CPACSCone.cpp +++ b/src/generated/CPACSCone.cpp @@ -86,7 +86,7 @@ namespace generated void CPACSCone::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { // read element lowerRadius - if (tixi::TixiCheckElement(tixiHandle, xpath + "/lowerRadius")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/lowerRadius")) { m_lowerRadius = tixi::TixiGetElement(tixiHandle, xpath + "/lowerRadius"); } else { @@ -94,12 +94,12 @@ namespace generated } // read element upperRadius - if (tixi::TixiCheckElement(tixiHandle, xpath + "/upperRadius")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/upperRadius")) { m_upperRadius = tixi::TixiGetElement(tixiHandle, xpath + "/upperRadius"); } // read element height - if (tixi::TixiCheckElement(tixiHandle, xpath + "/height")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/height")) { m_height = tixi::TixiGetElement(tixiHandle, xpath + "/height"); } else { diff --git a/src/generated/CPACSCuboid.cpp b/src/generated/CPACSCuboid.cpp index 6cb76a0a6f..4504e63d10 100644 --- a/src/generated/CPACSCuboid.cpp +++ b/src/generated/CPACSCuboid.cpp @@ -87,7 +87,7 @@ namespace generated void CPACSCuboid::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { // read element lengthX - if (tixi::TixiCheckElement(tixiHandle, xpath + "/lengthX")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/lengthX")) { m_lengthX = tixi::TixiGetElement(tixiHandle, xpath + "/lengthX"); } else { @@ -95,7 +95,7 @@ namespace generated } // read element depthY - if (tixi::TixiCheckElement(tixiHandle, xpath + "/depthY")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/depthY")) { m_depthY = tixi::TixiGetElement(tixiHandle, xpath + "/depthY"); } else { @@ -103,7 +103,7 @@ namespace generated } // read element heightZ - if (tixi::TixiCheckElement(tixiHandle, xpath + "/heightZ")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/heightZ")) { m_heightZ = tixi::TixiGetElement(tixiHandle, xpath + "/heightZ"); } else { @@ -111,22 +111,22 @@ namespace generated } // read element upperFaceXmin - if (tixi::TixiCheckElement(tixiHandle, xpath + "/upperFaceXmin")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/upperFaceXmin")) { m_upperFaceXmin = tixi::TixiGetElement(tixiHandle, xpath + "/upperFaceXmin"); } // read element upperFaceXmax - if (tixi::TixiCheckElement(tixiHandle, xpath + "/upperFaceXmax")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/upperFaceXmax")) { m_upperFaceXmax = tixi::TixiGetElement(tixiHandle, xpath + "/upperFaceXmax"); } // read element upperFaceYmin - if (tixi::TixiCheckElement(tixiHandle, xpath + "/upperFaceYmin")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/upperFaceYmin")) { m_upperFaceYmin = tixi::TixiGetElement(tixiHandle, xpath + "/upperFaceYmin"); } // read element upperFaceYmax - if (tixi::TixiCheckElement(tixiHandle, xpath + "/upperFaceYmax")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/upperFaceYmax")) { m_upperFaceYmax = tixi::TixiGetElement(tixiHandle, xpath + "/upperFaceYmax"); } diff --git a/src/generated/CPACSCylinder.cpp b/src/generated/CPACSCylinder.cpp index ddd70b9796..10d0f71e24 100644 --- a/src/generated/CPACSCylinder.cpp +++ b/src/generated/CPACSCylinder.cpp @@ -86,7 +86,7 @@ namespace generated void CPACSCylinder::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { // read element radius - if (tixi::TixiCheckElement(tixiHandle, xpath + "/radius")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/radius")) { m_radius = tixi::TixiGetElement(tixiHandle, xpath + "/radius"); } else { @@ -94,7 +94,7 @@ namespace generated } // read element height - if (tixi::TixiCheckElement(tixiHandle, xpath + "/height")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/height")) { m_height = tixi::TixiGetElement(tixiHandle, xpath + "/height"); } else { diff --git a/src/generated/CPACSDeck.cpp b/src/generated/CPACSDeck.cpp new file mode 100644 index 0000000000..28262ab34c --- /dev/null +++ b/src/generated/CPACSDeck.cpp @@ -0,0 +1,884 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CPACSDeck.h" +#include "CPACSDecks.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSDeck::CPACSDeck(CPACSDecks* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_transformation(reinterpret_cast(this), m_uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSDeck::~CPACSDeck() + { + if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); + if (m_uidMgr) { + if (m_parentUID && !m_parentUID->empty()) m_uidMgr->TryUnregisterReference(*m_parentUID, *this); + if (m_floorStructureUID && !m_floorStructureUID->empty()) m_uidMgr->TryUnregisterReference(*m_floorStructureUID, *this); + } + } + + const CPACSDecks* CPACSDeck::GetParent() const + { + return m_parent; + } + + CPACSDecks* CPACSDeck::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSDeck::GetNextUIDParent() const + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDObject* CPACSDeck::GetNextUIDParent() + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDManager& CPACSDeck::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSDeck::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSDeck::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read attribute uID + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { + m_uID = tixi::TixiGetAttribute(tixiHandle, xpath, "uID"); + if (m_uID.empty()) { + LOG(WARNING) << "Required attribute uID is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; + } + + // read element name + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { + m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); + if (m_name.empty()) { + LOG(WARNING) << "Required element name is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required element name is missing at xpath " << xpath; + } + + // read element description + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { + m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); + if (m_description->empty()) { + LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; + } + } + + // read element parentUID + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/parentUID")) { + m_parentUID = tixi::TixiGetElement(tixiHandle, xpath + "/parentUID"); + if (m_parentUID->empty()) { + LOG(WARNING) << "Optional element parentUID is present but empty at xpath " << xpath; + } + if (m_uidMgr && !m_parentUID->empty()) m_uidMgr->RegisterReference(*m_parentUID, *this); + } + + // read element floorStructureUID + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/floorStructureUID")) { + m_floorStructureUID = tixi::TixiGetElement(tixiHandle, xpath + "/floorStructureUID"); + if (m_floorStructureUID->empty()) { + LOG(WARNING) << "Optional element floorStructureUID is present but empty at xpath " << xpath; + } + if (m_uidMgr && !m_floorStructureUID->empty()) m_uidMgr->RegisterReference(*m_floorStructureUID, *this); + } + + // read element transformation + if (tixi::TixiCheckElement(tixiHandle, xpath + "/transformation")) { + m_transformation.ReadCPACS(tixiHandle, xpath + "/transformation"); + } + else { + LOG(ERROR) << "Required element transformation is missing at xpath " << xpath; + } + + // read element deckType + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/deckType")) { + m_deckType = stringToCPACSDeck_deckType(tixi::TixiGetElement(tixiHandle, xpath + "/deckType")); + } + else { + LOG(ERROR) << "Required element deckType is missing at xpath " << xpath; + } + + // read element cabinGeometry + if (tixi::TixiCheckElement(tixiHandle, xpath + "/cabinGeometry")) { + m_cabinGeometry = boost::in_place(reinterpret_cast(this)); + try { + m_cabinGeometry->ReadCPACS(tixiHandle, xpath + "/cabinGeometry"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read cabinGeometry at xpath " << xpath << ": " << e.what(); + m_cabinGeometry = boost::none; + } + } + + // read element seatModules + if (tixi::TixiCheckElement(tixiHandle, xpath + "/seatModules")) { + m_seatModules = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_seatModules->ReadCPACS(tixiHandle, xpath + "/seatModules"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read seatModules at xpath " << xpath << ": " << e.what(); + m_seatModules = boost::none; + } + } + + // read element aisles + if (tixi::TixiCheckElement(tixiHandle, xpath + "/aisles")) { + m_aisles = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_aisles->ReadCPACS(tixiHandle, xpath + "/aisles"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read aisles at xpath " << xpath << ": " << e.what(); + m_aisles = boost::none; + } + } + + // read element spaces + if (tixi::TixiCheckElement(tixiHandle, xpath + "/spaces")) { + m_spaces = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_spaces->ReadCPACS(tixiHandle, xpath + "/spaces"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read spaces at xpath " << xpath << ": " << e.what(); + m_spaces = boost::none; + } + } + + // read element sidewallPanels + if (tixi::TixiCheckElement(tixiHandle, xpath + "/sidewallPanels")) { + m_sidewallPanels = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_sidewallPanels->ReadCPACS(tixiHandle, xpath + "/sidewallPanels"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read sidewallPanels at xpath " << xpath << ": " << e.what(); + m_sidewallPanels = boost::none; + } + } + + // read element luggageCompartments + if (tixi::TixiCheckElement(tixiHandle, xpath + "/luggageCompartments")) { + m_luggageCompartments = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_luggageCompartments->ReadCPACS(tixiHandle, xpath + "/luggageCompartments"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read luggageCompartments at xpath " << xpath << ": " << e.what(); + m_luggageCompartments = boost::none; + } + } + + // read element ceilingPanels + if (tixi::TixiCheckElement(tixiHandle, xpath + "/ceilingPanels")) { + m_ceilingPanels = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_ceilingPanels->ReadCPACS(tixiHandle, xpath + "/ceilingPanels"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read ceilingPanels at xpath " << xpath << ": " << e.what(); + m_ceilingPanels = boost::none; + } + } + + // read element galleys + if (tixi::TixiCheckElement(tixiHandle, xpath + "/galleys")) { + m_galleys = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_galleys->ReadCPACS(tixiHandle, xpath + "/galleys"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read galleys at xpath " << xpath << ": " << e.what(); + m_galleys = boost::none; + } + } + + // read element genericFloorModules + if (tixi::TixiCheckElement(tixiHandle, xpath + "/genericFloorModules")) { + m_genericFloorModules = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_genericFloorModules->ReadCPACS(tixiHandle, xpath + "/genericFloorModules"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read genericFloorModules at xpath " << xpath << ": " << e.what(); + m_genericFloorModules = boost::none; + } + } + + // read element lavatories + if (tixi::TixiCheckElement(tixiHandle, xpath + "/lavatories")) { + m_lavatories = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_lavatories->ReadCPACS(tixiHandle, xpath + "/lavatories"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read lavatories at xpath " << xpath << ": " << e.what(); + m_lavatories = boost::none; + } + } + + // read element classDividers + if (tixi::TixiCheckElement(tixiHandle, xpath + "/classDividers")) { + m_classDividers = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_classDividers->ReadCPACS(tixiHandle, xpath + "/classDividers"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read classDividers at xpath " << xpath << ": " << e.what(); + m_classDividers = boost::none; + } + } + + // read element cargoContainers + if (tixi::TixiCheckElement(tixiHandle, xpath + "/cargoContainers")) { + m_cargoContainers = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_cargoContainers->ReadCPACS(tixiHandle, xpath + "/cargoContainers"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read cargoContainers at xpath " << xpath << ": " << e.what(); + m_cargoContainers = boost::none; + } + } + + // read element deckDoors + if (tixi::TixiCheckElement(tixiHandle, xpath + "/deckDoors")) { + m_deckDoors = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_deckDoors->ReadCPACS(tixiHandle, xpath + "/deckDoors"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read deckDoors at xpath " << xpath << ": " << e.what(); + m_deckDoors = boost::none; + } + } + + if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); + } + + void CPACSDeck::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write attribute uID + tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); + + // write element name + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); + tixi::TixiSaveElement(tixiHandle, xpath + "/name", m_name); + + // write element description + if (m_description) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/description"); + tixi::TixiSaveElement(tixiHandle, xpath + "/description", *m_description); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/description"); + } + } + + // write element parentUID + if (m_parentUID) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/parentUID"); + tixi::TixiSaveElement(tixiHandle, xpath + "/parentUID", *m_parentUID); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/parentUID")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/parentUID"); + } + } + + // write element floorStructureUID + if (m_floorStructureUID) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/floorStructureUID"); + tixi::TixiSaveElement(tixiHandle, xpath + "/floorStructureUID", *m_floorStructureUID); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/floorStructureUID")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/floorStructureUID"); + } + } + + // write element transformation + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/transformation"); + m_transformation.WriteCPACS(tixiHandle, xpath + "/transformation"); + + // write element deckType + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/deckType"); + tixi::TixiSaveElement(tixiHandle, xpath + "/deckType", CPACSDeck_deckTypeToString(m_deckType)); + + // write element cabinGeometry + if (m_cabinGeometry) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/cabinGeometry"); + m_cabinGeometry->WriteCPACS(tixiHandle, xpath + "/cabinGeometry"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/cabinGeometry")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/cabinGeometry"); + } + } + + // write element seatModules + if (m_seatModules) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/seatModules"); + m_seatModules->WriteCPACS(tixiHandle, xpath + "/seatModules"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/seatModules")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/seatModules"); + } + } + + // write element aisles + if (m_aisles) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/aisles"); + m_aisles->WriteCPACS(tixiHandle, xpath + "/aisles"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/aisles")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/aisles"); + } + } + + // write element spaces + if (m_spaces) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/spaces"); + m_spaces->WriteCPACS(tixiHandle, xpath + "/spaces"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/spaces")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/spaces"); + } + } + + // write element sidewallPanels + if (m_sidewallPanels) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/sidewallPanels"); + m_sidewallPanels->WriteCPACS(tixiHandle, xpath + "/sidewallPanels"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/sidewallPanels")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/sidewallPanels"); + } + } + + // write element luggageCompartments + if (m_luggageCompartments) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/luggageCompartments"); + m_luggageCompartments->WriteCPACS(tixiHandle, xpath + "/luggageCompartments"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/luggageCompartments")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/luggageCompartments"); + } + } + + // write element ceilingPanels + if (m_ceilingPanels) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/ceilingPanels"); + m_ceilingPanels->WriteCPACS(tixiHandle, xpath + "/ceilingPanels"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/ceilingPanels")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/ceilingPanels"); + } + } + + // write element galleys + if (m_galleys) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/galleys"); + m_galleys->WriteCPACS(tixiHandle, xpath + "/galleys"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/galleys")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/galleys"); + } + } + + // write element genericFloorModules + if (m_genericFloorModules) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/genericFloorModules"); + m_genericFloorModules->WriteCPACS(tixiHandle, xpath + "/genericFloorModules"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/genericFloorModules")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/genericFloorModules"); + } + } + + // write element lavatories + if (m_lavatories) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/lavatories"); + m_lavatories->WriteCPACS(tixiHandle, xpath + "/lavatories"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/lavatories")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/lavatories"); + } + } + + // write element classDividers + if (m_classDividers) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/classDividers"); + m_classDividers->WriteCPACS(tixiHandle, xpath + "/classDividers"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/classDividers")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/classDividers"); + } + } + + // write element cargoContainers + if (m_cargoContainers) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/cargoContainers"); + m_cargoContainers->WriteCPACS(tixiHandle, xpath + "/cargoContainers"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/cargoContainers")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/cargoContainers"); + } + } + + // write element deckDoors + if (m_deckDoors) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/deckDoors"); + m_deckDoors->WriteCPACS(tixiHandle, xpath + "/deckDoors"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/deckDoors")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/deckDoors"); + } + } + + } + + const std::string& CPACSDeck::GetUID() const + { + return m_uID; + } + + void CPACSDeck::SetUID(const std::string& value) + { + if (m_uidMgr && value != m_uID) { + if (m_uID.empty()) { + m_uidMgr->RegisterObject(value, *this); + } + else { + m_uidMgr->UpdateObjectUID(m_uID, value); + } + } + m_uID = value; + } + + const std::string& CPACSDeck::GetName() const + { + return m_name; + } + + void CPACSDeck::SetName(const std::string& value) + { + m_name = value; + } + + const boost::optional& CPACSDeck::GetDescription() const + { + return m_description; + } + + void CPACSDeck::SetDescription(const boost::optional& value) + { + m_description = value; + } + + const boost::optional& CPACSDeck::GetParentUID() const + { + return m_parentUID; + } + + void CPACSDeck::SetParentUID(const boost::optional& value) + { + if (m_uidMgr) { + if (m_parentUID && !m_parentUID->empty()) m_uidMgr->TryUnregisterReference(*m_parentUID, *this); + if (value && !value->empty()) m_uidMgr->RegisterReference(*value, *this); + } + m_parentUID = value; + } + + const boost::optional& CPACSDeck::GetFloorStructureUID() const + { + return m_floorStructureUID; + } + + void CPACSDeck::SetFloorStructureUID(const boost::optional& value) + { + if (m_uidMgr) { + if (m_floorStructureUID && !m_floorStructureUID->empty()) m_uidMgr->TryUnregisterReference(*m_floorStructureUID, *this); + if (value && !value->empty()) m_uidMgr->RegisterReference(*value, *this); + } + m_floorStructureUID = value; + } + + const CCPACSTransformation& CPACSDeck::GetTransformation() const + { + return m_transformation; + } + + CCPACSTransformation& CPACSDeck::GetTransformation() + { + return m_transformation; + } + + const CPACSDeck_deckType& CPACSDeck::GetDeckType() const + { + return m_deckType; + } + + void CPACSDeck::SetDeckType(const CPACSDeck_deckType& value) + { + m_deckType = value; + } + + const boost::optional& CPACSDeck::GetCabinGeometry() const + { + return m_cabinGeometry; + } + + boost::optional& CPACSDeck::GetCabinGeometry() + { + return m_cabinGeometry; + } + + const boost::optional& CPACSDeck::GetSeatModules() const + { + return m_seatModules; + } + + boost::optional& CPACSDeck::GetSeatModules() + { + return m_seatModules; + } + + const boost::optional& CPACSDeck::GetAisles() const + { + return m_aisles; + } + + boost::optional& CPACSDeck::GetAisles() + { + return m_aisles; + } + + const boost::optional& CPACSDeck::GetSpaces() const + { + return m_spaces; + } + + boost::optional& CPACSDeck::GetSpaces() + { + return m_spaces; + } + + const boost::optional& CPACSDeck::GetSidewallPanels() const + { + return m_sidewallPanels; + } + + boost::optional& CPACSDeck::GetSidewallPanels() + { + return m_sidewallPanels; + } + + const boost::optional& CPACSDeck::GetLuggageCompartments() const + { + return m_luggageCompartments; + } + + boost::optional& CPACSDeck::GetLuggageCompartments() + { + return m_luggageCompartments; + } + + const boost::optional& CPACSDeck::GetCeilingPanels() const + { + return m_ceilingPanels; + } + + boost::optional& CPACSDeck::GetCeilingPanels() + { + return m_ceilingPanels; + } + + const boost::optional& CPACSDeck::GetGalleys() const + { + return m_galleys; + } + + boost::optional& CPACSDeck::GetGalleys() + { + return m_galleys; + } + + const boost::optional& CPACSDeck::GetGenericFloorModules() const + { + return m_genericFloorModules; + } + + boost::optional& CPACSDeck::GetGenericFloorModules() + { + return m_genericFloorModules; + } + + const boost::optional& CPACSDeck::GetLavatories() const + { + return m_lavatories; + } + + boost::optional& CPACSDeck::GetLavatories() + { + return m_lavatories; + } + + const boost::optional& CPACSDeck::GetClassDividers() const + { + return m_classDividers; + } + + boost::optional& CPACSDeck::GetClassDividers() + { + return m_classDividers; + } + + const boost::optional& CPACSDeck::GetCargoContainers() const + { + return m_cargoContainers; + } + + boost::optional& CPACSDeck::GetCargoContainers() + { + return m_cargoContainers; + } + + const boost::optional& CPACSDeck::GetDeckDoors() const + { + return m_deckDoors; + } + + boost::optional& CPACSDeck::GetDeckDoors() + { + return m_deckDoors; + } + + CPACSCabinGeometry& CPACSDeck::GetCabinGeometry(CreateIfNotExistsTag) + { + if (!m_cabinGeometry) + m_cabinGeometry = boost::in_place(reinterpret_cast(this)); + return *m_cabinGeometry; + } + + void CPACSDeck::RemoveCabinGeometry() + { + m_cabinGeometry = boost::none; + } + + CPACSSeatModules& CPACSDeck::GetSeatModules(CreateIfNotExistsTag) + { + if (!m_seatModules) + m_seatModules = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_seatModules; + } + + void CPACSDeck::RemoveSeatModules() + { + m_seatModules = boost::none; + } + + CPACSCabinAisles& CPACSDeck::GetAisles(CreateIfNotExistsTag) + { + if (!m_aisles) + m_aisles = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_aisles; + } + + void CPACSDeck::RemoveAisles() + { + m_aisles = boost::none; + } + + CPACSCabinSpaces& CPACSDeck::GetSpaces(CreateIfNotExistsTag) + { + if (!m_spaces) + m_spaces = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_spaces; + } + + void CPACSDeck::RemoveSpaces() + { + m_spaces = boost::none; + } + + CPACSSidewallPanels& CPACSDeck::GetSidewallPanels(CreateIfNotExistsTag) + { + if (!m_sidewallPanels) + m_sidewallPanels = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_sidewallPanels; + } + + void CPACSDeck::RemoveSidewallPanels() + { + m_sidewallPanels = boost::none; + } + + CPACSLuggageCompartments& CPACSDeck::GetLuggageCompartments(CreateIfNotExistsTag) + { + if (!m_luggageCompartments) + m_luggageCompartments = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_luggageCompartments; + } + + void CPACSDeck::RemoveLuggageCompartments() + { + m_luggageCompartments = boost::none; + } + + CPACSCeilingPanels& CPACSDeck::GetCeilingPanels(CreateIfNotExistsTag) + { + if (!m_ceilingPanels) + m_ceilingPanels = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_ceilingPanels; + } + + void CPACSDeck::RemoveCeilingPanels() + { + m_ceilingPanels = boost::none; + } + + CPACSGalleys& CPACSDeck::GetGalleys(CreateIfNotExistsTag) + { + if (!m_galleys) + m_galleys = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_galleys; + } + + void CPACSDeck::RemoveGalleys() + { + m_galleys = boost::none; + } + + CPACSGenericFloorModules& CPACSDeck::GetGenericFloorModules(CreateIfNotExistsTag) + { + if (!m_genericFloorModules) + m_genericFloorModules = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_genericFloorModules; + } + + void CPACSDeck::RemoveGenericFloorModules() + { + m_genericFloorModules = boost::none; + } + + CPACSLavatories& CPACSDeck::GetLavatories(CreateIfNotExistsTag) + { + if (!m_lavatories) + m_lavatories = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_lavatories; + } + + void CPACSDeck::RemoveLavatories() + { + m_lavatories = boost::none; + } + + CPACSClassDividers& CPACSDeck::GetClassDividers(CreateIfNotExistsTag) + { + if (!m_classDividers) + m_classDividers = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_classDividers; + } + + void CPACSDeck::RemoveClassDividers() + { + m_classDividers = boost::none; + } + + CPACSCargoContainers& CPACSDeck::GetCargoContainers(CreateIfNotExistsTag) + { + if (!m_cargoContainers) + m_cargoContainers = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_cargoContainers; + } + + void CPACSDeck::RemoveCargoContainers() + { + m_cargoContainers = boost::none; + } + + CPACSDeckDoors& CPACSDeck::GetDeckDoors(CreateIfNotExistsTag) + { + if (!m_deckDoors) + m_deckDoors = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_deckDoors; + } + + void CPACSDeck::RemoveDeckDoors() + { + m_deckDoors = boost::none; + } + + const CTiglUIDObject* CPACSDeck::GetNextUIDObject() const + { + return this; + } + + void CPACSDeck::NotifyUIDChange(const std::string& oldUid, const std::string& newUid) + { + if (m_parentUID && *m_parentUID == oldUid) { + m_parentUID = newUid; + } + if (m_floorStructureUID && *m_floorStructureUID == oldUid) { + m_floorStructureUID = newUid; + } + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSDeck.h b/src/generated/CPACSDeck.h new file mode 100644 index 0000000000..de7db86c49 --- /dev/null +++ b/src/generated/CPACSDeck.h @@ -0,0 +1,260 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include +#include "CPACSCabinAisles.h" +#include "CPACSCabinGeometry.h" +#include "CPACSCabinSpaces.h" +#include "CPACSCargoContainers.h" +#include "CPACSCeilingPanels.h" +#include "CPACSClassDividers.h" +#include "CPACSDeck_deckType.h" +#include "CPACSDeckDoors.h" +#include "CPACSGalleys.h" +#include "CPACSGenericFloorModules.h" +#include "CPACSLavatories.h" +#include "CPACSLuggageCompartments.h" +#include "CPACSSeatModules.h" +#include "CPACSSidewallPanels.h" +#include "CreateIfNotExists.h" +#include "CTiglUIDObject.h" +#include "ITiglUIDRefObject.h" +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; + +namespace generated +{ + class CPACSDecks; + + // This class is used in: + // CPACSDecks + + /// @brief Deck + /// + /// Data of an aircraft or rotorcraft deck + /// + class CPACSDeck : public CTiglReqUIDObject, public ITiglUIDRefObject + { + public: + TIGL_EXPORT CPACSDeck(CPACSDecks* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSDeck(); + + TIGL_EXPORT CPACSDecks* GetParent(); + + TIGL_EXPORT const CPACSDecks* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::string& GetUID() const; + TIGL_EXPORT virtual void SetUID(const std::string& value); + + TIGL_EXPORT virtual const std::string& GetName() const; + TIGL_EXPORT virtual void SetName(const std::string& value); + + TIGL_EXPORT virtual const boost::optional& GetDescription() const; + TIGL_EXPORT virtual void SetDescription(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetParentUID() const; + TIGL_EXPORT virtual void SetParentUID(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetFloorStructureUID() const; + TIGL_EXPORT virtual void SetFloorStructureUID(const boost::optional& value); + + TIGL_EXPORT virtual const CCPACSTransformation& GetTransformation() const; + TIGL_EXPORT virtual CCPACSTransformation& GetTransformation(); + + TIGL_EXPORT virtual const CPACSDeck_deckType& GetDeckType() const; + TIGL_EXPORT virtual void SetDeckType(const CPACSDeck_deckType& value); + + TIGL_EXPORT virtual const boost::optional& GetCabinGeometry() const; + TIGL_EXPORT virtual boost::optional& GetCabinGeometry(); + + TIGL_EXPORT virtual const boost::optional& GetSeatModules() const; + TIGL_EXPORT virtual boost::optional& GetSeatModules(); + + TIGL_EXPORT virtual const boost::optional& GetAisles() const; + TIGL_EXPORT virtual boost::optional& GetAisles(); + + TIGL_EXPORT virtual const boost::optional& GetSpaces() const; + TIGL_EXPORT virtual boost::optional& GetSpaces(); + + TIGL_EXPORT virtual const boost::optional& GetSidewallPanels() const; + TIGL_EXPORT virtual boost::optional& GetSidewallPanels(); + + TIGL_EXPORT virtual const boost::optional& GetLuggageCompartments() const; + TIGL_EXPORT virtual boost::optional& GetLuggageCompartments(); + + TIGL_EXPORT virtual const boost::optional& GetCeilingPanels() const; + TIGL_EXPORT virtual boost::optional& GetCeilingPanels(); + + TIGL_EXPORT virtual const boost::optional& GetGalleys() const; + TIGL_EXPORT virtual boost::optional& GetGalleys(); + + TIGL_EXPORT virtual const boost::optional& GetGenericFloorModules() const; + TIGL_EXPORT virtual boost::optional& GetGenericFloorModules(); + + TIGL_EXPORT virtual const boost::optional& GetLavatories() const; + TIGL_EXPORT virtual boost::optional& GetLavatories(); + + TIGL_EXPORT virtual const boost::optional& GetClassDividers() const; + TIGL_EXPORT virtual boost::optional& GetClassDividers(); + + TIGL_EXPORT virtual const boost::optional& GetCargoContainers() const; + TIGL_EXPORT virtual boost::optional& GetCargoContainers(); + + TIGL_EXPORT virtual const boost::optional& GetDeckDoors() const; + TIGL_EXPORT virtual boost::optional& GetDeckDoors(); + + TIGL_EXPORT virtual CPACSCabinGeometry& GetCabinGeometry(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveCabinGeometry(); + + TIGL_EXPORT virtual CPACSSeatModules& GetSeatModules(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveSeatModules(); + + TIGL_EXPORT virtual CPACSCabinAisles& GetAisles(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveAisles(); + + TIGL_EXPORT virtual CPACSCabinSpaces& GetSpaces(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveSpaces(); + + TIGL_EXPORT virtual CPACSSidewallPanels& GetSidewallPanels(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveSidewallPanels(); + + TIGL_EXPORT virtual CPACSLuggageCompartments& GetLuggageCompartments(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveLuggageCompartments(); + + TIGL_EXPORT virtual CPACSCeilingPanels& GetCeilingPanels(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveCeilingPanels(); + + TIGL_EXPORT virtual CPACSGalleys& GetGalleys(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveGalleys(); + + TIGL_EXPORT virtual CPACSGenericFloorModules& GetGenericFloorModules(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveGenericFloorModules(); + + TIGL_EXPORT virtual CPACSLavatories& GetLavatories(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveLavatories(); + + TIGL_EXPORT virtual CPACSClassDividers& GetClassDividers(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveClassDividers(); + + TIGL_EXPORT virtual CPACSCargoContainers& GetCargoContainers(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveCargoContainers(); + + TIGL_EXPORT virtual CPACSDeckDoors& GetDeckDoors(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveDeckDoors(); + + protected: + CPACSDecks* m_parent; + + CTiglUIDManager* m_uidMgr; + + std::string m_uID; + + /// Name + std::string m_name; + + /// Description + boost::optional m_description; + + /// UID of the object used as parent coordinate system (typically the fuselage uID) + boost::optional m_parentUID; + + /// UID of the floor structure which supports this deck + boost::optional m_floorStructureUID; + + /// The reference point of the deck/cabin. In a + /// conventional aircraft like the A320, it would be the rear wall + /// of the cockpit. The transformation is relative to the parent object + /// defined by “parentUID”, which should be the fuselage. + CCPACSTransformation m_transformation; + + /// Deck type: passanger, VIP, cargo or livestock + CPACSDeck_deckType m_deckType; + + boost::optional m_cabinGeometry; + + /// Seat modules + boost::optional m_seatModules; + + /// Aisles + boost::optional m_aisles; + + /// Spaces + boost::optional m_spaces; + + /// Sidewall panels + boost::optional m_sidewallPanels; + + /// Luggage compartments + boost::optional m_luggageCompartments; + + /// Ceiling panels + boost::optional m_ceilingPanels; + + /// Galleys + boost::optional m_galleys; + + /// Generic floor modules + boost::optional m_genericFloorModules; + + /// Lavatories + boost::optional m_lavatories; + + /// Class dividers + boost::optional m_classDividers; + + /// Cargo containers + boost::optional m_cargoContainers; + + /// Doors + boost::optional m_deckDoors; + + private: + TIGL_EXPORT const CTiglUIDObject* GetNextUIDObject() const final; + TIGL_EXPORT void NotifyUIDChange(const std::string& oldUid, const std::string& newUid) final; + + CPACSDeck(const CPACSDeck&) = delete; + CPACSDeck& operator=(const CPACSDeck&) = delete; + + CPACSDeck(CPACSDeck&&) = delete; + CPACSDeck& operator=(CPACSDeck&&) = delete; + }; +} // namespace generated + +// CPACSDeck is customized, use type CCPACSDeck directly + +// Aliases in tigl namespace +using CCPACSDecks = generated::CPACSDecks; +} // namespace tigl diff --git a/src/generated/CPACSDeckComponent2DBase.h b/src/generated/CPACSDeckComponent2DBase.h deleted file mode 100644 index c6b7ea9b6f..0000000000 --- a/src/generated/CPACSDeckComponent2DBase.h +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include -#include -#include -#include -#include "CPACSDeckStructuralMounts.h" -#include "CPACSTransformation2D.h" -#include "CreateIfNotExists.h" -#include "CTiglUIDObject.h" -#include "ITiglUIDRefObject.h" -#include "tigl_internal.h" - -namespace tigl -{ -class CTiglUIDManager; - -namespace generated -{ - class CPACSSeatModules; - - // This class is used in: - // CPACSSeatModules - - /// @brief Deck component - /// - /// - class CPACSDeckComponent2DBase : public CTiglReqUIDObject, public ITiglUIDRefObject - { - public: - TIGL_EXPORT CPACSDeckComponent2DBase(CPACSSeatModules* parent, CTiglUIDManager* uidMgr); - - TIGL_EXPORT virtual ~CPACSDeckComponent2DBase(); - - TIGL_EXPORT CPACSSeatModules* GetParent(); - - TIGL_EXPORT const CPACSSeatModules* GetParent() const; - - TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); - TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; - - TIGL_EXPORT CTiglUIDManager& GetUIDManager(); - TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; - - TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); - TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - - TIGL_EXPORT virtual const std::string& GetUID() const; - TIGL_EXPORT virtual void SetUID(const std::string& value); - - TIGL_EXPORT virtual const std::string& GetName() const; - TIGL_EXPORT virtual void SetName(const std::string& value); - - TIGL_EXPORT virtual const boost::optional& GetDescription() const; - TIGL_EXPORT virtual void SetDescription(const boost::optional& value); - - TIGL_EXPORT virtual const std::string& GetDeckElementUID() const; - TIGL_EXPORT virtual void SetDeckElementUID(const std::string& value); - - TIGL_EXPORT virtual const boost::optional& GetStructuralMounts() const; - TIGL_EXPORT virtual boost::optional& GetStructuralMounts(); - - TIGL_EXPORT virtual const boost::optional& GetTransformation() const; - TIGL_EXPORT virtual boost::optional& GetTransformation(); - - TIGL_EXPORT virtual CPACSDeckStructuralMounts& GetStructuralMounts(CreateIfNotExistsTag); - TIGL_EXPORT virtual void RemoveStructuralMounts(); - - TIGL_EXPORT virtual CPACSTransformation2D& GetTransformation(CreateIfNotExistsTag); - TIGL_EXPORT virtual void RemoveTransformation(); - - protected: - CPACSSeatModules* m_parent; - - CTiglUIDManager* m_uidMgr; - - std::string m_uID; - - /// Name - std::string m_name; - - /// Description - boost::optional m_description; - - /// UID of the corresponding element in the cpacs/vehicles/deckElemets node - std::string m_deckElementUID; - - boost::optional m_structuralMounts; - - boost::optional m_transformation; - - private: - TIGL_EXPORT const CTiglUIDObject* GetNextUIDObject() const final; - TIGL_EXPORT void NotifyUIDChange(const std::string& oldUid, const std::string& newUid) final; - - CPACSDeckComponent2DBase(const CPACSDeckComponent2DBase&) = delete; - CPACSDeckComponent2DBase& operator=(const CPACSDeckComponent2DBase&) = delete; - - CPACSDeckComponent2DBase(CPACSDeckComponent2DBase&&) = delete; - CPACSDeckComponent2DBase& operator=(CPACSDeckComponent2DBase&&) = delete; - }; -} // namespace generated - -// Aliases in tigl namespace -using CCPACSDeckComponent2DBase = generated::CPACSDeckComponent2DBase; -using CCPACSSeatModules = generated::CPACSSeatModules; -} // namespace tigl diff --git a/src/generated/CPACSDeckComponent2DBase.cpp b/src/generated/CPACSDeckComponentBase.cpp similarity index 52% rename from src/generated/CPACSDeckComponent2DBase.cpp rename to src/generated/CPACSDeckComponentBase.cpp index c74f648e8a..bf3cf0faec 100644 --- a/src/generated/CPACSDeckComponent2DBase.cpp +++ b/src/generated/CPACSDeckComponentBase.cpp @@ -16,8 +16,16 @@ // limitations under the License. #include -#include "CPACSDeckComponent2DBase.h" +#include "CPACSCargoContainers.h" +#include "CPACSCeilingPanels.h" +#include "CPACSClassDividers.h" +#include "CPACSDeckComponentBase.h" +#include "CPACSGalleys.h" +#include "CPACSGenericFloorModules.h" +#include "CPACSLavatories.h" +#include "CPACSLuggageCompartments.h" #include "CPACSSeatModules.h" +#include "CPACSSidewallPanels.h" #include "CTiglError.h" #include "CTiglLogging.h" #include "CTiglUIDManager.h" @@ -27,48 +35,155 @@ namespace tigl { namespace generated { - CPACSDeckComponent2DBase::CPACSDeckComponent2DBase(CPACSSeatModules* parent, CTiglUIDManager* uidMgr) + CPACSDeckComponentBase::CPACSDeckComponentBase(CPACSCargoContainers* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) { //assert(parent != NULL); m_parent = parent; + m_parentType = &typeid(CPACSCargoContainers); } - CPACSDeckComponent2DBase::~CPACSDeckComponent2DBase() + CPACSDeckComponentBase::CPACSDeckComponentBase(CPACSCeilingPanels* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) { - if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); - if (m_uidMgr) { - if (!m_deckElementUID.empty()) m_uidMgr->TryUnregisterReference(m_deckElementUID, *this); - } + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSCeilingPanels); + } + + CPACSDeckComponentBase::CPACSDeckComponentBase(CPACSClassDividers* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSClassDividers); + } + + CPACSDeckComponentBase::CPACSDeckComponentBase(CPACSGalleys* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSGalleys); + } + + CPACSDeckComponentBase::CPACSDeckComponentBase(CPACSGenericFloorModules* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSGenericFloorModules); + } + + CPACSDeckComponentBase::CPACSDeckComponentBase(CPACSLavatories* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSLavatories); + } + + CPACSDeckComponentBase::CPACSDeckComponentBase(CPACSLuggageCompartments* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSLuggageCompartments); } - const CPACSSeatModules* CPACSDeckComponent2DBase::GetParent() const + CPACSDeckComponentBase::CPACSDeckComponentBase(CPACSSeatModules* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) { - return m_parent; + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSSeatModules); } - CPACSSeatModules* CPACSDeckComponent2DBase::GetParent() + CPACSDeckComponentBase::CPACSDeckComponentBase(CPACSSidewallPanels* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) { - return m_parent; + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSSidewallPanels); } - const CTiglUIDObject* CPACSDeckComponent2DBase::GetNextUIDParent() const + CPACSDeckComponentBase::~CPACSDeckComponentBase() + { + if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); + if (m_uidMgr) { + if (!m_deckElementUID.empty()) m_uidMgr->TryUnregisterReference(m_deckElementUID, *this); + } + } + + const CTiglUIDObject* CPACSDeckComponentBase::GetNextUIDParent() const { if (m_parent) { - return m_parent->GetNextUIDParent(); + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } } return nullptr; } - CTiglUIDObject* CPACSDeckComponent2DBase::GetNextUIDParent() + CTiglUIDObject* CPACSDeckComponentBase::GetNextUIDParent() { if (m_parent) { - return m_parent->GetNextUIDParent(); + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } } return nullptr; } - CTiglUIDManager& CPACSDeckComponent2DBase::GetUIDManager() + CTiglUIDManager& CPACSDeckComponentBase::GetUIDManager() { if (!m_uidMgr) { throw CTiglError("UIDManager is null"); @@ -76,7 +191,7 @@ namespace generated return *m_uidMgr; } - const CTiglUIDManager& CPACSDeckComponent2DBase::GetUIDManager() const + const CTiglUIDManager& CPACSDeckComponentBase::GetUIDManager() const { if (!m_uidMgr) { throw CTiglError("UIDManager is null"); @@ -84,7 +199,7 @@ namespace generated return *m_uidMgr; } - void CPACSDeckComponent2DBase::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + void CPACSDeckComponentBase::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { // read attribute uID if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { @@ -130,7 +245,7 @@ namespace generated // read element structuralMounts if (tixi::TixiCheckElement(tixiHandle, xpath + "/structuralMounts")) { - m_structuralMounts = boost::in_place(this, m_uidMgr); + m_structuralMounts = boost::in_place(reinterpret_cast(this), m_uidMgr); try { m_structuralMounts->ReadCPACS(tixiHandle, xpath + "/structuralMounts"); } catch(const std::exception& e) { @@ -141,7 +256,7 @@ namespace generated // read element transformation if (tixi::TixiCheckElement(tixiHandle, xpath + "/transformation")) { - m_transformation = boost::in_place(this, m_uidMgr); + m_transformation = boost::in_place(reinterpret_cast(this), m_uidMgr); try { m_transformation->ReadCPACS(tixiHandle, xpath + "/transformation"); } catch(const std::exception& e) { @@ -153,7 +268,7 @@ namespace generated if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); } - void CPACSDeckComponent2DBase::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + void CPACSDeckComponentBase::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const { // write attribute uID tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); @@ -201,12 +316,12 @@ namespace generated } - const std::string& CPACSDeckComponent2DBase::GetUID() const + const std::string& CPACSDeckComponentBase::GetUID() const { return m_uID; } - void CPACSDeckComponent2DBase::SetUID(const std::string& value) + void CPACSDeckComponentBase::SetUID(const std::string& value) { if (m_uidMgr && value != m_uID) { if (m_uID.empty()) { @@ -219,32 +334,32 @@ namespace generated m_uID = value; } - const std::string& CPACSDeckComponent2DBase::GetName() const + const std::string& CPACSDeckComponentBase::GetName() const { return m_name; } - void CPACSDeckComponent2DBase::SetName(const std::string& value) + void CPACSDeckComponentBase::SetName(const std::string& value) { m_name = value; } - const boost::optional& CPACSDeckComponent2DBase::GetDescription() const + const boost::optional& CPACSDeckComponentBase::GetDescription() const { return m_description; } - void CPACSDeckComponent2DBase::SetDescription(const boost::optional& value) + void CPACSDeckComponentBase::SetDescription(const boost::optional& value) { m_description = value; } - const std::string& CPACSDeckComponent2DBase::GetDeckElementUID() const + const std::string& CPACSDeckComponentBase::GetDeckElementUID() const { return m_deckElementUID; } - void CPACSDeckComponent2DBase::SetDeckElementUID(const std::string& value) + void CPACSDeckComponentBase::SetDeckElementUID(const std::string& value) { if (m_uidMgr) { if (!m_deckElementUID.empty()) m_uidMgr->TryUnregisterReference(m_deckElementUID, *this); @@ -253,56 +368,56 @@ namespace generated m_deckElementUID = value; } - const boost::optional& CPACSDeckComponent2DBase::GetStructuralMounts() const + const boost::optional& CPACSDeckComponentBase::GetStructuralMounts() const { return m_structuralMounts; } - boost::optional& CPACSDeckComponent2DBase::GetStructuralMounts() + boost::optional& CPACSDeckComponentBase::GetStructuralMounts() { return m_structuralMounts; } - const boost::optional& CPACSDeckComponent2DBase::GetTransformation() const + const boost::optional& CPACSDeckComponentBase::GetTransformation() const { return m_transformation; } - boost::optional& CPACSDeckComponent2DBase::GetTransformation() + boost::optional& CPACSDeckComponentBase::GetTransformation() { return m_transformation; } - CPACSDeckStructuralMounts& CPACSDeckComponent2DBase::GetStructuralMounts(CreateIfNotExistsTag) + CPACSDeckStructuralMounts& CPACSDeckComponentBase::GetStructuralMounts(CreateIfNotExistsTag) { if (!m_structuralMounts) - m_structuralMounts = boost::in_place(this, m_uidMgr); + m_structuralMounts = boost::in_place(reinterpret_cast(this), m_uidMgr); return *m_structuralMounts; } - void CPACSDeckComponent2DBase::RemoveStructuralMounts() + void CPACSDeckComponentBase::RemoveStructuralMounts() { m_structuralMounts = boost::none; } - CPACSTransformation2D& CPACSDeckComponent2DBase::GetTransformation(CreateIfNotExistsTag) + CCPACSTransformation& CPACSDeckComponentBase::GetTransformation(CreateIfNotExistsTag) { if (!m_transformation) - m_transformation = boost::in_place(this, m_uidMgr); + m_transformation = boost::in_place(reinterpret_cast(this), m_uidMgr); return *m_transformation; } - void CPACSDeckComponent2DBase::RemoveTransformation() + void CPACSDeckComponentBase::RemoveTransformation() { m_transformation = boost::none; } - const CTiglUIDObject* CPACSDeckComponent2DBase::GetNextUIDObject() const + const CTiglUIDObject* CPACSDeckComponentBase::GetNextUIDObject() const { return this; } - void CPACSDeckComponent2DBase::NotifyUIDChange(const std::string& oldUid, const std::string& newUid) + void CPACSDeckComponentBase::NotifyUIDChange(const std::string& oldUid, const std::string& newUid) { if (m_deckElementUID == oldUid) { m_deckElementUID = newUid; diff --git a/src/generated/CPACSDeckComponentBase.h b/src/generated/CPACSDeckComponentBase.h new file mode 100644 index 0000000000..4e01d2da0f --- /dev/null +++ b/src/generated/CPACSDeckComponentBase.h @@ -0,0 +1,182 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include +#include +#include "CPACSDeckStructuralMounts.h" +#include "CreateIfNotExists.h" +#include "CTiglError.h" +#include "CTiglUIDObject.h" +#include "ITiglUIDRefObject.h" +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; + +namespace generated +{ + class CPACSCargoContainers; + class CPACSCeilingPanels; + class CPACSClassDividers; + class CPACSGalleys; + class CPACSGenericFloorModules; + class CPACSLavatories; + class CPACSLuggageCompartments; + class CPACSSeatModules; + class CPACSSidewallPanels; + + // This class is used in: + // CPACSCargoContainers + // CPACSCeilingPanels + // CPACSClassDividers + // CPACSGalleys + // CPACSGenericFloorModules + // CPACSLavatories + // CPACSLuggageCompartments + // CPACSSeatModules + // CPACSSidewallPanels + + /// @brief Deck component + /// + /// + class CPACSDeckComponentBase : public CTiglReqUIDObject, public ITiglUIDRefObject + { + public: + TIGL_EXPORT CPACSDeckComponentBase(CPACSCargoContainers* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSDeckComponentBase(CPACSCeilingPanels* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSDeckComponentBase(CPACSClassDividers* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSDeckComponentBase(CPACSGalleys* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSDeckComponentBase(CPACSGenericFloorModules* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSDeckComponentBase(CPACSLavatories* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSDeckComponentBase(CPACSLuggageCompartments* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSDeckComponentBase(CPACSSeatModules* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSDeckComponentBase(CPACSSidewallPanels* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSDeckComponentBase(); + + template + bool IsParent() const + { + return m_parentType != NULL && *m_parentType == typeid(P); + } + + template + P* GetParent() + { + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSDeckComponentBase"); + if (!IsParent

()) { + throw CTiglError("bad parent"); + } + return static_cast(m_parent); + } + + template + const P* GetParent() const + { + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSDeckComponentBase"); + if (!IsParent

()) { + throw CTiglError("bad parent"); + } + return static_cast(m_parent); + } + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::string& GetUID() const; + TIGL_EXPORT virtual void SetUID(const std::string& value); + + TIGL_EXPORT virtual const std::string& GetName() const; + TIGL_EXPORT virtual void SetName(const std::string& value); + + TIGL_EXPORT virtual const boost::optional& GetDescription() const; + TIGL_EXPORT virtual void SetDescription(const boost::optional& value); + + TIGL_EXPORT virtual const std::string& GetDeckElementUID() const; + TIGL_EXPORT virtual void SetDeckElementUID(const std::string& value); + + TIGL_EXPORT virtual const boost::optional& GetStructuralMounts() const; + TIGL_EXPORT virtual boost::optional& GetStructuralMounts(); + + TIGL_EXPORT virtual const boost::optional& GetTransformation() const; + TIGL_EXPORT virtual boost::optional& GetTransformation(); + + TIGL_EXPORT virtual CPACSDeckStructuralMounts& GetStructuralMounts(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveStructuralMounts(); + + TIGL_EXPORT virtual CCPACSTransformation& GetTransformation(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveTransformation(); + + protected: + void* m_parent; + const std::type_info* m_parentType; + + CTiglUIDManager* m_uidMgr; + + std::string m_uID; + + /// Name + std::string m_name; + + /// Description + boost::optional m_description; + + /// UID of the corresponding element in the cpacs/vehicles/deckElemets node + std::string m_deckElementUID; + + boost::optional m_structuralMounts; + + boost::optional m_transformation; + + private: + TIGL_EXPORT const CTiglUIDObject* GetNextUIDObject() const final; + TIGL_EXPORT void NotifyUIDChange(const std::string& oldUid, const std::string& newUid) final; + + CPACSDeckComponentBase(const CPACSDeckComponentBase&) = delete; + CPACSDeckComponentBase& operator=(const CPACSDeckComponentBase&) = delete; + + CPACSDeckComponentBase(CPACSDeckComponentBase&&) = delete; + CPACSDeckComponentBase& operator=(CPACSDeckComponentBase&&) = delete; + }; +} // namespace generated + +// CPACSDeckComponentBase is customized, use type CCPACSDeckComponentBase directly + +// Aliases in tigl namespace +using CCPACSCargoContainers = generated::CPACSCargoContainers; +using CCPACSCeilingPanels = generated::CPACSCeilingPanels; +using CCPACSClassDividers = generated::CPACSClassDividers; +using CCPACSGalleys = generated::CPACSGalleys; +using CCPACSGenericFloorModules = generated::CPACSGenericFloorModules; +using CCPACSLavatories = generated::CPACSLavatories; +using CCPACSLuggageCompartments = generated::CPACSLuggageCompartments; +using CCPACSSeatModules = generated::CPACSSeatModules; +using CCPACSSidewallPanels = generated::CPACSSidewallPanels; +} // namespace tigl diff --git a/src/generated/CPACSDeckDoor.cpp b/src/generated/CPACSDeckDoor.cpp new file mode 100644 index 0000000000..4e9648822e --- /dev/null +++ b/src/generated/CPACSDeckDoor.cpp @@ -0,0 +1,252 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CPACSDeckDoor.h" +#include "CPACSDeckDoors.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSDeckDoor::CPACSDeckDoor(CPACSDeckDoors* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_paxCapacity(0) + , m_opening(this, m_uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSDeckDoor::~CPACSDeckDoor() + { + if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); + } + + const CPACSDeckDoors* CPACSDeckDoor::GetParent() const + { + return m_parent; + } + + CPACSDeckDoors* CPACSDeckDoor::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSDeckDoor::GetNextUIDParent() const + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDObject* CPACSDeckDoor::GetNextUIDParent() + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDManager& CPACSDeckDoor::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSDeckDoor::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSDeckDoor::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read attribute uID + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { + m_uID = tixi::TixiGetAttribute(tixiHandle, xpath, "uID"); + if (m_uID.empty()) { + LOG(WARNING) << "Required attribute uID is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; + } + + // read element name + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { + m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); + if (m_name.empty()) { + LOG(WARNING) << "Required element name is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required element name is missing at xpath " << xpath; + } + + // read element description + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { + m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); + if (m_description->empty()) { + LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; + } + } + + // read element paxCapacity + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/paxCapacity")) { + m_paxCapacity = tixi::TixiGetElement(tixiHandle, xpath + "/paxCapacity"); + } + else { + LOG(ERROR) << "Required element paxCapacity is missing at xpath " << xpath; + } + + // read element opening + if (tixi::TixiCheckElement(tixiHandle, xpath + "/opening")) { + m_opening.ReadCPACS(tixiHandle, xpath + "/opening"); + } + else { + LOG(ERROR) << "Required element opening is missing at xpath " << xpath; + } + + // read element doorType + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/doorType")) { + m_doorType = stringToCPACSDeckDoor_doorType(tixi::TixiGetElement(tixiHandle, xpath + "/doorType")); + } + + if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); + } + + void CPACSDeckDoor::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write attribute uID + tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); + + // write element name + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); + tixi::TixiSaveElement(tixiHandle, xpath + "/name", m_name); + + // write element description + if (m_description) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/description"); + tixi::TixiSaveElement(tixiHandle, xpath + "/description", *m_description); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/description"); + } + } + + // write element paxCapacity + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/paxCapacity"); + tixi::TixiSaveElement(tixiHandle, xpath + "/paxCapacity", m_paxCapacity); + + // write element opening + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/opening"); + m_opening.WriteCPACS(tixiHandle, xpath + "/opening"); + + // write element doorType + if (m_doorType) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/doorType"); + tixi::TixiSaveElement(tixiHandle, xpath + "/doorType", CPACSDeckDoor_doorTypeToString(*m_doorType)); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/doorType")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/doorType"); + } + } + + } + + const std::string& CPACSDeckDoor::GetUID() const + { + return m_uID; + } + + void CPACSDeckDoor::SetUID(const std::string& value) + { + if (m_uidMgr && value != m_uID) { + if (m_uID.empty()) { + m_uidMgr->RegisterObject(value, *this); + } + else { + m_uidMgr->UpdateObjectUID(m_uID, value); + } + } + m_uID = value; + } + + const std::string& CPACSDeckDoor::GetName() const + { + return m_name; + } + + void CPACSDeckDoor::SetName(const std::string& value) + { + m_name = value; + } + + const boost::optional& CPACSDeckDoor::GetDescription() const + { + return m_description; + } + + void CPACSDeckDoor::SetDescription(const boost::optional& value) + { + m_description = value; + } + + const int& CPACSDeckDoor::GetPaxCapacity() const + { + return m_paxCapacity; + } + + void CPACSDeckDoor::SetPaxCapacity(const int& value) + { + m_paxCapacity = value; + } + + const CPACSDoorOpening& CPACSDeckDoor::GetOpening() const + { + return m_opening; + } + + CPACSDoorOpening& CPACSDeckDoor::GetOpening() + { + return m_opening; + } + + const boost::optional& CPACSDeckDoor::GetDoorType() const + { + return m_doorType; + } + + void CPACSDeckDoor::SetDoorType(const boost::optional& value) + { + m_doorType = value; + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSDeckDoor.h b/src/generated/CPACSDeckDoor.h new file mode 100644 index 0000000000..134419f3be --- /dev/null +++ b/src/generated/CPACSDeckDoor.h @@ -0,0 +1,123 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "CPACSDeckDoor_doorType.h" +#include "CPACSDoorOpening.h" +#include "CTiglUIDObject.h" +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; + +namespace generated +{ + class CPACSDeckDoors; + + // This class is used in: + // CPACSDeckDoors + + /// @brief Deck door + /// + /// doors describe all doors of the cabin. They are linked + /// to a structural door description. The cabin door is usually equal + /// in size to the door, but does not need to be. The structural door + /// might describe a wider cut-out, while the cabin door is primarily + /// intended for evacuation modeling and cabin layout. In order to + /// obtain a 3-dimensional door representation, the local cabin + /// geometry shall be used. + /// + class CPACSDeckDoor : public CTiglReqUIDObject + { + public: + TIGL_EXPORT CPACSDeckDoor(CPACSDeckDoors* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSDeckDoor(); + + TIGL_EXPORT CPACSDeckDoors* GetParent(); + + TIGL_EXPORT const CPACSDeckDoors* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::string& GetUID() const; + TIGL_EXPORT virtual void SetUID(const std::string& value); + + TIGL_EXPORT virtual const std::string& GetName() const; + TIGL_EXPORT virtual void SetName(const std::string& value); + + TIGL_EXPORT virtual const boost::optional& GetDescription() const; + TIGL_EXPORT virtual void SetDescription(const boost::optional& value); + + TIGL_EXPORT virtual const int& GetPaxCapacity() const; + TIGL_EXPORT virtual void SetPaxCapacity(const int& value); + + TIGL_EXPORT virtual const CPACSDoorOpening& GetOpening() const; + TIGL_EXPORT virtual CPACSDoorOpening& GetOpening(); + + TIGL_EXPORT virtual const boost::optional& GetDoorType() const; + TIGL_EXPORT virtual void SetDoorType(const boost::optional& value); + + protected: + CPACSDeckDoors* m_parent; + + CTiglUIDManager* m_uidMgr; + + std::string m_uID; + + /// Name + std::string m_name; + + /// Description + boost::optional m_description; + + /// Number of passengers this door adds to the + /// overall exit capacity limit of the aircraft. + int m_paxCapacity; + + /// Opening geometry of the door + CPACSDoorOpening m_opening; + + /// Door type (boarding, cargo, evacuation or service) + boost::optional m_doorType; + + private: + CPACSDeckDoor(const CPACSDeckDoor&) = delete; + CPACSDeckDoor& operator=(const CPACSDeckDoor&) = delete; + + CPACSDeckDoor(CPACSDeckDoor&&) = delete; + CPACSDeckDoor& operator=(CPACSDeckDoor&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSDeckDoor = generated::CPACSDeckDoor; +using CCPACSDeckDoors = generated::CPACSDeckDoors; +} // namespace tigl diff --git a/src/generated/CPACSDeckDoor_doorType.h b/src/generated/CPACSDeckDoor_doorType.h new file mode 100644 index 0000000000..3ce00d3992 --- /dev/null +++ b/src/generated/CPACSDeckDoor_doorType.h @@ -0,0 +1,64 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include + +#include "CTiglError.h" +#include "to_string.h" + +namespace tigl +{ +namespace generated +{ + // This enum is used in: + // CPACSDeckDoor + + enum CPACSDeckDoor_doorType + { + boarding, + CPACSDeckDoor_doorType_cargo, + evacuation, + CPACSDeckDoor_doorType_service + }; + + inline std::string CPACSDeckDoor_doorTypeToString(const CPACSDeckDoor_doorType& value) + { + switch(value) { + case boarding: return "boarding"; + case CPACSDeckDoor_doorType_cargo: return "cargo"; + case evacuation: return "evacuation"; + case CPACSDeckDoor_doorType_service: return "service"; + default: throw CTiglError("Invalid enum value \"" + std_to_string(static_cast(value)) + "\" for enum type CPACSDeckDoor_doorType"); + } + } + inline CPACSDeckDoor_doorType stringToCPACSDeckDoor_doorType(const std::string& value) + { + auto toLower = [](std::string str) { for (char& c : str) { c = std::tolower(c); } return str; }; + if (toLower(value) == "boarding") { return boarding; } + if (toLower(value) == "cargo") { return CPACSDeckDoor_doorType_cargo; } + if (toLower(value) == "evacuation") { return evacuation; } + if (toLower(value) == "service") { return CPACSDeckDoor_doorType_service; } + throw CTiglError("Invalid string value \"" + value + "\" for enum type CPACSDeckDoor_doorType"); + } +} // namespace generated + +// Aliases in tigl namespace +using ECPACSDeckDoor_doorType = generated::CPACSDeckDoor_doorType; +} // namespace tigl diff --git a/src/generated/CPACSDeckDoors.cpp b/src/generated/CPACSDeckDoors.cpp new file mode 100644 index 0000000000..355cc72802 --- /dev/null +++ b/src/generated/CPACSDeckDoors.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CCPACSDeck.h" +#include "CPACSDeckDoor.h" +#include "CPACSDeckDoors.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSDeckDoors::CPACSDeckDoors(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSDeckDoors::~CPACSDeckDoors() + { + } + + const CCPACSDeck* CPACSDeckDoors::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSDeckDoors::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSDeckDoors::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSDeckDoors::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSDeckDoors::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSDeckDoors::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSDeckDoors::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element deckDoor + if (tixi::TixiCheckElement(tixiHandle, xpath + "/deckDoor")) { + tixi::TixiReadElements(tixiHandle, xpath + "/deckDoor", m_deckDoors, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSDeckDoors::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element deckDoor + tixi::TixiSaveElements(tixiHandle, xpath + "/deckDoor", m_deckDoors); + + } + + const std::vector>& CPACSDeckDoors::GetDeckDoors() const + { + return m_deckDoors; + } + + std::vector>& CPACSDeckDoors::GetDeckDoors() + { + return m_deckDoors; + } + + size_t CPACSDeckDoors::GetDeckDoorCount() const + { + return m_deckDoors.size(); + } + + size_t CPACSDeckDoors::GetDeckDoorIndex(const std::string& UID) const + { + for (size_t i=0; i < GetDeckDoorCount(); i++) { + const std::string tmpUID(m_deckDoors[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSDeckDoors::GetDeckDoorIndex", TIGL_UID_ERROR); + } + + CPACSDeckDoor& CPACSDeckDoors::GetDeckDoor(size_t index) + { + if (index < 1 || index > GetDeckDoorCount()) { + throw CTiglError("Invalid index in std::vector>::GetDeckDoor", TIGL_INDEX_ERROR); + } + index--; + return *m_deckDoors[index]; + } + + const CPACSDeckDoor& CPACSDeckDoors::GetDeckDoor(size_t index) const + { + if (index < 1 || index > GetDeckDoorCount()) { + throw CTiglError("Invalid index in std::vector>::GetDeckDoor", TIGL_INDEX_ERROR); + } + index--; + return *m_deckDoors[index]; + } + + CPACSDeckDoor& CPACSDeckDoors::GetDeckDoor(const std::string& UID) + { + for (auto& elem : m_deckDoors ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSDeckDoors::GetDeckDoor. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CPACSDeckDoor& CPACSDeckDoors::GetDeckDoor(const std::string& UID) const + { + for (auto& elem : m_deckDoors ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSDeckDoors::GetDeckDoor. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CPACSDeckDoor& CPACSDeckDoors::AddDeckDoor() + { + m_deckDoors.push_back(std::make_unique(this, m_uidMgr)); + return *m_deckDoors.back(); + } + + void CPACSDeckDoors::RemoveDeckDoor(CPACSDeckDoor& ref) + { + for (std::size_t i = 0; i < m_deckDoors.size(); i++) { + if (m_deckDoors[i].get() == &ref) { + m_deckDoors.erase(m_deckDoors.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSDeckDoors.h b/src/generated/CPACSDeckDoors.h new file mode 100644 index 0000000000..e173dd4134 --- /dev/null +++ b/src/generated/CPACSDeckDoors.h @@ -0,0 +1,97 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeck; + +namespace generated +{ + class CPACSDeckDoor; + + // This class is used in: + // CPACSDeck + + /// @brief Deck doors + /// + /// + /// + class CPACSDeckDoors + { + public: + TIGL_EXPORT CPACSDeckDoors(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSDeckDoors(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetDeckDoors() const; + TIGL_EXPORT virtual std::vector>& GetDeckDoors(); + + TIGL_EXPORT virtual size_t GetDeckDoorCount() const; + TIGL_EXPORT virtual size_t GetDeckDoorIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CPACSDeckDoor& GetDeckDoor(size_t index) const; + TIGL_EXPORT virtual CPACSDeckDoor& GetDeckDoor(size_t index); + + TIGL_EXPORT virtual const CPACSDeckDoor& GetDeckDoor(const std::string& UID) const; + TIGL_EXPORT virtual CPACSDeckDoor& GetDeckDoor(const std::string& UID); + + TIGL_EXPORT virtual CPACSDeckDoor& AddDeckDoor(); + TIGL_EXPORT virtual void RemoveDeckDoor(CPACSDeckDoor& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + std::vector> m_deckDoors; + + private: + CPACSDeckDoors(const CPACSDeckDoors&) = delete; + CPACSDeckDoors& operator=(const CPACSDeckDoors&) = delete; + + CPACSDeckDoors(CPACSDeckDoors&&) = delete; + CPACSDeckDoors& operator=(CPACSDeckDoors&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSDeckDoors = generated::CPACSDeckDoors; +using CCPACSDeckDoor = generated::CPACSDeckDoor; +} // namespace tigl diff --git a/src/generated/CPACSDeckElementBase.cpp b/src/generated/CPACSDeckElementBase.cpp deleted file mode 100644 index 1c8567d4b5..0000000000 --- a/src/generated/CPACSDeckElementBase.cpp +++ /dev/null @@ -1,297 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include "CPACSCeilingPanelElements.h" -#include "CPACSClassDividerElements.h" -#include "CPACSDeckElementBase.h" -#include "CPACSGenericFloorElements.h" -#include "CPACSLavatoryElements.h" -#include "CPACSLuggageCompartmentElements.h" -#include "CPACSSidewallPanelElements.h" -#include "CTiglError.h" -#include "CTiglLogging.h" -#include "CTiglUIDManager.h" -#include "TixiHelper.h" - -namespace tigl -{ -namespace generated -{ - CPACSDeckElementBase::CPACSDeckElementBase(CPACSCeilingPanelElements* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_geometry(this, m_uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSCeilingPanelElements); - } - - CPACSDeckElementBase::CPACSDeckElementBase(CPACSClassDividerElements* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_geometry(this, m_uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSClassDividerElements); - } - - CPACSDeckElementBase::CPACSDeckElementBase(CPACSGenericFloorElements* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_geometry(this, m_uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSGenericFloorElements); - } - - CPACSDeckElementBase::CPACSDeckElementBase(CPACSLavatoryElements* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_geometry(this, m_uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSLavatoryElements); - } - - CPACSDeckElementBase::CPACSDeckElementBase(CPACSLuggageCompartmentElements* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_geometry(this, m_uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSLuggageCompartmentElements); - } - - CPACSDeckElementBase::CPACSDeckElementBase(CPACSSidewallPanelElements* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_geometry(this, m_uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSSidewallPanelElements); - } - - CPACSDeckElementBase::~CPACSDeckElementBase() - { - if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); - } - - const CTiglUIDObject* CPACSDeckElementBase::GetNextUIDParent() const - { - if (m_parent) { - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - } - return nullptr; - } - - CTiglUIDObject* CPACSDeckElementBase::GetNextUIDParent() - { - if (m_parent) { - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } - } - return nullptr; - } - - CTiglUIDManager& CPACSDeckElementBase::GetUIDManager() - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - const CTiglUIDManager& CPACSDeckElementBase::GetUIDManager() const - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - void CPACSDeckElementBase::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) - { - // read attribute uID - if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { - m_uID = tixi::TixiGetAttribute(tixiHandle, xpath, "uID"); - if (m_uID.empty()) { - LOG(WARNING) << "Required attribute uID is empty at xpath " << xpath; - } - } - else { - LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; - } - - // read element description - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { - m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); - if (m_description->empty()) { - LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; - } - } - - // read element geometry - if (tixi::TixiCheckElement(tixiHandle, xpath + "/geometry")) { - m_geometry.ReadCPACS(tixiHandle, xpath + "/geometry"); - } - else { - LOG(ERROR) << "Required element geometry is missing at xpath " << xpath; - } - - // read element mass - if (tixi::TixiCheckElement(tixiHandle, xpath + "/mass")) { - m_mass = boost::in_place(this, m_uidMgr); - try { - m_mass->ReadCPACS(tixiHandle, xpath + "/mass"); - } catch(const std::exception& e) { - LOG(ERROR) << "Failed to read mass at xpath " << xpath << ": " << e.what(); - m_mass = boost::none; - } - } - - if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); - } - - void CPACSDeckElementBase::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const - { - // write attribute uID - tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); - - // write element description - if (m_description) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/description"); - tixi::TixiSaveElement(tixiHandle, xpath + "/description", *m_description); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/description"); - } - } - - // write element geometry - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/geometry"); - m_geometry.WriteCPACS(tixiHandle, xpath + "/geometry"); - - // write element mass - if (m_mass) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/mass"); - m_mass->WriteCPACS(tixiHandle, xpath + "/mass"); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/mass")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/mass"); - } - } - - } - - const std::string& CPACSDeckElementBase::GetUID() const - { - return m_uID; - } - - void CPACSDeckElementBase::SetUID(const std::string& value) - { - if (m_uidMgr && value != m_uID) { - if (m_uID.empty()) { - m_uidMgr->RegisterObject(value, *this); - } - else { - m_uidMgr->UpdateObjectUID(m_uID, value); - } - } - m_uID = value; - } - - const boost::optional& CPACSDeckElementBase::GetDescription() const - { - return m_description; - } - - void CPACSDeckElementBase::SetDescription(const boost::optional& value) - { - m_description = value; - } - - const CPACSDeckElementGeometry& CPACSDeckElementBase::GetGeometry() const - { - return m_geometry; - } - - CPACSDeckElementGeometry& CPACSDeckElementBase::GetGeometry() - { - return m_geometry; - } - - const boost::optional& CPACSDeckElementBase::GetMass() const - { - return m_mass; - } - - boost::optional& CPACSDeckElementBase::GetMass() - { - return m_mass; - } - - CPACSDeckElementMass& CPACSDeckElementBase::GetMass(CreateIfNotExistsTag) - { - if (!m_mass) - m_mass = boost::in_place(this, m_uidMgr); - return *m_mass; - } - - void CPACSDeckElementBase::RemoveMass() - { - m_mass = boost::none; - } - -} // namespace generated -} // namespace tigl diff --git a/src/generated/CPACSDeckElementBase.h b/src/generated/CPACSDeckElementBase.h deleted file mode 100644 index 858f8d94ff..0000000000 --- a/src/generated/CPACSDeckElementBase.h +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include -#include -#include -#include -#include -#include "CPACSDeckElementGeometry.h" -#include "CPACSDeckElementMass.h" -#include "CreateIfNotExists.h" -#include "CTiglError.h" -#include "CTiglUIDObject.h" -#include "tigl_internal.h" - -namespace tigl -{ -class CTiglUIDManager; - -namespace generated -{ - class CPACSCeilingPanelElements; - class CPACSClassDividerElements; - class CPACSGenericFloorElements; - class CPACSLavatoryElements; - class CPACSLuggageCompartmentElements; - class CPACSSidewallPanelElements; - - // This class is used in: - // CPACSCeilingPanelElements - // CPACSClassDividerElements - // CPACSGenericFloorElements - // CPACSLavatoryElements - // CPACSLuggageCompartmentElements - // CPACSSidewallPanelElements - - /// @brief Deck element - /// - /// - class CPACSDeckElementBase : public CTiglReqUIDObject - { - public: - TIGL_EXPORT CPACSDeckElementBase(CPACSCeilingPanelElements* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSDeckElementBase(CPACSClassDividerElements* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSDeckElementBase(CPACSGenericFloorElements* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSDeckElementBase(CPACSLavatoryElements* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSDeckElementBase(CPACSLuggageCompartmentElements* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSDeckElementBase(CPACSSidewallPanelElements* parent, CTiglUIDManager* uidMgr); - - TIGL_EXPORT virtual ~CPACSDeckElementBase(); - - template - bool IsParent() const - { - return m_parentType != NULL && *m_parentType == typeid(P); - } - - template - P* GetParent() - { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSDeckElementBase"); - if (!IsParent

()) { - throw CTiglError("bad parent"); - } - return static_cast(m_parent); - } - - template - const P* GetParent() const - { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSDeckElementBase"); - if (!IsParent

()) { - throw CTiglError("bad parent"); - } - return static_cast(m_parent); - } - - TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); - TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; - - TIGL_EXPORT CTiglUIDManager& GetUIDManager(); - TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; - - TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); - TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - - TIGL_EXPORT virtual const std::string& GetUID() const; - TIGL_EXPORT virtual void SetUID(const std::string& value); - - TIGL_EXPORT virtual const boost::optional& GetDescription() const; - TIGL_EXPORT virtual void SetDescription(const boost::optional& value); - - TIGL_EXPORT virtual const CPACSDeckElementGeometry& GetGeometry() const; - TIGL_EXPORT virtual CPACSDeckElementGeometry& GetGeometry(); - - TIGL_EXPORT virtual const boost::optional& GetMass() const; - TIGL_EXPORT virtual boost::optional& GetMass(); - - TIGL_EXPORT virtual CPACSDeckElementMass& GetMass(CreateIfNotExistsTag); - TIGL_EXPORT virtual void RemoveMass(); - - protected: - void* m_parent; - const std::type_info* m_parentType; - - CTiglUIDManager* m_uidMgr; - - std::string m_uID; - - /// Description - boost::optional m_description; - - CPACSDeckElementGeometry m_geometry; - - boost::optional m_mass; - - private: - CPACSDeckElementBase(const CPACSDeckElementBase&) = delete; - CPACSDeckElementBase& operator=(const CPACSDeckElementBase&) = delete; - - CPACSDeckElementBase(CPACSDeckElementBase&&) = delete; - CPACSDeckElementBase& operator=(CPACSDeckElementBase&&) = delete; - }; -} // namespace generated - -// Aliases in tigl namespace -using CCPACSDeckElementBase = generated::CPACSDeckElementBase; -using CCPACSCeilingPanelElements = generated::CPACSCeilingPanelElements; -using CCPACSClassDividerElements = generated::CPACSClassDividerElements; -using CCPACSGenericFloorElements = generated::CPACSGenericFloorElements; -using CCPACSLavatoryElements = generated::CPACSLavatoryElements; -using CCPACSLuggageCompartmentElements = generated::CPACSLuggageCompartmentElements; -using CCPACSSidewallPanelElements = generated::CPACSSidewallPanelElements; -} // namespace tigl diff --git a/src/generated/CPACSDeckElementGeometry.cpp b/src/generated/CPACSDeckElementGeometry.cpp deleted file mode 100644 index beb1223ab7..0000000000 --- a/src/generated/CPACSDeckElementGeometry.cpp +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include "CPACSDeckElementBase.h" -#include "CPACSDeckElementGeometry.h" -#include "CPACSGalleyElement.h" -#include "CPACSSeatElement.h" -#include "CTiglError.h" -#include "CTiglLogging.h" -#include "CTiglUIDManager.h" -#include "CTiglUIDObject.h" -#include "TixiHelper.h" - -namespace tigl -{ -namespace generated -{ - CPACSDeckElementGeometry::CPACSDeckElementGeometry(CPACSDeckElementBase* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSDeckElementBase); - } - - CPACSDeckElementGeometry::CPACSDeckElementGeometry(CPACSGalleyElement* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSGalleyElement); - } - - CPACSDeckElementGeometry::CPACSDeckElementGeometry(CPACSSeatElement* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSSeatElement); - } - - CPACSDeckElementGeometry::~CPACSDeckElementGeometry() - { - } - - const CTiglUIDObject* CPACSDeckElementGeometry::GetNextUIDParent() const - { - if (m_parent) { - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - } - return nullptr; - } - - CTiglUIDObject* CPACSDeckElementGeometry::GetNextUIDParent() - { - if (m_parent) { - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - } - return nullptr; - } - - CTiglUIDManager& CPACSDeckElementGeometry::GetUIDManager() - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - const CTiglUIDManager& CPACSDeckElementGeometry::GetUIDManager() const - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - void CPACSDeckElementGeometry::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) - { - // read element genericGeometryComponent - if (tixi::TixiCheckElement(tixiHandle, xpath + "/genericGeometryComponent")) { - m_genericGeometryComponent_choice1 = boost::in_place(this, m_uidMgr); - try { - m_genericGeometryComponent_choice1->ReadCPACS(tixiHandle, xpath + "/genericGeometryComponent"); - } catch(const std::exception& e) { - LOG(ERROR) << "Failed to read genericGeometryComponent at xpath " << xpath << ": " << e.what(); - m_genericGeometryComponent_choice1 = boost::none; - } - } - - // read element boundingBox - if (tixi::TixiCheckElement(tixiHandle, xpath + "/boundingBox")) { - m_boundingBox_choice2 = boost::in_place(this, m_uidMgr); - try { - m_boundingBox_choice2->ReadCPACS(tixiHandle, xpath + "/boundingBox"); - } catch(const std::exception& e) { - LOG(ERROR) << "Failed to read boundingBox at xpath " << xpath << ": " << e.what(); - m_boundingBox_choice2 = boost::none; - } - } - - if (!ValidateChoices()) { - LOG(ERROR) << "Invalid choice configuration at xpath " << xpath; - } - } - - void CPACSDeckElementGeometry::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const - { - // write element genericGeometryComponent - if (m_genericGeometryComponent_choice1) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/genericGeometryComponent"); - m_genericGeometryComponent_choice1->WriteCPACS(tixiHandle, xpath + "/genericGeometryComponent"); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/genericGeometryComponent")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/genericGeometryComponent"); - } - } - - // write element boundingBox - if (m_boundingBox_choice2) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/boundingBox"); - m_boundingBox_choice2->WriteCPACS(tixiHandle, xpath + "/boundingBox"); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/boundingBox")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/boundingBox"); - } - } - - } - - bool CPACSDeckElementGeometry::ValidateChoices() const - { - return - ( - ( - ( - // mandatory elements of this choice must be there - m_genericGeometryComponent_choice1.is_initialized() - && - // elements of other choices must not be there - !( - m_boundingBox_choice2.is_initialized() - ) - ) - + - ( - // mandatory elements of this choice must be there - m_boundingBox_choice2.is_initialized() - && - // elements of other choices must not be there - !( - m_genericGeometryComponent_choice1.is_initialized() - ) - ) - == 1 - ) - ) - ; - } - - const boost::optional& CPACSDeckElementGeometry::GetGenericGeometryComponent_choice1() const - { - return m_genericGeometryComponent_choice1; - } - - boost::optional& CPACSDeckElementGeometry::GetGenericGeometryComponent_choice1() - { - return m_genericGeometryComponent_choice1; - } - - const boost::optional& CPACSDeckElementGeometry::GetBoundingBox_choice2() const - { - return m_boundingBox_choice2; - } - - boost::optional& CPACSDeckElementGeometry::GetBoundingBox_choice2() - { - return m_boundingBox_choice2; - } - - CPACSGenericGeometryComponent& CPACSDeckElementGeometry::GetGenericGeometryComponent_choice1(CreateIfNotExistsTag) - { - if (!m_genericGeometryComponent_choice1) - m_genericGeometryComponent_choice1 = boost::in_place(this, m_uidMgr); - return *m_genericGeometryComponent_choice1; - } - - void CPACSDeckElementGeometry::RemoveGenericGeometryComponent_choice1() - { - m_genericGeometryComponent_choice1 = boost::none; - } - - CPACSBoundingBox& CPACSDeckElementGeometry::GetBoundingBox_choice2(CreateIfNotExistsTag) - { - if (!m_boundingBox_choice2) - m_boundingBox_choice2 = boost::in_place(this, m_uidMgr); - return *m_boundingBox_choice2; - } - - void CPACSDeckElementGeometry::RemoveBoundingBox_choice2() - { - m_boundingBox_choice2 = boost::none; - } - -} // namespace generated -} // namespace tigl diff --git a/src/generated/CPACSDeckElementGeometry.h b/src/generated/CPACSDeckElementGeometry.h deleted file mode 100644 index f9fdf92561..0000000000 --- a/src/generated/CPACSDeckElementGeometry.h +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include -#include -#include -#include -#include -#include "CPACSBoundingBox.h" -#include "CPACSGenericGeometryComponent.h" -#include "CreateIfNotExists.h" -#include "CTiglError.h" -#include "tigl_internal.h" - -namespace tigl -{ -class CTiglUIDManager; -class CTiglUIDObject; - -namespace generated -{ - class CPACSDeckElementBase; - class CPACSGalleyElement; - class CPACSSeatElement; - - // This class is used in: - // CPACSDeckElementBase - // CPACSGalleyElement - // CPACSSeatElement - - /// @brief Geometry - /// - /// Description of the deck element geometry. This might be either a bounding box definition or a link to a generic geometry component. - /// - class CPACSDeckElementGeometry - { - public: - TIGL_EXPORT CPACSDeckElementGeometry(CPACSDeckElementBase* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSDeckElementGeometry(CPACSGalleyElement* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSDeckElementGeometry(CPACSSeatElement* parent, CTiglUIDManager* uidMgr); - - TIGL_EXPORT virtual ~CPACSDeckElementGeometry(); - - template - bool IsParent() const - { - return m_parentType != NULL && *m_parentType == typeid(P); - } - - template - P* GetParent() - { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSDeckElementGeometry"); - if (!IsParent

()) { - throw CTiglError("bad parent"); - } - return static_cast(m_parent); - } - - template - const P* GetParent() const - { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSDeckElementGeometry"); - if (!IsParent

()) { - throw CTiglError("bad parent"); - } - return static_cast(m_parent); - } - - TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); - TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; - - TIGL_EXPORT CTiglUIDManager& GetUIDManager(); - TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; - - TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); - TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - - TIGL_EXPORT bool ValidateChoices() const; - - TIGL_EXPORT virtual const boost::optional& GetGenericGeometryComponent_choice1() const; - TIGL_EXPORT virtual boost::optional& GetGenericGeometryComponent_choice1(); - - TIGL_EXPORT virtual const boost::optional& GetBoundingBox_choice2() const; - TIGL_EXPORT virtual boost::optional& GetBoundingBox_choice2(); - - TIGL_EXPORT virtual CPACSGenericGeometryComponent& GetGenericGeometryComponent_choice1(CreateIfNotExistsTag); - TIGL_EXPORT virtual void RemoveGenericGeometryComponent_choice1(); - - TIGL_EXPORT virtual CPACSBoundingBox& GetBoundingBox_choice2(CreateIfNotExistsTag); - TIGL_EXPORT virtual void RemoveBoundingBox_choice2(); - - protected: - void* m_parent; - const std::type_info* m_parentType; - - CTiglUIDManager* m_uidMgr; - - boost::optional m_genericGeometryComponent_choice1; - boost::optional m_boundingBox_choice2; - - private: - CPACSDeckElementGeometry(const CPACSDeckElementGeometry&) = delete; - CPACSDeckElementGeometry& operator=(const CPACSDeckElementGeometry&) = delete; - - CPACSDeckElementGeometry(CPACSDeckElementGeometry&&) = delete; - CPACSDeckElementGeometry& operator=(CPACSDeckElementGeometry&&) = delete; - }; -} // namespace generated - -// Aliases in tigl namespace -using CCPACSDeckElementGeometry = generated::CPACSDeckElementGeometry; -using CCPACSDeckElementBase = generated::CPACSDeckElementBase; -using CCPACSGalleyElement = generated::CPACSGalleyElement; -using CCPACSSeatElement = generated::CPACSSeatElement; -} // namespace tigl diff --git a/src/generated/CPACSDeckElementMass.cpp b/src/generated/CPACSDeckElementMass.cpp deleted file mode 100644 index 031f06a7d4..0000000000 --- a/src/generated/CPACSDeckElementMass.cpp +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include "CPACSCargoContainerElement.h" -#include "CPACSDeckElementBase.h" -#include "CPACSDeckElementMass.h" -#include "CPACSGalleyElement.h" -#include "CPACSSeatElement.h" -#include "CTiglError.h" -#include "CTiglLogging.h" -#include "CTiglUIDManager.h" -#include "TixiHelper.h" - -namespace tigl -{ -namespace generated -{ - CPACSDeckElementMass::CPACSDeckElementMass(CPACSCargoContainerElement* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_mass(0) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSCargoContainerElement); - } - - CPACSDeckElementMass::CPACSDeckElementMass(CPACSDeckElementBase* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_mass(0) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSDeckElementBase); - } - - CPACSDeckElementMass::CPACSDeckElementMass(CPACSGalleyElement* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_mass(0) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSGalleyElement); - } - - CPACSDeckElementMass::CPACSDeckElementMass(CPACSSeatElement* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_mass(0) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSSeatElement); - } - - CPACSDeckElementMass::~CPACSDeckElementMass() - { - if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); - } - - const CTiglUIDObject* CPACSDeckElementMass::GetNextUIDParent() const - { - if (m_parent) { - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - } - return nullptr; - } - - CTiglUIDObject* CPACSDeckElementMass::GetNextUIDParent() - { - if (m_parent) { - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - } - return nullptr; - } - - CTiglUIDManager& CPACSDeckElementMass::GetUIDManager() - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - const CTiglUIDManager& CPACSDeckElementMass::GetUIDManager() const - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - void CPACSDeckElementMass::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) - { - // read attribute uID - if (tixi::TixiCheckAttribute(tixiHandle, xpath, "uID")) { - m_uID = tixi::TixiGetAttribute(tixiHandle, xpath, "uID"); - if (m_uID.empty()) { - LOG(WARNING) << "Required attribute uID is empty at xpath " << xpath; - } - } - else { - LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; - } - - // read element mass - if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/mass")) { - m_mass = tixi::TixiGetElement(tixiHandle, xpath + "/mass"); - } - else { - LOG(ERROR) << "Required element mass is missing at xpath " << xpath; - } - - // read element location - if (tixi::TixiCheckElement(tixiHandle, xpath + "/location")) { - m_location = boost::in_place(this, m_uidMgr); - try { - m_location->ReadCPACS(tixiHandle, xpath + "/location"); - } catch(const std::exception& e) { - LOG(ERROR) << "Failed to read location at xpath " << xpath << ": " << e.what(); - m_location = boost::none; - } - } - - // read element massInertia - if (tixi::TixiCheckElement(tixiHandle, xpath + "/massInertia")) { - m_massInertia = boost::in_place(this); - try { - m_massInertia->ReadCPACS(tixiHandle, xpath + "/massInertia"); - } catch(const std::exception& e) { - LOG(ERROR) << "Failed to read massInertia at xpath " << xpath << ": " << e.what(); - m_massInertia = boost::none; - } - } - - if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); - } - - void CPACSDeckElementMass::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const - { - // write attribute uID - tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); - - // write element mass - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/mass"); - tixi::TixiSaveElement(tixiHandle, xpath + "/mass", m_mass); - - // write element location - if (m_location) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/location"); - m_location->WriteCPACS(tixiHandle, xpath + "/location"); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/location")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/location"); - } - } - - // write element massInertia - if (m_massInertia) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/massInertia"); - m_massInertia->WriteCPACS(tixiHandle, xpath + "/massInertia"); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/massInertia")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/massInertia"); - } - } - - } - - const std::string& CPACSDeckElementMass::GetUID() const - { - return m_uID; - } - - void CPACSDeckElementMass::SetUID(const std::string& value) - { - if (m_uidMgr && value != m_uID) { - if (m_uID.empty()) { - m_uidMgr->RegisterObject(value, *this); - } - else { - m_uidMgr->UpdateObjectUID(m_uID, value); - } - } - m_uID = value; - } - - const double& CPACSDeckElementMass::GetMass() const - { - return m_mass; - } - - void CPACSDeckElementMass::SetMass(const double& value) - { - m_mass = value; - } - - const boost::optional& CPACSDeckElementMass::GetLocation() const - { - return m_location; - } - - boost::optional& CPACSDeckElementMass::GetLocation() - { - return m_location; - } - - const boost::optional& CPACSDeckElementMass::GetMassInertia() const - { - return m_massInertia; - } - - boost::optional& CPACSDeckElementMass::GetMassInertia() - { - return m_massInertia; - } - - CCPACSPoint& CPACSDeckElementMass::GetLocation(CreateIfNotExistsTag) - { - if (!m_location) - m_location = boost::in_place(this, m_uidMgr); - return *m_location; - } - - void CPACSDeckElementMass::RemoveLocation() - { - m_location = boost::none; - } - - CPACSMassInertia& CPACSDeckElementMass::GetMassInertia(CreateIfNotExistsTag) - { - if (!m_massInertia) - m_massInertia = boost::in_place(this); - return *m_massInertia; - } - - void CPACSDeckElementMass::RemoveMassInertia() - { - m_massInertia = boost::none; - } - -} // namespace generated -} // namespace tigl diff --git a/src/generated/CPACSDeckElementMass.h b/src/generated/CPACSDeckElementMass.h deleted file mode 100644 index c8c5da9032..0000000000 --- a/src/generated/CPACSDeckElementMass.h +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include -#include -#include -#include -#include -#include -#include "CPACSMassInertia.h" -#include "CreateIfNotExists.h" -#include "CTiglError.h" -#include "CTiglUIDObject.h" -#include "tigl_internal.h" - -namespace tigl -{ -class CTiglUIDManager; - -namespace generated -{ - class CPACSCargoContainerElement; - class CPACSDeckElementBase; - class CPACSGalleyElement; - class CPACSSeatElement; - - // This class is used in: - // CPACSCargoContainerElement - // CPACSDeckElementBase - // CPACSGalleyElement - // CPACSSeatElement - - /// @brief Mass - /// - /// Description of mass, center of gravity and inertia - /// - class CPACSDeckElementMass : public CTiglReqUIDObject - { - public: - TIGL_EXPORT CPACSDeckElementMass(CPACSCargoContainerElement* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSDeckElementMass(CPACSDeckElementBase* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSDeckElementMass(CPACSGalleyElement* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSDeckElementMass(CPACSSeatElement* parent, CTiglUIDManager* uidMgr); - - TIGL_EXPORT virtual ~CPACSDeckElementMass(); - - template - bool IsParent() const - { - return m_parentType != NULL && *m_parentType == typeid(P); - } - - template - P* GetParent() - { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSDeckElementMass"); - if (!IsParent

()) { - throw CTiglError("bad parent"); - } - return static_cast(m_parent); - } - - template - const P* GetParent() const - { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSDeckElementMass"); - if (!IsParent

()) { - throw CTiglError("bad parent"); - } - return static_cast(m_parent); - } - - TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); - TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; - - TIGL_EXPORT CTiglUIDManager& GetUIDManager(); - TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; - - TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); - TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - - TIGL_EXPORT virtual const std::string& GetUID() const; - TIGL_EXPORT virtual void SetUID(const std::string& value); - - TIGL_EXPORT virtual const double& GetMass() const; - TIGL_EXPORT virtual void SetMass(const double& value); - - TIGL_EXPORT virtual const boost::optional& GetLocation() const; - TIGL_EXPORT virtual boost::optional& GetLocation(); - - TIGL_EXPORT virtual const boost::optional& GetMassInertia() const; - TIGL_EXPORT virtual boost::optional& GetMassInertia(); - - TIGL_EXPORT virtual CCPACSPoint& GetLocation(CreateIfNotExistsTag); - TIGL_EXPORT virtual void RemoveLocation(); - - TIGL_EXPORT virtual CPACSMassInertia& GetMassInertia(CreateIfNotExistsTag); - TIGL_EXPORT virtual void RemoveMassInertia(); - - protected: - void* m_parent; - const std::type_info* m_parentType; - - CTiglUIDManager* m_uidMgr; - - std::string m_uID; - - /// Mass value - double m_mass; - - /// Center of gravity (x,y,z) - boost::optional m_location; - - boost::optional m_massInertia; - - private: - CPACSDeckElementMass(const CPACSDeckElementMass&) = delete; - CPACSDeckElementMass& operator=(const CPACSDeckElementMass&) = delete; - - CPACSDeckElementMass(CPACSDeckElementMass&&) = delete; - CPACSDeckElementMass& operator=(CPACSDeckElementMass&&) = delete; - }; -} // namespace generated - -// Aliases in tigl namespace -using CCPACSDeckElementMass = generated::CPACSDeckElementMass; -using CCPACSCargoContainerElement = generated::CPACSCargoContainerElement; -using CCPACSDeckElementBase = generated::CPACSDeckElementBase; -using CCPACSGalleyElement = generated::CPACSGalleyElement; -using CCPACSSeatElement = generated::CPACSSeatElement; -} // namespace tigl diff --git a/src/generated/CPACSDeckStructuralMounts.cpp b/src/generated/CPACSDeckStructuralMounts.cpp index da992990fe..a908e275a8 100644 --- a/src/generated/CPACSDeckStructuralMounts.cpp +++ b/src/generated/CPACSDeckStructuralMounts.cpp @@ -16,7 +16,7 @@ // limitations under the License. #include -#include "CPACSDeckComponent2DBase.h" +#include "CCPACSDeckComponentBase.h" #include "CPACSDeckStructuralMount.h" #include "CPACSDeckStructuralMounts.h" #include "CTiglError.h" @@ -29,7 +29,7 @@ namespace tigl { namespace generated { - CPACSDeckStructuralMounts::CPACSDeckStructuralMounts(CPACSDeckComponent2DBase* parent, CTiglUIDManager* uidMgr) + CPACSDeckStructuralMounts::CPACSDeckStructuralMounts(CCPACSDeckComponentBase* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) { //assert(parent != NULL); @@ -40,12 +40,12 @@ namespace generated { } - const CPACSDeckComponent2DBase* CPACSDeckStructuralMounts::GetParent() const + const CCPACSDeckComponentBase* CPACSDeckStructuralMounts::GetParent() const { return m_parent; } - CPACSDeckComponent2DBase* CPACSDeckStructuralMounts::GetParent() + CCPACSDeckComponentBase* CPACSDeckStructuralMounts::GetParent() { return m_parent; } diff --git a/src/generated/CPACSDeckStructuralMounts.h b/src/generated/CPACSDeckStructuralMounts.h index 1e1c90cbc5..a7faf9a1c9 100644 --- a/src/generated/CPACSDeckStructuralMounts.h +++ b/src/generated/CPACSDeckStructuralMounts.h @@ -27,14 +27,14 @@ namespace tigl { class CTiglUIDManager; class CTiglUIDObject; +class CCPACSDeckComponentBase; namespace generated { class CPACSDeckStructuralMount; - class CPACSDeckComponent2DBase; // This class is used in: - // CPACSDeckComponent2DBase + // CPACSDeckComponentBase /// @brief Structural mounts /// @@ -43,13 +43,13 @@ namespace generated class CPACSDeckStructuralMounts { public: - TIGL_EXPORT CPACSDeckStructuralMounts(CPACSDeckComponent2DBase* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSDeckStructuralMounts(CCPACSDeckComponentBase* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT virtual ~CPACSDeckStructuralMounts(); - TIGL_EXPORT CPACSDeckComponent2DBase* GetParent(); + TIGL_EXPORT CCPACSDeckComponentBase* GetParent(); - TIGL_EXPORT const CPACSDeckComponent2DBase* GetParent() const; + TIGL_EXPORT const CCPACSDeckComponentBase* GetParent() const; TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; @@ -76,7 +76,7 @@ namespace generated TIGL_EXPORT virtual void RemoveStructuralMount(CPACSDeckStructuralMount& ref); protected: - CPACSDeckComponent2DBase* m_parent; + CCPACSDeckComponentBase* m_parent; CTiglUIDManager* m_uidMgr; @@ -94,5 +94,4 @@ namespace generated // Aliases in tigl namespace using CCPACSDeckStructuralMounts = generated::CPACSDeckStructuralMounts; using CCPACSDeckStructuralMount = generated::CPACSDeckStructuralMount; -using CCPACSDeckComponent2DBase = generated::CPACSDeckComponent2DBase; } // namespace tigl diff --git a/src/generated/CPACSDeck_deckType.h b/src/generated/CPACSDeck_deckType.h new file mode 100644 index 0000000000..499fa425da --- /dev/null +++ b/src/generated/CPACSDeck_deckType.h @@ -0,0 +1,64 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include + +#include "CTiglError.h" +#include "to_string.h" + +namespace tigl +{ +namespace generated +{ + // This enum is used in: + // CPACSDeck + + enum CPACSDeck_deckType + { + passenger, + VIP, + cargo, + livestock + }; + + inline std::string CPACSDeck_deckTypeToString(const CPACSDeck_deckType& value) + { + switch(value) { + case passenger: return "passenger"; + case VIP: return "VIP"; + case cargo: return "cargo"; + case livestock: return "livestock"; + default: throw CTiglError("Invalid enum value \"" + std_to_string(static_cast(value)) + "\" for enum type CPACSDeck_deckType"); + } + } + inline CPACSDeck_deckType stringToCPACSDeck_deckType(const std::string& value) + { + auto toLower = [](std::string str) { for (char& c : str) { c = std::tolower(c); } return str; }; + if (toLower(value) == "passenger") { return passenger; } + if (toLower(value) == "vip") { return VIP; } + if (toLower(value) == "cargo") { return cargo; } + if (toLower(value) == "livestock") { return livestock; } + throw CTiglError("Invalid string value \"" + value + "\" for enum type CPACSDeck_deckType"); + } +} // namespace generated + +// Aliases in tigl namespace +using ECPACSDeck_deckType = generated::CPACSDeck_deckType; +} // namespace tigl diff --git a/src/generated/CPACSDecks.cpp b/src/generated/CPACSDecks.cpp new file mode 100644 index 0000000000..a3cb4bf9a5 --- /dev/null +++ b/src/generated/CPACSDecks.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "CCPACSFuselage.h" +#include "CPACSDecks.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSDecks::CPACSDecks(CCPACSFuselage* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSDecks::~CPACSDecks() + { + } + + const CCPACSFuselage* CPACSDecks::GetParent() const + { + return m_parent; + } + + CCPACSFuselage* CPACSDecks::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSDecks::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSDecks::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSDecks::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSDecks::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSDecks::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element deck + if (tixi::TixiCheckElement(tixiHandle, xpath + "/deck")) { + tixi::TixiReadElements(tixiHandle, xpath + "/deck", m_decks, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSDecks::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element deck + tixi::TixiSaveElements(tixiHandle, xpath + "/deck", m_decks); + + } + + const std::vector>& CPACSDecks::GetDecks() const + { + return m_decks; + } + + std::vector>& CPACSDecks::GetDecks() + { + return m_decks; + } + + size_t CPACSDecks::GetDeckCount() const + { + return m_decks.size(); + } + + size_t CPACSDecks::GetDeckIndex(const std::string& UID) const + { + for (size_t i=0; i < GetDeckCount(); i++) { + const std::string tmpUID(m_decks[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSDecks::GetDeckIndex", TIGL_UID_ERROR); + } + + CCPACSDeck& CPACSDecks::GetDeck(size_t index) + { + if (index < 1 || index > GetDeckCount()) { + throw CTiglError("Invalid index in std::vector>::GetDeck", TIGL_INDEX_ERROR); + } + index--; + return *m_decks[index]; + } + + const CCPACSDeck& CPACSDecks::GetDeck(size_t index) const + { + if (index < 1 || index > GetDeckCount()) { + throw CTiglError("Invalid index in std::vector>::GetDeck", TIGL_INDEX_ERROR); + } + index--; + return *m_decks[index]; + } + + CCPACSDeck& CPACSDecks::GetDeck(const std::string& UID) + { + for (auto& elem : m_decks ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSDecks::GetDeck. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CCPACSDeck& CPACSDecks::GetDeck(const std::string& UID) const + { + for (auto& elem : m_decks ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSDecks::GetDeck. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CCPACSDeck& CPACSDecks::AddDeck() + { + m_decks.push_back(std::make_unique(this, m_uidMgr)); + return *m_decks.back(); + } + + void CPACSDecks::RemoveDeck(CCPACSDeck& ref) + { + for (std::size_t i = 0; i < m_decks.size(); i++) { + if (m_decks[i].get() == &ref) { + m_decks.erase(m_decks.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSGenericGeometryComponent.h b/src/generated/CPACSDecks.h similarity index 52% rename from src/generated/CPACSGenericGeometryComponent.h rename to src/generated/CPACSDecks.h index 4a2b7903bd..5bcaa4803e 100644 --- a/src/generated/CPACSGenericGeometryComponent.h +++ b/src/generated/CPACSDecks.h @@ -17,38 +17,38 @@ #pragma once -#include +#include #include #include -#include "CPACSLinkToFile.h" +#include #include "tigl_internal.h" namespace tigl { class CTiglUIDManager; class CTiglUIDObject; +class CCPACSDeck; +class CCPACSFuselage; namespace generated { - class CPACSDeckElementGeometry; - // This class is used in: - // CPACSDeckElementGeometry + // CPACSFuselage - /// @brief Generic geometry component - /// + /// @brief Decks /// + /// List of decks /// - class CPACSGenericGeometryComponent + class CPACSDecks { public: - TIGL_EXPORT CPACSGenericGeometryComponent(CPACSDeckElementGeometry* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSDecks(CCPACSFuselage* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT virtual ~CPACSGenericGeometryComponent(); + TIGL_EXPORT virtual ~CPACSDecks(); - TIGL_EXPORT CPACSDeckElementGeometry* GetParent(); + TIGL_EXPORT CCPACSFuselage* GetParent(); - TIGL_EXPORT const CPACSDeckElementGeometry* GetParent() const; + TIGL_EXPORT const CCPACSFuselage* GetParent() const; TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; @@ -59,30 +59,37 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const CPACSLinkToFile& GetLinkToFile() const; - TIGL_EXPORT virtual CPACSLinkToFile& GetLinkToFile(); + TIGL_EXPORT virtual const std::vector>& GetDecks() const; + TIGL_EXPORT virtual std::vector>& GetDecks(); + + TIGL_EXPORT virtual size_t GetDeckCount() const; + TIGL_EXPORT virtual size_t GetDeckIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CCPACSDeck& GetDeck(size_t index) const; + TIGL_EXPORT virtual CCPACSDeck& GetDeck(size_t index); + + TIGL_EXPORT virtual const CCPACSDeck& GetDeck(const std::string& UID) const; + TIGL_EXPORT virtual CCPACSDeck& GetDeck(const std::string& UID); - TIGL_EXPORT virtual const CCPACSTransformation& GetTransformation() const; - TIGL_EXPORT virtual CCPACSTransformation& GetTransformation(); + TIGL_EXPORT virtual CCPACSDeck& AddDeck(); + TIGL_EXPORT virtual void RemoveDeck(CCPACSDeck& ref); protected: - CPACSDeckElementGeometry* m_parent; + CCPACSFuselage* m_parent; CTiglUIDManager* m_uidMgr; - CPACSLinkToFile m_linkToFile; - CCPACSTransformation m_transformation; + std::vector> m_decks; private: - CPACSGenericGeometryComponent(const CPACSGenericGeometryComponent&) = delete; - CPACSGenericGeometryComponent& operator=(const CPACSGenericGeometryComponent&) = delete; + CPACSDecks(const CPACSDecks&) = delete; + CPACSDecks& operator=(const CPACSDecks&) = delete; - CPACSGenericGeometryComponent(CPACSGenericGeometryComponent&&) = delete; - CPACSGenericGeometryComponent& operator=(CPACSGenericGeometryComponent&&) = delete; + CPACSDecks(CPACSDecks&&) = delete; + CPACSDecks& operator=(CPACSDecks&&) = delete; }; } // namespace generated // Aliases in tigl namespace -using CCPACSGenericGeometryComponent = generated::CPACSGenericGeometryComponent; -using CCPACSDeckElementGeometry = generated::CPACSDeckElementGeometry; +using CCPACSDecks = generated::CPACSDecks; } // namespace tigl diff --git a/src/generated/CPACSDoorAssemblyPosition_doorType.h b/src/generated/CPACSDoorAssemblyPosition_doorType.h index debe9b197b..d2df31fc50 100644 --- a/src/generated/CPACSDoorAssemblyPosition_doorType.h +++ b/src/generated/CPACSDoorAssemblyPosition_doorType.h @@ -35,7 +35,7 @@ namespace generated pax, service, emergency, - cargo + CPACSDoorAssemblyPosition_doorType_cargo }; inline std::string CPACSDoorAssemblyPosition_doorTypeToString(const CPACSDoorAssemblyPosition_doorType& value) @@ -44,7 +44,7 @@ namespace generated case pax: return "pax"; case service: return "service"; case emergency: return "emergency"; - case cargo: return "cargo"; + case CPACSDoorAssemblyPosition_doorType_cargo: return "cargo"; default: throw CTiglError("Invalid enum value \"" + std_to_string(static_cast(value)) + "\" for enum type CPACSDoorAssemblyPosition_doorType"); } } @@ -54,7 +54,7 @@ namespace generated if (toLower(value) == "pax") { return pax; } if (toLower(value) == "service") { return service; } if (toLower(value) == "emergency") { return emergency; } - if (toLower(value) == "cargo") { return cargo; } + if (toLower(value) == "cargo") { return CPACSDoorAssemblyPosition_doorType_cargo; } throw CTiglError("Invalid string value \"" + value + "\" for enum type CPACSDoorAssemblyPosition_doorType"); } } // namespace generated diff --git a/src/generated/CPACSDoorOpening.cpp b/src/generated/CPACSDoorOpening.cpp new file mode 100644 index 0000000000..29e7021bba --- /dev/null +++ b/src/generated/CPACSDoorOpening.cpp @@ -0,0 +1,213 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CPACSDeckDoor.h" +#include "CPACSDoorOpening.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSDoorOpening::CPACSDoorOpening(CPACSDeckDoor* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSDoorOpening::~CPACSDoorOpening() + { + if (m_uidMgr) { + if (m_cutOutUID_choice1 && !m_cutOutUID_choice1->empty()) m_uidMgr->TryUnregisterReference(*m_cutOutUID_choice1, *this); + } + } + + const CPACSDeckDoor* CPACSDoorOpening::GetParent() const + { + return m_parent; + } + + CPACSDeckDoor* CPACSDoorOpening::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSDoorOpening::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSDoorOpening::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSDoorOpening::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSDoorOpening::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSDoorOpening::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element cutOutUID + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/cutOutUID")) { + m_cutOutUID_choice1 = tixi::TixiGetElement(tixiHandle, xpath + "/cutOutUID"); + if (m_cutOutUID_choice1->empty()) { + LOG(WARNING) << "Optional element cutOutUID is present but empty at xpath " << xpath; + } + if (m_uidMgr && !m_cutOutUID_choice1->empty()) m_uidMgr->RegisterReference(*m_cutOutUID_choice1, *this); + } + + // read element doorOpeningLegacy + if (tixi::TixiCheckElement(tixiHandle, xpath + "/doorOpeningLegacy")) { + m_doorOpeningLegacy_choice2 = boost::in_place(this); + try { + m_doorOpeningLegacy_choice2->ReadCPACS(tixiHandle, xpath + "/doorOpeningLegacy"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read doorOpeningLegacy at xpath " << xpath << ": " << e.what(); + m_doorOpeningLegacy_choice2 = boost::none; + } + } + + if (!ValidateChoices()) { + LOG(ERROR) << "Invalid choice configuration at xpath " << xpath; + } + } + + void CPACSDoorOpening::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element cutOutUID + if (m_cutOutUID_choice1) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/cutOutUID"); + tixi::TixiSaveElement(tixiHandle, xpath + "/cutOutUID", *m_cutOutUID_choice1); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/cutOutUID")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/cutOutUID"); + } + } + + // write element doorOpeningLegacy + if (m_doorOpeningLegacy_choice2) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/doorOpeningLegacy"); + m_doorOpeningLegacy_choice2->WriteCPACS(tixiHandle, xpath + "/doorOpeningLegacy"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/doorOpeningLegacy")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/doorOpeningLegacy"); + } + } + + } + + bool CPACSDoorOpening::ValidateChoices() const + { + return + ( + ( + ( + // mandatory elements of this choice must be there + m_cutOutUID_choice1.is_initialized() + && + // elements of other choices must not be there + !( + m_doorOpeningLegacy_choice2.is_initialized() + ) + ) + + + ( + // mandatory elements of this choice must be there + m_doorOpeningLegacy_choice2.is_initialized() + && + // elements of other choices must not be there + !( + m_cutOutUID_choice1.is_initialized() + ) + ) + == 1 + ) + ) + ; + } + + const boost::optional& CPACSDoorOpening::GetCutOutUID_choice1() const + { + return m_cutOutUID_choice1; + } + + void CPACSDoorOpening::SetCutOutUID_choice1(const boost::optional& value) + { + if (m_uidMgr) { + if (m_cutOutUID_choice1 && !m_cutOutUID_choice1->empty()) m_uidMgr->TryUnregisterReference(*m_cutOutUID_choice1, *this); + if (value && !value->empty()) m_uidMgr->RegisterReference(*value, *this); + } + m_cutOutUID_choice1 = value; + } + + const boost::optional& CPACSDoorOpening::GetDoorOpeningLegacy_choice2() const + { + return m_doorOpeningLegacy_choice2; + } + + boost::optional& CPACSDoorOpening::GetDoorOpeningLegacy_choice2() + { + return m_doorOpeningLegacy_choice2; + } + + CPACSDoorOpeningLegacy& CPACSDoorOpening::GetDoorOpeningLegacy_choice2(CreateIfNotExistsTag) + { + if (!m_doorOpeningLegacy_choice2) + m_doorOpeningLegacy_choice2 = boost::in_place(this); + return *m_doorOpeningLegacy_choice2; + } + + void CPACSDoorOpening::RemoveDoorOpeningLegacy_choice2() + { + m_doorOpeningLegacy_choice2 = boost::none; + } + + const CTiglUIDObject* CPACSDoorOpening::GetNextUIDObject() const + { + return GetNextUIDParent(); + } + + void CPACSDoorOpening::NotifyUIDChange(const std::string& oldUid, const std::string& newUid) + { + if (m_cutOutUID_choice1 && *m_cutOutUID_choice1 == oldUid) { + m_cutOutUID_choice1 = newUid; + } + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSDoorOpening.h b/src/generated/CPACSDoorOpening.h new file mode 100644 index 0000000000..6839389ee5 --- /dev/null +++ b/src/generated/CPACSDoorOpening.h @@ -0,0 +1,99 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "CPACSDoorOpeningLegacy.h" +#include "CreateIfNotExists.h" +#include "ITiglUIDRefObject.h" +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; + +namespace generated +{ + class CPACSDeckDoor; + + // This class is used in: + // CPACSDeckDoor + + /// @brief "doorOpeningType" + /// + /// Ceiling panel instance collection type. + /// + class CPACSDoorOpening : public ITiglUIDRefObject + { + public: + TIGL_EXPORT CPACSDoorOpening(CPACSDeckDoor* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSDoorOpening(); + + TIGL_EXPORT CPACSDeckDoor* GetParent(); + + TIGL_EXPORT const CPACSDeckDoor* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT bool ValidateChoices() const; + + TIGL_EXPORT virtual const boost::optional& GetCutOutUID_choice1() const; + TIGL_EXPORT virtual void SetCutOutUID_choice1(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetDoorOpeningLegacy_choice2() const; + TIGL_EXPORT virtual boost::optional& GetDoorOpeningLegacy_choice2(); + + TIGL_EXPORT virtual CPACSDoorOpeningLegacy& GetDoorOpeningLegacy_choice2(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveDoorOpeningLegacy_choice2(); + + protected: + CPACSDeckDoor* m_parent; + + CTiglUIDManager* m_uidMgr; + + boost::optional m_cutOutUID_choice1; + boost::optional m_doorOpeningLegacy_choice2; + + private: + TIGL_EXPORT const CTiglUIDObject* GetNextUIDObject() const final; + TIGL_EXPORT void NotifyUIDChange(const std::string& oldUid, const std::string& newUid) final; + + CPACSDoorOpening(const CPACSDoorOpening&) = delete; + CPACSDoorOpening& operator=(const CPACSDoorOpening&) = delete; + + CPACSDoorOpening(CPACSDoorOpening&&) = delete; + CPACSDoorOpening& operator=(CPACSDoorOpening&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSDoorOpening = generated::CPACSDoorOpening; +using CCPACSDeckDoor = generated::CPACSDeckDoor; +} // namespace tigl diff --git a/src/generated/CPACSDoorOpeningLegacy.cpp b/src/generated/CPACSDoorOpeningLegacy.cpp new file mode 100644 index 0000000000..5a5e3cf8bc --- /dev/null +++ b/src/generated/CPACSDoorOpeningLegacy.cpp @@ -0,0 +1,189 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CPACSDoorOpening.h" +#include "CPACSDoorOpeningLegacy.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSDoorOpeningLegacy::CPACSDoorOpeningLegacy(CPACSDoorOpening* parent) + : m_x(0) + , m_z(0) + , m_width(0) + , m_height(0) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSDoorOpeningLegacy::~CPACSDoorOpeningLegacy() + { + } + + const CPACSDoorOpening* CPACSDoorOpeningLegacy::GetParent() const + { + return m_parent; + } + + CPACSDoorOpening* CPACSDoorOpeningLegacy::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSDoorOpeningLegacy::GetNextUIDParent() const + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + CTiglUIDObject* CPACSDoorOpeningLegacy::GetNextUIDParent() + { + if (m_parent) { + return m_parent->GetNextUIDParent(); + } + return nullptr; + } + + void CPACSDoorOpeningLegacy::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element x + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/x")) { + m_x = tixi::TixiGetElement(tixiHandle, xpath + "/x"); + } + else { + LOG(ERROR) << "Required element x is missing at xpath " << xpath; + } + + // read element z + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/z")) { + m_z = tixi::TixiGetElement(tixiHandle, xpath + "/z"); + } + else { + LOG(ERROR) << "Required element z is missing at xpath " << xpath; + } + + // read element width + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/width")) { + m_width = tixi::TixiGetElement(tixiHandle, xpath + "/width"); + } + else { + LOG(ERROR) << "Required element width is missing at xpath " << xpath; + } + + // read element height + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/height")) { + m_height = tixi::TixiGetElement(tixiHandle, xpath + "/height"); + } + else { + LOG(ERROR) << "Required element height is missing at xpath " << xpath; + } + + // read element side + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/side")) { + m_side = stringToCPACSDoorOpeningLegacy_side(tixi::TixiGetElement(tixiHandle, xpath + "/side")); + } + else { + LOG(ERROR) << "Required element side is missing at xpath " << xpath; + } + + } + + void CPACSDoorOpeningLegacy::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element x + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/x"); + tixi::TixiSaveElement(tixiHandle, xpath + "/x", m_x); + + // write element z + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/z"); + tixi::TixiSaveElement(tixiHandle, xpath + "/z", m_z); + + // write element width + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/width"); + tixi::TixiSaveElement(tixiHandle, xpath + "/width", m_width); + + // write element height + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/height"); + tixi::TixiSaveElement(tixiHandle, xpath + "/height", m_height); + + // write element side + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/side"); + tixi::TixiSaveElement(tixiHandle, xpath + "/side", CPACSDoorOpeningLegacy_sideToString(m_side)); + + } + + const double& CPACSDoorOpeningLegacy::GetX() const + { + return m_x; + } + + void CPACSDoorOpeningLegacy::SetX(const double& value) + { + m_x = value; + } + + const double& CPACSDoorOpeningLegacy::GetZ() const + { + return m_z; + } + + void CPACSDoorOpeningLegacy::SetZ(const double& value) + { + m_z = value; + } + + const double& CPACSDoorOpeningLegacy::GetWidth() const + { + return m_width; + } + + void CPACSDoorOpeningLegacy::SetWidth(const double& value) + { + m_width = value; + } + + const double& CPACSDoorOpeningLegacy::GetHeight() const + { + return m_height; + } + + void CPACSDoorOpeningLegacy::SetHeight(const double& value) + { + m_height = value; + } + + const CPACSDoorOpeningLegacy_side& CPACSDoorOpeningLegacy::GetSide() const + { + return m_side; + } + + void CPACSDoorOpeningLegacy::SetSide(const CPACSDoorOpeningLegacy_side& value) + { + m_side = value; + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSDoorOpeningLegacy.h b/src/generated/CPACSDoorOpeningLegacy.h new file mode 100644 index 0000000000..1ccb4807a6 --- /dev/null +++ b/src/generated/CPACSDoorOpeningLegacy.h @@ -0,0 +1,108 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include "CPACSDoorOpeningLegacy_side.h" +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDObject; + +namespace generated +{ + class CPACSDoorOpening; + + // This class is used in: + // CPACSDoorOpening + + /// @brief doorOpeningLegacyType + /// + /// doors describe all doors of the cabin. They are linked + /// to a structural door description. The cabin door is usually equal + /// in size to the door, but does not need to be. The structural door + /// might describe a wider cut-out, while the cabin door is primarily + /// intended for evacuation modeling and cabin layout. In order to + /// obtain a 3-dimensional door representation, the local cabin + /// geometry shall be used. + /// + class CPACSDoorOpeningLegacy + { + public: + TIGL_EXPORT CPACSDoorOpeningLegacy(CPACSDoorOpening* parent); + + TIGL_EXPORT virtual ~CPACSDoorOpeningLegacy(); + + TIGL_EXPORT CPACSDoorOpening* GetParent(); + + TIGL_EXPORT const CPACSDoorOpening* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const double& GetX() const; + TIGL_EXPORT virtual void SetX(const double& value); + + TIGL_EXPORT virtual const double& GetZ() const; + TIGL_EXPORT virtual void SetZ(const double& value); + + TIGL_EXPORT virtual const double& GetWidth() const; + TIGL_EXPORT virtual void SetWidth(const double& value); + + TIGL_EXPORT virtual const double& GetHeight() const; + TIGL_EXPORT virtual void SetHeight(const double& value); + + TIGL_EXPORT virtual const CPACSDoorOpeningLegacy_side& GetSide() const; + TIGL_EXPORT virtual void SetSide(const CPACSDoorOpeningLegacy_side& value); + + protected: + CPACSDoorOpening* m_parent; + + /// This is the forward x-coordinate of the door + /// relative to the cabin origin. + double m_x; + + /// the door sill height relative to cabin origin. + double m_z; + + /// The width of the door in x-direction. + double m_width; + + /// the effective height of the door. + double m_height; + + CPACSDoorOpeningLegacy_side m_side; + + private: + CPACSDoorOpeningLegacy(const CPACSDoorOpeningLegacy&) = delete; + CPACSDoorOpeningLegacy& operator=(const CPACSDoorOpeningLegacy&) = delete; + + CPACSDoorOpeningLegacy(CPACSDoorOpeningLegacy&&) = delete; + CPACSDoorOpeningLegacy& operator=(CPACSDoorOpeningLegacy&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSDoorOpeningLegacy = generated::CPACSDoorOpeningLegacy; +using CCPACSDoorOpening = generated::CPACSDoorOpening; +} // namespace tigl diff --git a/src/generated/CPACSCargoContainerElement_contour.h b/src/generated/CPACSDoorOpeningLegacy_side.h similarity index 62% rename from src/generated/CPACSCargoContainerElement_contour.h rename to src/generated/CPACSDoorOpeningLegacy_side.h index d0f7964a25..c9ade9f938 100644 --- a/src/generated/CPACSCargoContainerElement_contour.h +++ b/src/generated/CPACSDoorOpeningLegacy_side.h @@ -28,31 +28,31 @@ namespace tigl namespace generated { // This enum is used in: - // CPACSCargoContainerElement + // CPACSDoorOpeningLegacy - enum CPACSCargoContainerElement_contour + enum CPACSDoorOpeningLegacy_side { - single, - _double + port, + starboard }; - inline std::string CPACSCargoContainerElement_contourToString(const CPACSCargoContainerElement_contour& value) + inline std::string CPACSDoorOpeningLegacy_sideToString(const CPACSDoorOpeningLegacy_side& value) { switch(value) { - case single: return "single"; - case _double: return "double"; - default: throw CTiglError("Invalid enum value \"" + std_to_string(static_cast(value)) + "\" for enum type CPACSCargoContainerElement_contour"); + case port: return "port"; + case starboard: return "starboard"; + default: throw CTiglError("Invalid enum value \"" + std_to_string(static_cast(value)) + "\" for enum type CPACSDoorOpeningLegacy_side"); } } - inline CPACSCargoContainerElement_contour stringToCPACSCargoContainerElement_contour(const std::string& value) + inline CPACSDoorOpeningLegacy_side stringToCPACSDoorOpeningLegacy_side(const std::string& value) { auto toLower = [](std::string str) { for (char& c : str) { c = std::tolower(c); } return str; }; - if (toLower(value) == "single") { return single; } - if (toLower(value) == "double") { return _double; } - throw CTiglError("Invalid string value \"" + value + "\" for enum type CPACSCargoContainerElement_contour"); + if (toLower(value) == "port") { return port; } + if (toLower(value) == "starboard") { return starboard; } + throw CTiglError("Invalid string value \"" + value + "\" for enum type CPACSDoorOpeningLegacy_side"); } } // namespace generated // Aliases in tigl namespace -using ECPACSCargoContainerElement_contour = generated::CPACSCargoContainerElement_contour; +using ECPACSDoorOpeningLegacy_side = generated::CPACSDoorOpeningLegacy_side; } // namespace tigl diff --git a/src/generated/CPACSDoubleVectorBase.cpp b/src/generated/CPACSDoubleVectorBase.cpp new file mode 100644 index 0000000000..ad4bd221a2 --- /dev/null +++ b/src/generated/CPACSDoubleVectorBase.cpp @@ -0,0 +1,360 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include "CPACSCabinAisle.h" +#include "CPACSCabinGeometry.h" +#include "CPACSCabinGeometryContour.h" +#include "CPACSCabinSpace.h" +#include "CPACSDoubleVectorBase.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSDoubleVectorBase::CPACSDoubleVectorBase(CPACSCabinAisle* parent) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSCabinAisle); + } + + CPACSDoubleVectorBase::CPACSDoubleVectorBase(CPACSCabinGeometry* parent) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSCabinGeometry); + } + + CPACSDoubleVectorBase::CPACSDoubleVectorBase(CPACSCabinGeometryContour* parent) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSCabinGeometryContour); + } + + CPACSDoubleVectorBase::CPACSDoubleVectorBase(CPACSCabinSpace* parent) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSCabinSpace); + } + + CPACSDoubleVectorBase::~CPACSDoubleVectorBase() + { + } + + const CTiglUIDObject* CPACSDoubleVectorBase::GetNextUIDParent() const + { + if (m_parent) { + if (IsParent()) { + return GetParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent(); + } + } + return nullptr; + } + + CTiglUIDObject* CPACSDoubleVectorBase::GetNextUIDParent() + { + if (m_parent) { + if (IsParent()) { + return GetParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent(); + } + } + return nullptr; + } + + void CPACSDoubleVectorBase::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read attribute mapType + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "mapType")) { + m_mapType = tixi::TixiGetAttribute(tixiHandle, xpath, "mapType"); + if (m_mapType->empty()) { + LOG(WARNING) << "Optional attribute mapType is present but empty at xpath " << xpath; + } + } + + // read attribute mu + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "mu")) { + m_mu = tixi::TixiGetAttribute(tixiHandle, xpath, "mu"); + if (m_mu->empty()) { + LOG(WARNING) << "Optional attribute mu is present but empty at xpath " << xpath; + } + } + + // read attribute delta + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "delta")) { + m_delta = tixi::TixiGetAttribute(tixiHandle, xpath, "delta"); + if (m_delta->empty()) { + LOG(WARNING) << "Optional attribute delta is present but empty at xpath " << xpath; + } + } + + // read attribute a + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "a")) { + m_a = tixi::TixiGetAttribute(tixiHandle, xpath, "a"); + if (m_a->empty()) { + LOG(WARNING) << "Optional attribute a is present but empty at xpath " << xpath; + } + } + + // read attribute b + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "b")) { + m_b = tixi::TixiGetAttribute(tixiHandle, xpath, "b"); + if (m_b->empty()) { + LOG(WARNING) << "Optional attribute b is present but empty at xpath " << xpath; + } + } + + // read attribute c + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "c")) { + m_c = tixi::TixiGetAttribute(tixiHandle, xpath, "c"); + if (m_c->empty()) { + LOG(WARNING) << "Optional attribute c is present but empty at xpath " << xpath; + } + } + + // read attribute v + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "v")) { + m_v = tixi::TixiGetAttribute(tixiHandle, xpath, "v"); + if (m_v->empty()) { + LOG(WARNING) << "Optional attribute v is present but empty at xpath " << xpath; + } + } + + // read attribute w + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "w")) { + m_w = tixi::TixiGetAttribute(tixiHandle, xpath, "w"); + if (m_w->empty()) { + LOG(WARNING) << "Optional attribute w is present but empty at xpath " << xpath; + } + } + + // read simpleContent + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath)) { + m_value = tixi::TixiGetElement(tixiHandle, xpath); + if (m_value.empty()) { + LOG(WARNING) << "Required element is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required simpleContent is missing at xpath " << xpath; + } + + } + + void CPACSDoubleVectorBase::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write attribute mapType + if (m_mapType) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "mapType", *m_mapType); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "mapType")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "mapType"); + } + } + + // write attribute mu + if (m_mu) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "mu", *m_mu); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "mu")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "mu"); + } + } + + // write attribute delta + if (m_delta) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "delta", *m_delta); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "delta")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "delta"); + } + } + + // write attribute a + if (m_a) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "a", *m_a); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "a")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "a"); + } + } + + // write attribute b + if (m_b) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "b", *m_b); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "b")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "b"); + } + } + + // write attribute c + if (m_c) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "c", *m_c); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "c")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "c"); + } + } + + // write attribute v + if (m_v) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "v", *m_v); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "v")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "v"); + } + } + + // write attribute w + if (m_w) { + tixi::TixiSaveAttribute(tixiHandle, xpath, "w", *m_w); + } + else { + if (tixi::TixiCheckAttribute(tixiHandle, xpath, "w")) { + tixi::TixiRemoveAttribute(tixiHandle, xpath, "w"); + } + } + + // write simpleContent + tixi::TixiSaveElement(tixiHandle, xpath, m_value); + + } + + const boost::optional& CPACSDoubleVectorBase::GetMapType() const + { + return m_mapType; + } + + void CPACSDoubleVectorBase::SetMapType(const boost::optional& value) + { + m_mapType = value; + } + + const boost::optional& CPACSDoubleVectorBase::GetMu() const + { + return m_mu; + } + + void CPACSDoubleVectorBase::SetMu(const boost::optional& value) + { + m_mu = value; + } + + const boost::optional& CPACSDoubleVectorBase::GetDelta() const + { + return m_delta; + } + + void CPACSDoubleVectorBase::SetDelta(const boost::optional& value) + { + m_delta = value; + } + + const boost::optional& CPACSDoubleVectorBase::GetA() const + { + return m_a; + } + + void CPACSDoubleVectorBase::SetA(const boost::optional& value) + { + m_a = value; + } + + const boost::optional& CPACSDoubleVectorBase::GetB() const + { + return m_b; + } + + void CPACSDoubleVectorBase::SetB(const boost::optional& value) + { + m_b = value; + } + + const boost::optional& CPACSDoubleVectorBase::GetC() const + { + return m_c; + } + + void CPACSDoubleVectorBase::SetC(const boost::optional& value) + { + m_c = value; + } + + const boost::optional& CPACSDoubleVectorBase::GetV() const + { + return m_v; + } + + void CPACSDoubleVectorBase::SetV(const boost::optional& value) + { + m_v = value; + } + + const boost::optional& CPACSDoubleVectorBase::GetW() const + { + return m_w; + } + + void CPACSDoubleVectorBase::SetW(const boost::optional& value) + { + m_w = value; + } + + const std::string& CPACSDoubleVectorBase::GetValue() const + { + return m_value; + } + + void CPACSDoubleVectorBase::SetValue(const std::string& value) + { + m_value = value; + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSDoubleVectorBase.h b/src/generated/CPACSDoubleVectorBase.h new file mode 100644 index 0000000000..a279b7a2b4 --- /dev/null +++ b/src/generated/CPACSDoubleVectorBase.h @@ -0,0 +1,164 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include +#include "CTiglError.h" +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDObject; + +namespace generated +{ + class CPACSCabinAisle; + class CPACSCabinGeometry; + class CPACSCabinGeometryContour; + class CPACSCabinSpace; + + // This class is used in: + // CPACSCabinAisle + // CPACSCabinGeometry + // CPACSCabinGeometryContour + // CPACSCabinSpace + + /// @brief stringVectorBaseType + /// + /// Base type for string vector nodes + /// The vector base type can include optional uncertainty + /// information. The description of uncertainties is placed in + /// addtional attributes. First, it is described by an attribute that + /// describes the type of uncertainty function called functionName. + /// The functionName attribute includes the tag name of the + /// distribution function which is listened in the table shown below. + /// Each uncertainty function is further describes by a set of + /// parameters that are described in the table below. + /// If the uncertainty values change for the elements of + /// the vector than the attribute may be written as a list of values + /// separated by semicolons + /// DEPRECATED: As of CPACS version 3.3, the mapType attribute is set to optional to ensure the compatibility of older data sets. + /// However, since the type is uniquely defined via the XSD, the attribute is superfluous + /// and will therefore be completely omitted in the next major release (Note: requires + /// TiXI >= 3.3). Please contact the CPACS team + /// if for any reason you see a long-term need for the mapType attribute. + /// @see uncertaintyFunctions + /// + class CPACSDoubleVectorBase + { + public: + TIGL_EXPORT CPACSDoubleVectorBase(CPACSCabinAisle* parent); + TIGL_EXPORT CPACSDoubleVectorBase(CPACSCabinGeometry* parent); + TIGL_EXPORT CPACSDoubleVectorBase(CPACSCabinGeometryContour* parent); + TIGL_EXPORT CPACSDoubleVectorBase(CPACSCabinSpace* parent); + + TIGL_EXPORT virtual ~CPACSDoubleVectorBase(); + + template + bool IsParent() const + { + return m_parentType != NULL && *m_parentType == typeid(P); + } + + template + P* GetParent() + { + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSDoubleVectorBase"); + if (!IsParent

()) { + throw CTiglError("bad parent"); + } + return static_cast(m_parent); + } + + template + const P* GetParent() const + { + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSDoubleVectorBase"); + if (!IsParent

()) { + throw CTiglError("bad parent"); + } + return static_cast(m_parent); + } + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const boost::optional& GetMapType() const; + TIGL_EXPORT virtual void SetMapType(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetMu() const; + TIGL_EXPORT virtual void SetMu(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetDelta() const; + TIGL_EXPORT virtual void SetDelta(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetA() const; + TIGL_EXPORT virtual void SetA(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetB() const; + TIGL_EXPORT virtual void SetB(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetC() const; + TIGL_EXPORT virtual void SetC(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetV() const; + TIGL_EXPORT virtual void SetV(const boost::optional& value); + + TIGL_EXPORT virtual const boost::optional& GetW() const; + TIGL_EXPORT virtual void SetW(const boost::optional& value); + + TIGL_EXPORT virtual const std::string& GetValue() const; + TIGL_EXPORT virtual void SetValue(const std::string& value); + + protected: + void* m_parent; + const std::type_info* m_parentType; + + boost::optional m_mapType; + boost::optional m_mu; + boost::optional m_delta; + boost::optional m_a; + boost::optional m_b; + boost::optional m_c; + boost::optional m_v; + boost::optional m_w; + std::string m_value; + + private: + CPACSDoubleVectorBase(const CPACSDoubleVectorBase&) = delete; + CPACSDoubleVectorBase& operator=(const CPACSDoubleVectorBase&) = delete; + + CPACSDoubleVectorBase(CPACSDoubleVectorBase&&) = delete; + CPACSDoubleVectorBase& operator=(CPACSDoubleVectorBase&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSDoubleVectorBase = generated::CPACSDoubleVectorBase; +using CCPACSCabinAisle = generated::CPACSCabinAisle; +using CCPACSCabinGeometry = generated::CPACSCabinGeometry; +using CCPACSCabinGeometryContour = generated::CPACSCabinGeometryContour; +using CCPACSCabinSpace = generated::CPACSCabinSpace; +} // namespace tigl diff --git a/src/generated/CPACSElementGeometry.cpp b/src/generated/CPACSElementGeometry.cpp index f6de935aea..8231e2038d 100644 --- a/src/generated/CPACSElementGeometry.cpp +++ b/src/generated/CPACSElementGeometry.cpp @@ -17,6 +17,8 @@ #include #include "CPACSElementGeometry.h" +#include "CPACSGalleyElement.h" +#include "CPACSSeatElement.h" #include "CPACSSysElemBattery.h" #include "CPACSSysElemCable.h" #include "CPACSSysElemCompressor.h" @@ -47,6 +49,22 @@ namespace tigl { namespace generated { + CPACSElementGeometry::CPACSElementGeometry(CPACSGalleyElement* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSGalleyElement); + } + + CPACSElementGeometry::CPACSElementGeometry(CPACSSeatElement* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSSeatElement); + } + CPACSElementGeometry::CPACSElementGeometry(CPACSSysElemBattery* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) { @@ -214,6 +232,12 @@ namespace generated const CTiglUIDObject* CPACSElementGeometry::GetNextUIDParent() const { if (m_parent) { + if (IsParent()) { + return GetParent(); + } + if (IsParent()) { + return GetParent(); + } if (IsParent()) { return GetParent(); } @@ -281,6 +305,12 @@ namespace generated CTiglUIDObject* CPACSElementGeometry::GetNextUIDParent() { if (m_parent) { + if (IsParent()) { + return GetParent(); + } + if (IsParent()) { + return GetParent(); + } if (IsParent()) { return GetParent(); } diff --git a/src/generated/CPACSElementGeometry.h b/src/generated/CPACSElementGeometry.h index 498c0d0b0f..03938762e3 100644 --- a/src/generated/CPACSElementGeometry.h +++ b/src/generated/CPACSElementGeometry.h @@ -41,6 +41,8 @@ class CTiglUIDObject; namespace generated { + class CPACSGalleyElement; + class CPACSSeatElement; class CPACSSysElemBattery; class CPACSSysElemCable; class CPACSSysElemCompressor; @@ -63,6 +65,8 @@ namespace generated class CPACSVehicleElementBase; // This class is used in: + // CPACSGalleyElement + // CPACSSeatElement // CPACSSysElemBattery // CPACSSysElemCable // CPACSSysElemCompressor @@ -90,6 +94,8 @@ namespace generated class CPACSElementGeometry { public: + TIGL_EXPORT CPACSElementGeometry(CPACSGalleyElement* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSElementGeometry(CPACSSeatElement* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSElementGeometry(CPACSSysElemBattery* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSElementGeometry(CPACSSysElemCable* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSElementGeometry(CPACSSysElemCompressor* parent, CTiglUIDManager* uidMgr); @@ -122,7 +128,7 @@ namespace generated template P* GetParent() { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSElementGeometry"); + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSElementGeometry"); if (!IsParent

()) { throw CTiglError("bad parent"); } @@ -132,7 +138,7 @@ namespace generated template const P* GetParent() const { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSElementGeometry"); + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSElementGeometry"); if (!IsParent

()) { throw CTiglError("bad parent"); } @@ -228,6 +234,8 @@ namespace generated // Aliases in tigl namespace using CCPACSElementGeometry = generated::CPACSElementGeometry; +using CCPACSGalleyElement = generated::CPACSGalleyElement; +using CCPACSSeatElement = generated::CPACSSeatElement; using CCPACSSysElemBattery = generated::CPACSSysElemBattery; using CCPACSSysElemCable = generated::CPACSSysElemCable; using CCPACSSysElemCompressor = generated::CPACSSysElemCompressor; diff --git a/src/generated/CPACSElementMass.cpp b/src/generated/CPACSElementMass.cpp index 3eca0ee138..772984d15e 100644 --- a/src/generated/CPACSElementMass.cpp +++ b/src/generated/CPACSElementMass.cpp @@ -17,6 +17,8 @@ #include #include "CPACSElementMass.h" +#include "CPACSGalleyElement.h" +#include "CPACSSeatElement.h" #include "CPACSSysElemBattery.h" #include "CPACSSysElemCable.h" #include "CPACSSysElemCompressor.h" @@ -47,6 +49,22 @@ namespace tigl { namespace generated { + CPACSElementMass::CPACSElementMass(CPACSGalleyElement* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSGalleyElement); + } + + CPACSElementMass::CPACSElementMass(CPACSSeatElement* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSSeatElement); + } + CPACSElementMass::CPACSElementMass(CPACSSysElemBattery* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) { @@ -214,6 +232,12 @@ namespace generated const CTiglUIDObject* CPACSElementMass::GetNextUIDParent() const { if (m_parent) { + if (IsParent()) { + return GetParent(); + } + if (IsParent()) { + return GetParent(); + } if (IsParent()) { return GetParent(); } @@ -281,6 +305,12 @@ namespace generated CTiglUIDObject* CPACSElementMass::GetNextUIDParent() { if (m_parent) { + if (IsParent()) { + return GetParent(); + } + if (IsParent()) { + return GetParent(); + } if (IsParent()) { return GetParent(); } @@ -364,12 +394,12 @@ namespace generated void CPACSElementMass::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { // read element density - if (tixi::TixiCheckElement(tixiHandle, xpath + "/density")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/density")) { m_density_choice1 = tixi::TixiGetElement(tixiHandle, xpath + "/density"); } // read element mass - if (tixi::TixiCheckElement(tixiHandle, xpath + "/mass")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/mass")) { m_mass_choice2 = tixi::TixiGetElement(tixiHandle, xpath + "/mass"); } diff --git a/src/generated/CPACSElementMass.h b/src/generated/CPACSElementMass.h index c69dc0bb45..72f58095a8 100644 --- a/src/generated/CPACSElementMass.h +++ b/src/generated/CPACSElementMass.h @@ -35,6 +35,8 @@ class CTiglUIDObject; namespace generated { + class CPACSGalleyElement; + class CPACSSeatElement; class CPACSSysElemBattery; class CPACSSysElemCable; class CPACSSysElemCompressor; @@ -57,6 +59,8 @@ namespace generated class CPACSVehicleElementBase; // This class is used in: + // CPACSGalleyElement + // CPACSSeatElement // CPACSSysElemBattery // CPACSSysElemCable // CPACSSysElemCompressor @@ -90,6 +94,8 @@ namespace generated class CPACSElementMass { public: + TIGL_EXPORT CPACSElementMass(CPACSGalleyElement* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSElementMass(CPACSSeatElement* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSElementMass(CPACSSysElemBattery* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSElementMass(CPACSSysElemCable* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSElementMass(CPACSSysElemCompressor* parent, CTiglUIDManager* uidMgr); @@ -122,7 +128,7 @@ namespace generated template P* GetParent() { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSElementMass"); + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSElementMass"); if (!IsParent

()) { throw CTiglError("bad parent"); } @@ -132,7 +138,7 @@ namespace generated template const P* GetParent() const { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSElementMass"); + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSElementMass"); if (!IsParent

()) { throw CTiglError("bad parent"); } @@ -196,6 +202,8 @@ namespace generated // Aliases in tigl namespace using CCPACSElementMass = generated::CPACSElementMass; +using CCPACSGalleyElement = generated::CPACSGalleyElement; +using CCPACSSeatElement = generated::CPACSSeatElement; using CCPACSSysElemBattery = generated::CPACSSysElemBattery; using CCPACSSysElemCable = generated::CPACSSysElemCable; using CCPACSSysElemCompressor = generated::CPACSSysElemCompressor; diff --git a/src/generated/CPACSEllipsoid.cpp b/src/generated/CPACSEllipsoid.cpp index 35f8b5649e..34a4f76e02 100644 --- a/src/generated/CPACSEllipsoid.cpp +++ b/src/generated/CPACSEllipsoid.cpp @@ -85,7 +85,7 @@ namespace generated void CPACSEllipsoid::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { // read element radiusX - if (tixi::TixiCheckElement(tixiHandle, xpath + "/radiusX")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/radiusX")) { m_radiusX = tixi::TixiGetElement(tixiHandle, xpath + "/radiusX"); } else { @@ -93,17 +93,17 @@ namespace generated } // read element radiusY - if (tixi::TixiCheckElement(tixiHandle, xpath + "/radiusY")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/radiusY")) { m_radiusY = tixi::TixiGetElement(tixiHandle, xpath + "/radiusY"); } // read element radiusZ - if (tixi::TixiCheckElement(tixiHandle, xpath + "/radiusZ")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/radiusZ")) { m_radiusZ = tixi::TixiGetElement(tixiHandle, xpath + "/radiusZ"); } // read element diskAngle - if (tixi::TixiCheckElement(tixiHandle, xpath + "/diskAngle")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/diskAngle")) { m_diskAngle = tixi::TixiGetElement(tixiHandle, xpath + "/diskAngle"); } diff --git a/src/generated/CPACSFuselage.cpp b/src/generated/CPACSFuselage.cpp index c86317fa74..c22878ab0b 100644 --- a/src/generated/CPACSFuselage.cpp +++ b/src/generated/CPACSFuselage.cpp @@ -190,6 +190,17 @@ namespace generated } } + // read element decks + if (tixi::TixiCheckElement(tixiHandle, xpath + "/decks")) { + m_decks = boost::in_place(reinterpret_cast(this), m_uidMgr); + try { + m_decks->ReadCPACS(tixiHandle, xpath + "/decks"); + } catch(const std::exception& e) { + LOG(ERROR) << "Failed to read decks at xpath " << xpath << ": " << e.what(); + m_decks = boost::none; + } + } + if (m_uidMgr && !m_uID.empty()) m_uidMgr->RegisterObject(m_uID, *this); } @@ -279,6 +290,17 @@ namespace generated } } + // write element decks + if (m_decks) { + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/decks"); + m_decks->WriteCPACS(tixiHandle, xpath + "/decks"); + } + else { + if (tixi::TixiCheckElement(tixiHandle, xpath + "/decks")) { + tixi::TixiRemoveElement(tixiHandle, xpath + "/decks"); + } + } + } const std::string& CPACSFuselage::GetUID() const @@ -403,6 +425,16 @@ namespace generated return m_compartments; } + const boost::optional& CPACSFuselage::GetDecks() const + { + return m_decks; + } + + boost::optional& CPACSFuselage::GetDecks() + { + return m_decks; + } + CCPACSPositionings& CPACSFuselage::GetPositionings(CreateIfNotExistsTag) { if (!m_positionings) @@ -439,6 +471,18 @@ namespace generated m_compartments = boost::none; } + CPACSDecks& CPACSFuselage::GetDecks(CreateIfNotExistsTag) + { + if (!m_decks) + m_decks = boost::in_place(reinterpret_cast(this), m_uidMgr); + return *m_decks; + } + + void CPACSFuselage::RemoveDecks() + { + m_decks = boost::none; + } + const CTiglUIDObject* CPACSFuselage::GetNextUIDObject() const { return this; diff --git a/src/generated/CPACSFuselage.h b/src/generated/CPACSFuselage.h index 5c2511248f..2ffd6e4e8c 100644 --- a/src/generated/CPACSFuselage.h +++ b/src/generated/CPACSFuselage.h @@ -28,6 +28,7 @@ #include #include #include "CPACSCompartments.h" +#include "CPACSDecks.h" #include "CreateIfNotExists.h" #include "CTiglUIDObject.h" #include "ITiglUIDRefObject.h" @@ -102,6 +103,9 @@ namespace generated TIGL_EXPORT virtual const boost::optional& GetCompartments() const; TIGL_EXPORT virtual boost::optional& GetCompartments(); + TIGL_EXPORT virtual const boost::optional& GetDecks() const; + TIGL_EXPORT virtual boost::optional& GetDecks(); + TIGL_EXPORT virtual CCPACSPositionings& GetPositionings(CreateIfNotExistsTag); TIGL_EXPORT virtual void RemovePositionings(); @@ -111,6 +115,9 @@ namespace generated TIGL_EXPORT virtual CPACSCompartments& GetCompartments(CreateIfNotExistsTag); TIGL_EXPORT virtual void RemoveCompartments(); + TIGL_EXPORT virtual CPACSDecks& GetDecks(CreateIfNotExistsTag); + TIGL_EXPORT virtual void RemoveDecks(); + protected: CCPACSFuselages* m_parent; @@ -142,6 +149,8 @@ namespace generated boost::optional m_compartments; + boost::optional m_decks; + private: TIGL_EXPORT const CTiglUIDObject* GetNextUIDObject() const final; TIGL_EXPORT void NotifyUIDChange(const std::string& oldUid, const std::string& newUid) final; diff --git a/src/generated/CPACSGalleyElement.cpp b/src/generated/CPACSGalleyElement.cpp index e5513fd825..8bd0579556 100644 --- a/src/generated/CPACSGalleyElement.cpp +++ b/src/generated/CPACSGalleyElement.cpp @@ -95,6 +95,17 @@ namespace generated LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; } + // read element name + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { + m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); + if (m_name.empty()) { + LOG(WARNING) << "Required element name is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required element name is missing at xpath " << xpath; + } + // read element description if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); @@ -141,6 +152,10 @@ namespace generated // write attribute uID tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); + // write element name + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); + tixi::TixiSaveElement(tixiHandle, xpath + "/name", m_name); + // write element description if (m_description) { tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/description"); @@ -198,6 +213,16 @@ namespace generated m_uID = value; } + const std::string& CPACSGalleyElement::GetName() const + { + return m_name; + } + + void CPACSGalleyElement::SetName(const std::string& value) + { + m_name = value; + } + const boost::optional& CPACSGalleyElement::GetDescription() const { return m_description; @@ -208,22 +233,22 @@ namespace generated m_description = value; } - const CPACSDeckElementGeometry& CPACSGalleyElement::GetGeometry() const + const CPACSElementGeometry& CPACSGalleyElement::GetGeometry() const { return m_geometry; } - CPACSDeckElementGeometry& CPACSGalleyElement::GetGeometry() + CPACSElementGeometry& CPACSGalleyElement::GetGeometry() { return m_geometry; } - const boost::optional& CPACSGalleyElement::GetMass() const + const boost::optional& CPACSGalleyElement::GetMass() const { return m_mass; } - boost::optional& CPACSGalleyElement::GetMass() + boost::optional& CPACSGalleyElement::GetMass() { return m_mass; } @@ -238,7 +263,7 @@ namespace generated return m_numberOfTrolleys; } - CPACSDeckElementMass& CPACSGalleyElement::GetMass(CreateIfNotExistsTag) + CPACSElementMass& CPACSGalleyElement::GetMass(CreateIfNotExistsTag) { if (!m_mass) m_mass = boost::in_place(this, m_uidMgr); diff --git a/src/generated/CPACSGalleyElement.h b/src/generated/CPACSGalleyElement.h index 1c121e59ed..5136a63a9b 100644 --- a/src/generated/CPACSGalleyElement.h +++ b/src/generated/CPACSGalleyElement.h @@ -21,8 +21,8 @@ #include #include #include -#include "CPACSDeckElementGeometry.h" -#include "CPACSDeckElementMass.h" +#include "CPACSElementGeometry.h" +#include "CPACSElementMass.h" #include "CPACSPosExcl0IntBase.h" #include "CreateIfNotExists.h" #include "CTiglUIDObject.h" @@ -66,19 +66,22 @@ namespace generated TIGL_EXPORT virtual const std::string& GetUID() const; TIGL_EXPORT virtual void SetUID(const std::string& value); + TIGL_EXPORT virtual const std::string& GetName() const; + TIGL_EXPORT virtual void SetName(const std::string& value); + TIGL_EXPORT virtual const boost::optional& GetDescription() const; TIGL_EXPORT virtual void SetDescription(const boost::optional& value); - TIGL_EXPORT virtual const CPACSDeckElementGeometry& GetGeometry() const; - TIGL_EXPORT virtual CPACSDeckElementGeometry& GetGeometry(); + TIGL_EXPORT virtual const CPACSElementGeometry& GetGeometry() const; + TIGL_EXPORT virtual CPACSElementGeometry& GetGeometry(); - TIGL_EXPORT virtual const boost::optional& GetMass() const; - TIGL_EXPORT virtual boost::optional& GetMass(); + TIGL_EXPORT virtual const boost::optional& GetMass() const; + TIGL_EXPORT virtual boost::optional& GetMass(); TIGL_EXPORT virtual const boost::optional& GetNumberOfTrolleys() const; TIGL_EXPORT virtual boost::optional& GetNumberOfTrolleys(); - TIGL_EXPORT virtual CPACSDeckElementMass& GetMass(CreateIfNotExistsTag); + TIGL_EXPORT virtual CPACSElementMass& GetMass(CreateIfNotExistsTag); TIGL_EXPORT virtual void RemoveMass(); TIGL_EXPORT virtual CPACSPosExcl0IntBase& GetNumberOfTrolleys(CreateIfNotExistsTag); @@ -91,12 +94,15 @@ namespace generated std::string m_uID; + /// Name + std::string m_name; + /// Description boost::optional m_description; - CPACSDeckElementGeometry m_geometry; + CPACSElementGeometry m_geometry; - boost::optional m_mass; + boost::optional m_mass; /// Number of trolleys boost::optional m_numberOfTrolleys; diff --git a/src/generated/CPACSGalleys.cpp b/src/generated/CPACSGalleys.cpp new file mode 100644 index 0000000000..b274757301 --- /dev/null +++ b/src/generated/CPACSGalleys.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "CCPACSDeck.h" +#include "CPACSGalleys.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSGalleys::CPACSGalleys(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSGalleys::~CPACSGalleys() + { + } + + const CCPACSDeck* CPACSGalleys::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSGalleys::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSGalleys::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSGalleys::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSGalleys::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSGalleys::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSGalleys::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element galley + if (tixi::TixiCheckElement(tixiHandle, xpath + "/galley")) { + tixi::TixiReadElements(tixiHandle, xpath + "/galley", m_galleys, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSGalleys::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element galley + tixi::TixiSaveElements(tixiHandle, xpath + "/galley", m_galleys); + + } + + const std::vector>& CPACSGalleys::GetGalleys() const + { + return m_galleys; + } + + std::vector>& CPACSGalleys::GetGalleys() + { + return m_galleys; + } + + size_t CPACSGalleys::GetGalleyCount() const + { + return m_galleys.size(); + } + + size_t CPACSGalleys::GetGalleyIndex(const std::string& UID) const + { + for (size_t i=0; i < GetGalleyCount(); i++) { + const std::string tmpUID(m_galleys[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSGalleys::GetGalleyIndex", TIGL_UID_ERROR); + } + + CCPACSDeckComponentBase& CPACSGalleys::GetGalley(size_t index) + { + if (index < 1 || index > GetGalleyCount()) { + throw CTiglError("Invalid index in std::vector>::GetGalley", TIGL_INDEX_ERROR); + } + index--; + return *m_galleys[index]; + } + + const CCPACSDeckComponentBase& CPACSGalleys::GetGalley(size_t index) const + { + if (index < 1 || index > GetGalleyCount()) { + throw CTiglError("Invalid index in std::vector>::GetGalley", TIGL_INDEX_ERROR); + } + index--; + return *m_galleys[index]; + } + + CCPACSDeckComponentBase& CPACSGalleys::GetGalley(const std::string& UID) + { + for (auto& elem : m_galleys ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSGalleys::GetGalley. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CCPACSDeckComponentBase& CPACSGalleys::GetGalley(const std::string& UID) const + { + for (auto& elem : m_galleys ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSGalleys::GetGalley. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CCPACSDeckComponentBase& CPACSGalleys::AddGalley() + { + m_galleys.push_back(std::make_unique(this, m_uidMgr)); + return *m_galleys.back(); + } + + void CPACSGalleys::RemoveGalley(CCPACSDeckComponentBase& ref) + { + for (std::size_t i = 0; i < m_galleys.size(); i++) { + if (m_galleys[i].get() == &ref) { + m_galleys.erase(m_galleys.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSGalleys.h b/src/generated/CPACSGalleys.h new file mode 100644 index 0000000000..fc0857df80 --- /dev/null +++ b/src/generated/CPACSGalleys.h @@ -0,0 +1,96 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeckComponentBase; +class CCPACSDeck; + +namespace generated +{ + // This class is used in: + // CPACSDeck + + /// @brief Galleys + /// + /// Galley instance collection type. + /// + class CPACSGalleys + { + public: + TIGL_EXPORT CPACSGalleys(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSGalleys(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetGalleys() const; + TIGL_EXPORT virtual std::vector>& GetGalleys(); + + TIGL_EXPORT virtual size_t GetGalleyCount() const; + TIGL_EXPORT virtual size_t GetGalleyIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetGalley(size_t index) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetGalley(size_t index); + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetGalley(const std::string& UID) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetGalley(const std::string& UID); + + TIGL_EXPORT virtual CCPACSDeckComponentBase& AddGalley(); + TIGL_EXPORT virtual void RemoveGalley(CCPACSDeckComponentBase& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + /// Galley + std::vector> m_galleys; + + private: + CPACSGalleys(const CPACSGalleys&) = delete; + CPACSGalleys& operator=(const CPACSGalleys&) = delete; + + CPACSGalleys(CPACSGalleys&&) = delete; + CPACSGalleys& operator=(CPACSGalleys&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSGalleys = generated::CPACSGalleys; +} // namespace tigl diff --git a/src/generated/CPACSGenericFloorElements.cpp b/src/generated/CPACSGenericFloorElements.cpp index d98add0089..ebbb7665bd 100644 --- a/src/generated/CPACSGenericFloorElements.cpp +++ b/src/generated/CPACSGenericFloorElements.cpp @@ -16,9 +16,9 @@ // limitations under the License. #include -#include "CPACSDeckElementBase.h" #include "CPACSDeckElements.h" #include "CPACSGenericFloorElements.h" +#include "CPACSVehicleElementBase.h" #include "CTiglError.h" #include "CTiglLogging.h" #include "CTiglUIDManager.h" @@ -98,12 +98,12 @@ namespace generated } - const std::vector>& CPACSGenericFloorElements::GetGenericFloorElements() const + const std::vector>& CPACSGenericFloorElements::GetGenericFloorElements() const { return m_genericFloorElements; } - std::vector>& CPACSGenericFloorElements::GetGenericFloorElements() + std::vector>& CPACSGenericFloorElements::GetGenericFloorElements() { return m_genericFloorElements; } @@ -124,25 +124,25 @@ namespace generated throw CTiglError("Invalid UID in CPACSGenericFloorElements::GetGenericFloorElementIndex", TIGL_UID_ERROR); } - CPACSDeckElementBase& CPACSGenericFloorElements::GetGenericFloorElement(size_t index) + CPACSVehicleElementBase& CPACSGenericFloorElements::GetGenericFloorElement(size_t index) { if (index < 1 || index > GetGenericFloorElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetGenericFloorElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetGenericFloorElement", TIGL_INDEX_ERROR); } index--; return *m_genericFloorElements[index]; } - const CPACSDeckElementBase& CPACSGenericFloorElements::GetGenericFloorElement(size_t index) const + const CPACSVehicleElementBase& CPACSGenericFloorElements::GetGenericFloorElement(size_t index) const { if (index < 1 || index > GetGenericFloorElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetGenericFloorElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetGenericFloorElement", TIGL_INDEX_ERROR); } index--; return *m_genericFloorElements[index]; } - CPACSDeckElementBase& CPACSGenericFloorElements::GetGenericFloorElement(const std::string& UID) + CPACSVehicleElementBase& CPACSGenericFloorElements::GetGenericFloorElement(const std::string& UID) { for (auto& elem : m_genericFloorElements ) { if (elem->GetUID() == UID) @@ -151,7 +151,7 @@ namespace generated throw CTiglError("Invalid UID in CPACSGenericFloorElements::GetGenericFloorElement. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); } - const CPACSDeckElementBase& CPACSGenericFloorElements::GetGenericFloorElement(const std::string& UID) const + const CPACSVehicleElementBase& CPACSGenericFloorElements::GetGenericFloorElement(const std::string& UID) const { for (auto& elem : m_genericFloorElements ) { if (elem->GetUID() == UID) @@ -161,13 +161,13 @@ namespace generated } - CPACSDeckElementBase& CPACSGenericFloorElements::AddGenericFloorElement() + CPACSVehicleElementBase& CPACSGenericFloorElements::AddGenericFloorElement() { - m_genericFloorElements.push_back(std::make_unique(this, m_uidMgr)); + m_genericFloorElements.push_back(std::make_unique(this, m_uidMgr)); return *m_genericFloorElements.back(); } - void CPACSGenericFloorElements::RemoveGenericFloorElement(CPACSDeckElementBase& ref) + void CPACSGenericFloorElements::RemoveGenericFloorElement(CPACSVehicleElementBase& ref) { for (std::size_t i = 0; i < m_genericFloorElements.size(); i++) { if (m_genericFloorElements[i].get() == &ref) { diff --git a/src/generated/CPACSGenericFloorElements.h b/src/generated/CPACSGenericFloorElements.h index e5315390bf..554ec79bfa 100644 --- a/src/generated/CPACSGenericFloorElements.h +++ b/src/generated/CPACSGenericFloorElements.h @@ -30,7 +30,7 @@ class CTiglUIDObject; namespace generated { - class CPACSDeckElementBase; + class CPACSVehicleElementBase; class CPACSDeckElements; // This class is used in: @@ -60,20 +60,20 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const std::vector>& GetGenericFloorElements() const; - TIGL_EXPORT virtual std::vector>& GetGenericFloorElements(); + TIGL_EXPORT virtual const std::vector>& GetGenericFloorElements() const; + TIGL_EXPORT virtual std::vector>& GetGenericFloorElements(); TIGL_EXPORT virtual size_t GetGenericFloorElementCount() const; TIGL_EXPORT virtual size_t GetGenericFloorElementIndex(const std::string& UID) const; - TIGL_EXPORT virtual const CPACSDeckElementBase& GetGenericFloorElement(size_t index) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetGenericFloorElement(size_t index); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetGenericFloorElement(size_t index) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetGenericFloorElement(size_t index); - TIGL_EXPORT virtual const CPACSDeckElementBase& GetGenericFloorElement(const std::string& UID) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetGenericFloorElement(const std::string& UID); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetGenericFloorElement(const std::string& UID) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetGenericFloorElement(const std::string& UID); - TIGL_EXPORT virtual CPACSDeckElementBase& AddGenericFloorElement(); - TIGL_EXPORT virtual void RemoveGenericFloorElement(CPACSDeckElementBase& ref); + TIGL_EXPORT virtual CPACSVehicleElementBase& AddGenericFloorElement(); + TIGL_EXPORT virtual void RemoveGenericFloorElement(CPACSVehicleElementBase& ref); protected: CPACSDeckElements* m_parent; @@ -81,7 +81,7 @@ namespace generated CTiglUIDManager* m_uidMgr; /// Generic floor element for use in the decks - std::vector> m_genericFloorElements; + std::vector> m_genericFloorElements; private: CPACSGenericFloorElements(const CPACSGenericFloorElements&) = delete; @@ -94,6 +94,6 @@ namespace generated // Aliases in tigl namespace using CCPACSGenericFloorElements = generated::CPACSGenericFloorElements; -using CCPACSDeckElementBase = generated::CPACSDeckElementBase; +using CCPACSVehicleElementBase = generated::CPACSVehicleElementBase; using CCPACSDeckElements = generated::CPACSDeckElements; } // namespace tigl diff --git a/src/generated/CPACSGenericFloorModules.cpp b/src/generated/CPACSGenericFloorModules.cpp new file mode 100644 index 0000000000..5c98edb221 --- /dev/null +++ b/src/generated/CPACSGenericFloorModules.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "CCPACSDeck.h" +#include "CPACSGenericFloorModules.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSGenericFloorModules::CPACSGenericFloorModules(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSGenericFloorModules::~CPACSGenericFloorModules() + { + } + + const CCPACSDeck* CPACSGenericFloorModules::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSGenericFloorModules::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSGenericFloorModules::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSGenericFloorModules::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSGenericFloorModules::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSGenericFloorModules::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSGenericFloorModules::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element genericFloorModule + if (tixi::TixiCheckElement(tixiHandle, xpath + "/genericFloorModule")) { + tixi::TixiReadElements(tixiHandle, xpath + "/genericFloorModule", m_genericFloorModules, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSGenericFloorModules::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element genericFloorModule + tixi::TixiSaveElements(tixiHandle, xpath + "/genericFloorModule", m_genericFloorModules); + + } + + const std::vector>& CPACSGenericFloorModules::GetGenericFloorModules() const + { + return m_genericFloorModules; + } + + std::vector>& CPACSGenericFloorModules::GetGenericFloorModules() + { + return m_genericFloorModules; + } + + size_t CPACSGenericFloorModules::GetGenericFloorModuleCount() const + { + return m_genericFloorModules.size(); + } + + size_t CPACSGenericFloorModules::GetGenericFloorModuleIndex(const std::string& UID) const + { + for (size_t i=0; i < GetGenericFloorModuleCount(); i++) { + const std::string tmpUID(m_genericFloorModules[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSGenericFloorModules::GetGenericFloorModuleIndex", TIGL_UID_ERROR); + } + + CCPACSDeckComponentBase& CPACSGenericFloorModules::GetGenericFloorModule(size_t index) + { + if (index < 1 || index > GetGenericFloorModuleCount()) { + throw CTiglError("Invalid index in std::vector>::GetGenericFloorModule", TIGL_INDEX_ERROR); + } + index--; + return *m_genericFloorModules[index]; + } + + const CCPACSDeckComponentBase& CPACSGenericFloorModules::GetGenericFloorModule(size_t index) const + { + if (index < 1 || index > GetGenericFloorModuleCount()) { + throw CTiglError("Invalid index in std::vector>::GetGenericFloorModule", TIGL_INDEX_ERROR); + } + index--; + return *m_genericFloorModules[index]; + } + + CCPACSDeckComponentBase& CPACSGenericFloorModules::GetGenericFloorModule(const std::string& UID) + { + for (auto& elem : m_genericFloorModules ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSGenericFloorModules::GetGenericFloorModule. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CCPACSDeckComponentBase& CPACSGenericFloorModules::GetGenericFloorModule(const std::string& UID) const + { + for (auto& elem : m_genericFloorModules ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSGenericFloorModules::GetGenericFloorModule. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CCPACSDeckComponentBase& CPACSGenericFloorModules::AddGenericFloorModule() + { + m_genericFloorModules.push_back(std::make_unique(this, m_uidMgr)); + return *m_genericFloorModules.back(); + } + + void CPACSGenericFloorModules::RemoveGenericFloorModule(CCPACSDeckComponentBase& ref) + { + for (std::size_t i = 0; i < m_genericFloorModules.size(); i++) { + if (m_genericFloorModules[i].get() == &ref) { + m_genericFloorModules.erase(m_genericFloorModules.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSGenericFloorModules.h b/src/generated/CPACSGenericFloorModules.h new file mode 100644 index 0000000000..e4022497c8 --- /dev/null +++ b/src/generated/CPACSGenericFloorModules.h @@ -0,0 +1,96 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeckComponentBase; +class CCPACSDeck; + +namespace generated +{ + // This class is used in: + // CPACSDeck + + /// @brief Generic floor modules + /// + /// Generic floor module instance collection type. + /// + class CPACSGenericFloorModules + { + public: + TIGL_EXPORT CPACSGenericFloorModules(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSGenericFloorModules(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetGenericFloorModules() const; + TIGL_EXPORT virtual std::vector>& GetGenericFloorModules(); + + TIGL_EXPORT virtual size_t GetGenericFloorModuleCount() const; + TIGL_EXPORT virtual size_t GetGenericFloorModuleIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetGenericFloorModule(size_t index) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetGenericFloorModule(size_t index); + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetGenericFloorModule(const std::string& UID) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetGenericFloorModule(const std::string& UID); + + TIGL_EXPORT virtual CCPACSDeckComponentBase& AddGenericFloorModule(); + TIGL_EXPORT virtual void RemoveGenericFloorModule(CCPACSDeckComponentBase& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + /// Generic floor module + std::vector> m_genericFloorModules; + + private: + CPACSGenericFloorModules(const CPACSGenericFloorModules&) = delete; + CPACSGenericFloorModules& operator=(const CPACSGenericFloorModules&) = delete; + + CPACSGenericFloorModules(CPACSGenericFloorModules&&) = delete; + CPACSGenericFloorModules& operator=(CPACSGenericFloorModules&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSGenericFloorModules = generated::CPACSGenericFloorModules; +} // namespace tigl diff --git a/src/generated/CPACSGenericGeometryComponent.cpp b/src/generated/CPACSGenericGeometryComponent.cpp deleted file mode 100644 index 811e3ffbbf..0000000000 --- a/src/generated/CPACSGenericGeometryComponent.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) 2020 RISC Software GmbH -// -// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). -// Do not edit, all changes are lost when files are re-generated. -// -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include "CPACSDeckElementGeometry.h" -#include "CPACSGenericGeometryComponent.h" -#include "CTiglError.h" -#include "CTiglLogging.h" -#include "CTiglUIDManager.h" -#include "CTiglUIDObject.h" -#include "TixiHelper.h" - -namespace tigl -{ -namespace generated -{ - CPACSGenericGeometryComponent::CPACSGenericGeometryComponent(CPACSDeckElementGeometry* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - , m_linkToFile(this) - , m_transformation(this, m_uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - } - - CPACSGenericGeometryComponent::~CPACSGenericGeometryComponent() - { - } - - const CPACSDeckElementGeometry* CPACSGenericGeometryComponent::GetParent() const - { - return m_parent; - } - - CPACSDeckElementGeometry* CPACSGenericGeometryComponent::GetParent() - { - return m_parent; - } - - const CTiglUIDObject* CPACSGenericGeometryComponent::GetNextUIDParent() const - { - if (m_parent) { - return m_parent->GetNextUIDParent(); - } - return nullptr; - } - - CTiglUIDObject* CPACSGenericGeometryComponent::GetNextUIDParent() - { - if (m_parent) { - return m_parent->GetNextUIDParent(); - } - return nullptr; - } - - CTiglUIDManager& CPACSGenericGeometryComponent::GetUIDManager() - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - const CTiglUIDManager& CPACSGenericGeometryComponent::GetUIDManager() const - { - if (!m_uidMgr) { - throw CTiglError("UIDManager is null"); - } - return *m_uidMgr; - } - - void CPACSGenericGeometryComponent::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) - { - // read element linkToFile - if (tixi::TixiCheckElement(tixiHandle, xpath + "/linkToFile")) { - m_linkToFile.ReadCPACS(tixiHandle, xpath + "/linkToFile"); - } - else { - LOG(ERROR) << "Required element linkToFile is missing at xpath " << xpath; - } - - // read element transformation - if (tixi::TixiCheckElement(tixiHandle, xpath + "/transformation")) { - m_transformation.ReadCPACS(tixiHandle, xpath + "/transformation"); - } - else { - LOG(ERROR) << "Required element transformation is missing at xpath " << xpath; - } - - } - - void CPACSGenericGeometryComponent::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const - { - // write element linkToFile - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/linkToFile"); - m_linkToFile.WriteCPACS(tixiHandle, xpath + "/linkToFile"); - - // write element transformation - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/transformation"); - m_transformation.WriteCPACS(tixiHandle, xpath + "/transformation"); - - } - - const CPACSLinkToFile& CPACSGenericGeometryComponent::GetLinkToFile() const - { - return m_linkToFile; - } - - CPACSLinkToFile& CPACSGenericGeometryComponent::GetLinkToFile() - { - return m_linkToFile; - } - - const CCPACSTransformation& CPACSGenericGeometryComponent::GetTransformation() const - { - return m_transformation; - } - - CCPACSTransformation& CPACSGenericGeometryComponent::GetTransformation() - { - return m_transformation; - } - -} // namespace generated -} // namespace tigl diff --git a/src/generated/CPACSLavatories.cpp b/src/generated/CPACSLavatories.cpp new file mode 100644 index 0000000000..9a83a62f6f --- /dev/null +++ b/src/generated/CPACSLavatories.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "CCPACSDeck.h" +#include "CPACSLavatories.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSLavatories::CPACSLavatories(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSLavatories::~CPACSLavatories() + { + } + + const CCPACSDeck* CPACSLavatories::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSLavatories::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSLavatories::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSLavatories::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSLavatories::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSLavatories::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSLavatories::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element lavatory + if (tixi::TixiCheckElement(tixiHandle, xpath + "/lavatory")) { + tixi::TixiReadElements(tixiHandle, xpath + "/lavatory", m_lavatorys, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSLavatories::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element lavatory + tixi::TixiSaveElements(tixiHandle, xpath + "/lavatory", m_lavatorys); + + } + + const std::vector>& CPACSLavatories::GetLavatorys() const + { + return m_lavatorys; + } + + std::vector>& CPACSLavatories::GetLavatorys() + { + return m_lavatorys; + } + + size_t CPACSLavatories::GetLavatoryCount() const + { + return m_lavatorys.size(); + } + + size_t CPACSLavatories::GetLavatoryIndex(const std::string& UID) const + { + for (size_t i=0; i < GetLavatoryCount(); i++) { + const std::string tmpUID(m_lavatorys[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSLavatories::GetLavatoryIndex", TIGL_UID_ERROR); + } + + CCPACSDeckComponentBase& CPACSLavatories::GetLavatory(size_t index) + { + if (index < 1 || index > GetLavatoryCount()) { + throw CTiglError("Invalid index in std::vector>::GetLavatory", TIGL_INDEX_ERROR); + } + index--; + return *m_lavatorys[index]; + } + + const CCPACSDeckComponentBase& CPACSLavatories::GetLavatory(size_t index) const + { + if (index < 1 || index > GetLavatoryCount()) { + throw CTiglError("Invalid index in std::vector>::GetLavatory", TIGL_INDEX_ERROR); + } + index--; + return *m_lavatorys[index]; + } + + CCPACSDeckComponentBase& CPACSLavatories::GetLavatory(const std::string& UID) + { + for (auto& elem : m_lavatorys ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSLavatories::GetLavatory. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CCPACSDeckComponentBase& CPACSLavatories::GetLavatory(const std::string& UID) const + { + for (auto& elem : m_lavatorys ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSLavatories::GetLavatory. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CCPACSDeckComponentBase& CPACSLavatories::AddLavatory() + { + m_lavatorys.push_back(std::make_unique(this, m_uidMgr)); + return *m_lavatorys.back(); + } + + void CPACSLavatories::RemoveLavatory(CCPACSDeckComponentBase& ref) + { + for (std::size_t i = 0; i < m_lavatorys.size(); i++) { + if (m_lavatorys[i].get() == &ref) { + m_lavatorys.erase(m_lavatorys.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSLavatories.h b/src/generated/CPACSLavatories.h new file mode 100644 index 0000000000..765bf0e97d --- /dev/null +++ b/src/generated/CPACSLavatories.h @@ -0,0 +1,96 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeckComponentBase; +class CCPACSDeck; + +namespace generated +{ + // This class is used in: + // CPACSDeck + + /// @brief Lavatories + /// + /// Lavatory instance collection type. + /// + class CPACSLavatories + { + public: + TIGL_EXPORT CPACSLavatories(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSLavatories(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetLavatorys() const; + TIGL_EXPORT virtual std::vector>& GetLavatorys(); + + TIGL_EXPORT virtual size_t GetLavatoryCount() const; + TIGL_EXPORT virtual size_t GetLavatoryIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetLavatory(size_t index) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetLavatory(size_t index); + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetLavatory(const std::string& UID) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetLavatory(const std::string& UID); + + TIGL_EXPORT virtual CCPACSDeckComponentBase& AddLavatory(); + TIGL_EXPORT virtual void RemoveLavatory(CCPACSDeckComponentBase& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + /// Lavatory + std::vector> m_lavatorys; + + private: + CPACSLavatories(const CPACSLavatories&) = delete; + CPACSLavatories& operator=(const CPACSLavatories&) = delete; + + CPACSLavatories(CPACSLavatories&&) = delete; + CPACSLavatories& operator=(CPACSLavatories&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSLavatories = generated::CPACSLavatories; +} // namespace tigl diff --git a/src/generated/CPACSLavatoryElements.cpp b/src/generated/CPACSLavatoryElements.cpp index 259a5a9a23..99958bc7af 100644 --- a/src/generated/CPACSLavatoryElements.cpp +++ b/src/generated/CPACSLavatoryElements.cpp @@ -16,9 +16,9 @@ // limitations under the License. #include -#include "CPACSDeckElementBase.h" #include "CPACSDeckElements.h" #include "CPACSLavatoryElements.h" +#include "CPACSVehicleElementBase.h" #include "CTiglError.h" #include "CTiglLogging.h" #include "CTiglUIDManager.h" @@ -98,12 +98,12 @@ namespace generated } - const std::vector>& CPACSLavatoryElements::GetLavatoryElements() const + const std::vector>& CPACSLavatoryElements::GetLavatoryElements() const { return m_lavatoryElements; } - std::vector>& CPACSLavatoryElements::GetLavatoryElements() + std::vector>& CPACSLavatoryElements::GetLavatoryElements() { return m_lavatoryElements; } @@ -124,25 +124,25 @@ namespace generated throw CTiglError("Invalid UID in CPACSLavatoryElements::GetLavatoryElementIndex", TIGL_UID_ERROR); } - CPACSDeckElementBase& CPACSLavatoryElements::GetLavatoryElement(size_t index) + CPACSVehicleElementBase& CPACSLavatoryElements::GetLavatoryElement(size_t index) { if (index < 1 || index > GetLavatoryElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetLavatoryElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetLavatoryElement", TIGL_INDEX_ERROR); } index--; return *m_lavatoryElements[index]; } - const CPACSDeckElementBase& CPACSLavatoryElements::GetLavatoryElement(size_t index) const + const CPACSVehicleElementBase& CPACSLavatoryElements::GetLavatoryElement(size_t index) const { if (index < 1 || index > GetLavatoryElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetLavatoryElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetLavatoryElement", TIGL_INDEX_ERROR); } index--; return *m_lavatoryElements[index]; } - CPACSDeckElementBase& CPACSLavatoryElements::GetLavatoryElement(const std::string& UID) + CPACSVehicleElementBase& CPACSLavatoryElements::GetLavatoryElement(const std::string& UID) { for (auto& elem : m_lavatoryElements ) { if (elem->GetUID() == UID) @@ -151,7 +151,7 @@ namespace generated throw CTiglError("Invalid UID in CPACSLavatoryElements::GetLavatoryElement. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); } - const CPACSDeckElementBase& CPACSLavatoryElements::GetLavatoryElement(const std::string& UID) const + const CPACSVehicleElementBase& CPACSLavatoryElements::GetLavatoryElement(const std::string& UID) const { for (auto& elem : m_lavatoryElements ) { if (elem->GetUID() == UID) @@ -161,13 +161,13 @@ namespace generated } - CPACSDeckElementBase& CPACSLavatoryElements::AddLavatoryElement() + CPACSVehicleElementBase& CPACSLavatoryElements::AddLavatoryElement() { - m_lavatoryElements.push_back(std::make_unique(this, m_uidMgr)); + m_lavatoryElements.push_back(std::make_unique(this, m_uidMgr)); return *m_lavatoryElements.back(); } - void CPACSLavatoryElements::RemoveLavatoryElement(CPACSDeckElementBase& ref) + void CPACSLavatoryElements::RemoveLavatoryElement(CPACSVehicleElementBase& ref) { for (std::size_t i = 0; i < m_lavatoryElements.size(); i++) { if (m_lavatoryElements[i].get() == &ref) { diff --git a/src/generated/CPACSLavatoryElements.h b/src/generated/CPACSLavatoryElements.h index 6c98eb00f5..ee77ff3336 100644 --- a/src/generated/CPACSLavatoryElements.h +++ b/src/generated/CPACSLavatoryElements.h @@ -30,7 +30,7 @@ class CTiglUIDObject; namespace generated { - class CPACSDeckElementBase; + class CPACSVehicleElementBase; class CPACSDeckElements; // This class is used in: @@ -60,20 +60,20 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const std::vector>& GetLavatoryElements() const; - TIGL_EXPORT virtual std::vector>& GetLavatoryElements(); + TIGL_EXPORT virtual const std::vector>& GetLavatoryElements() const; + TIGL_EXPORT virtual std::vector>& GetLavatoryElements(); TIGL_EXPORT virtual size_t GetLavatoryElementCount() const; TIGL_EXPORT virtual size_t GetLavatoryElementIndex(const std::string& UID) const; - TIGL_EXPORT virtual const CPACSDeckElementBase& GetLavatoryElement(size_t index) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetLavatoryElement(size_t index); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetLavatoryElement(size_t index) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetLavatoryElement(size_t index); - TIGL_EXPORT virtual const CPACSDeckElementBase& GetLavatoryElement(const std::string& UID) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetLavatoryElement(const std::string& UID); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetLavatoryElement(const std::string& UID) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetLavatoryElement(const std::string& UID); - TIGL_EXPORT virtual CPACSDeckElementBase& AddLavatoryElement(); - TIGL_EXPORT virtual void RemoveLavatoryElement(CPACSDeckElementBase& ref); + TIGL_EXPORT virtual CPACSVehicleElementBase& AddLavatoryElement(); + TIGL_EXPORT virtual void RemoveLavatoryElement(CPACSVehicleElementBase& ref); protected: CPACSDeckElements* m_parent; @@ -81,7 +81,7 @@ namespace generated CTiglUIDManager* m_uidMgr; /// Lavatory element for use in the decks - std::vector> m_lavatoryElements; + std::vector> m_lavatoryElements; private: CPACSLavatoryElements(const CPACSLavatoryElements&) = delete; @@ -94,6 +94,6 @@ namespace generated // Aliases in tigl namespace using CCPACSLavatoryElements = generated::CPACSLavatoryElements; -using CCPACSDeckElementBase = generated::CPACSDeckElementBase; +using CCPACSVehicleElementBase = generated::CPACSVehicleElementBase; using CCPACSDeckElements = generated::CPACSDeckElements; } // namespace tigl diff --git a/src/generated/CPACSLinkToFile.cpp b/src/generated/CPACSLinkToFile.cpp index 8e0de2f072..a2a249c333 100644 --- a/src/generated/CPACSLinkToFile.cpp +++ b/src/generated/CPACSLinkToFile.cpp @@ -18,7 +18,6 @@ #include #include "CCPACSExternalObject.h" #include "CPACSExternalGeometry.h" -#include "CPACSGenericGeometryComponent.h" #include "CPACSLinkToFile.h" #include "CTiglError.h" #include "CTiglLogging.h" @@ -43,13 +42,6 @@ namespace generated m_parentType = &typeid(CCPACSExternalObject); } - CPACSLinkToFile::CPACSLinkToFile(CPACSGenericGeometryComponent* parent) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSGenericGeometryComponent); - } - CPACSLinkToFile::~CPACSLinkToFile() { } @@ -63,9 +55,6 @@ namespace generated if (IsParent()) { return GetParent(); } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } } return nullptr; } @@ -79,9 +68,6 @@ namespace generated if (IsParent()) { return GetParent(); } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } } return nullptr; } diff --git a/src/generated/CPACSLinkToFile.h b/src/generated/CPACSLinkToFile.h index 2d6609ca83..ac6851a947 100644 --- a/src/generated/CPACSLinkToFile.h +++ b/src/generated/CPACSLinkToFile.h @@ -34,12 +34,10 @@ class CCPACSExternalObject; namespace generated { class CPACSExternalGeometry; - class CPACSGenericGeometryComponent; // This class is used in: // CPACSExternalGeometry // CPACSGenericGeometricComponent - // CPACSGenericGeometryComponent /// @brief Link to file (Step, Iges or Stl) /// @@ -54,7 +52,6 @@ namespace generated public: TIGL_EXPORT CPACSLinkToFile(CPACSExternalGeometry* parent); TIGL_EXPORT CPACSLinkToFile(CCPACSExternalObject* parent); - TIGL_EXPORT CPACSLinkToFile(CPACSGenericGeometryComponent* parent); TIGL_EXPORT virtual ~CPACSLinkToFile(); @@ -67,7 +64,7 @@ namespace generated template P* GetParent() { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSLinkToFile"); + static_assert(std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSLinkToFile"); if (!IsParent

()) { throw CTiglError("bad parent"); } @@ -77,7 +74,7 @@ namespace generated template const P* GetParent() const { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSLinkToFile"); + static_assert(std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSLinkToFile"); if (!IsParent

()) { throw CTiglError("bad parent"); } @@ -115,5 +112,4 @@ namespace generated // Aliases in tigl namespace using CCPACSLinkToFile = generated::CPACSLinkToFile; using CCPACSExternalGeometry = generated::CPACSExternalGeometry; -using CCPACSGenericGeometryComponent = generated::CPACSGenericGeometryComponent; } // namespace tigl diff --git a/src/generated/CPACSLuggageCompartmentElements.cpp b/src/generated/CPACSLuggageCompartmentElements.cpp index 9d6ea4e048..7f24f796a1 100644 --- a/src/generated/CPACSLuggageCompartmentElements.cpp +++ b/src/generated/CPACSLuggageCompartmentElements.cpp @@ -16,9 +16,9 @@ // limitations under the License. #include -#include "CPACSDeckElementBase.h" #include "CPACSDeckElements.h" #include "CPACSLuggageCompartmentElements.h" +#include "CPACSVehicleElementBase.h" #include "CTiglError.h" #include "CTiglLogging.h" #include "CTiglUIDManager.h" @@ -98,12 +98,12 @@ namespace generated } - const std::vector>& CPACSLuggageCompartmentElements::GetLuggageCompartmentElements() const + const std::vector>& CPACSLuggageCompartmentElements::GetLuggageCompartmentElements() const { return m_luggageCompartmentElements; } - std::vector>& CPACSLuggageCompartmentElements::GetLuggageCompartmentElements() + std::vector>& CPACSLuggageCompartmentElements::GetLuggageCompartmentElements() { return m_luggageCompartmentElements; } @@ -124,25 +124,25 @@ namespace generated throw CTiglError("Invalid UID in CPACSLuggageCompartmentElements::GetLuggageCompartmentElementIndex", TIGL_UID_ERROR); } - CPACSDeckElementBase& CPACSLuggageCompartmentElements::GetLuggageCompartmentElement(size_t index) + CPACSVehicleElementBase& CPACSLuggageCompartmentElements::GetLuggageCompartmentElement(size_t index) { if (index < 1 || index > GetLuggageCompartmentElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetLuggageCompartmentElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetLuggageCompartmentElement", TIGL_INDEX_ERROR); } index--; return *m_luggageCompartmentElements[index]; } - const CPACSDeckElementBase& CPACSLuggageCompartmentElements::GetLuggageCompartmentElement(size_t index) const + const CPACSVehicleElementBase& CPACSLuggageCompartmentElements::GetLuggageCompartmentElement(size_t index) const { if (index < 1 || index > GetLuggageCompartmentElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetLuggageCompartmentElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetLuggageCompartmentElement", TIGL_INDEX_ERROR); } index--; return *m_luggageCompartmentElements[index]; } - CPACSDeckElementBase& CPACSLuggageCompartmentElements::GetLuggageCompartmentElement(const std::string& UID) + CPACSVehicleElementBase& CPACSLuggageCompartmentElements::GetLuggageCompartmentElement(const std::string& UID) { for (auto& elem : m_luggageCompartmentElements ) { if (elem->GetUID() == UID) @@ -151,7 +151,7 @@ namespace generated throw CTiglError("Invalid UID in CPACSLuggageCompartmentElements::GetLuggageCompartmentElement. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); } - const CPACSDeckElementBase& CPACSLuggageCompartmentElements::GetLuggageCompartmentElement(const std::string& UID) const + const CPACSVehicleElementBase& CPACSLuggageCompartmentElements::GetLuggageCompartmentElement(const std::string& UID) const { for (auto& elem : m_luggageCompartmentElements ) { if (elem->GetUID() == UID) @@ -161,13 +161,13 @@ namespace generated } - CPACSDeckElementBase& CPACSLuggageCompartmentElements::AddLuggageCompartmentElement() + CPACSVehicleElementBase& CPACSLuggageCompartmentElements::AddLuggageCompartmentElement() { - m_luggageCompartmentElements.push_back(std::make_unique(this, m_uidMgr)); + m_luggageCompartmentElements.push_back(std::make_unique(this, m_uidMgr)); return *m_luggageCompartmentElements.back(); } - void CPACSLuggageCompartmentElements::RemoveLuggageCompartmentElement(CPACSDeckElementBase& ref) + void CPACSLuggageCompartmentElements::RemoveLuggageCompartmentElement(CPACSVehicleElementBase& ref) { for (std::size_t i = 0; i < m_luggageCompartmentElements.size(); i++) { if (m_luggageCompartmentElements[i].get() == &ref) { diff --git a/src/generated/CPACSLuggageCompartmentElements.h b/src/generated/CPACSLuggageCompartmentElements.h index 71224e3232..2e873c75e6 100644 --- a/src/generated/CPACSLuggageCompartmentElements.h +++ b/src/generated/CPACSLuggageCompartmentElements.h @@ -30,7 +30,7 @@ class CTiglUIDObject; namespace generated { - class CPACSDeckElementBase; + class CPACSVehicleElementBase; class CPACSDeckElements; // This class is used in: @@ -60,20 +60,20 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const std::vector>& GetLuggageCompartmentElements() const; - TIGL_EXPORT virtual std::vector>& GetLuggageCompartmentElements(); + TIGL_EXPORT virtual const std::vector>& GetLuggageCompartmentElements() const; + TIGL_EXPORT virtual std::vector>& GetLuggageCompartmentElements(); TIGL_EXPORT virtual size_t GetLuggageCompartmentElementCount() const; TIGL_EXPORT virtual size_t GetLuggageCompartmentElementIndex(const std::string& UID) const; - TIGL_EXPORT virtual const CPACSDeckElementBase& GetLuggageCompartmentElement(size_t index) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetLuggageCompartmentElement(size_t index); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetLuggageCompartmentElement(size_t index) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetLuggageCompartmentElement(size_t index); - TIGL_EXPORT virtual const CPACSDeckElementBase& GetLuggageCompartmentElement(const std::string& UID) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetLuggageCompartmentElement(const std::string& UID); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetLuggageCompartmentElement(const std::string& UID) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetLuggageCompartmentElement(const std::string& UID); - TIGL_EXPORT virtual CPACSDeckElementBase& AddLuggageCompartmentElement(); - TIGL_EXPORT virtual void RemoveLuggageCompartmentElement(CPACSDeckElementBase& ref); + TIGL_EXPORT virtual CPACSVehicleElementBase& AddLuggageCompartmentElement(); + TIGL_EXPORT virtual void RemoveLuggageCompartmentElement(CPACSVehicleElementBase& ref); protected: CPACSDeckElements* m_parent; @@ -81,7 +81,7 @@ namespace generated CTiglUIDManager* m_uidMgr; /// Luggage compartment element for use in the decks - std::vector> m_luggageCompartmentElements; + std::vector> m_luggageCompartmentElements; private: CPACSLuggageCompartmentElements(const CPACSLuggageCompartmentElements&) = delete; @@ -94,6 +94,6 @@ namespace generated // Aliases in tigl namespace using CCPACSLuggageCompartmentElements = generated::CPACSLuggageCompartmentElements; -using CCPACSDeckElementBase = generated::CPACSDeckElementBase; +using CCPACSVehicleElementBase = generated::CPACSVehicleElementBase; using CCPACSDeckElements = generated::CPACSDeckElements; } // namespace tigl diff --git a/src/generated/CPACSLuggageCompartments.cpp b/src/generated/CPACSLuggageCompartments.cpp new file mode 100644 index 0000000000..f2722d3720 --- /dev/null +++ b/src/generated/CPACSLuggageCompartments.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "CCPACSDeck.h" +#include "CPACSLuggageCompartments.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSLuggageCompartments::CPACSLuggageCompartments(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSLuggageCompartments::~CPACSLuggageCompartments() + { + } + + const CCPACSDeck* CPACSLuggageCompartments::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSLuggageCompartments::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSLuggageCompartments::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSLuggageCompartments::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSLuggageCompartments::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSLuggageCompartments::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSLuggageCompartments::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element luggageCompartment + if (tixi::TixiCheckElement(tixiHandle, xpath + "/luggageCompartment")) { + tixi::TixiReadElements(tixiHandle, xpath + "/luggageCompartment", m_luggageCompartments, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSLuggageCompartments::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element luggageCompartment + tixi::TixiSaveElements(tixiHandle, xpath + "/luggageCompartment", m_luggageCompartments); + + } + + const std::vector>& CPACSLuggageCompartments::GetLuggageCompartments() const + { + return m_luggageCompartments; + } + + std::vector>& CPACSLuggageCompartments::GetLuggageCompartments() + { + return m_luggageCompartments; + } + + size_t CPACSLuggageCompartments::GetLuggageCompartmentCount() const + { + return m_luggageCompartments.size(); + } + + size_t CPACSLuggageCompartments::GetLuggageCompartmentIndex(const std::string& UID) const + { + for (size_t i=0; i < GetLuggageCompartmentCount(); i++) { + const std::string tmpUID(m_luggageCompartments[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSLuggageCompartments::GetLuggageCompartmentIndex", TIGL_UID_ERROR); + } + + CCPACSDeckComponentBase& CPACSLuggageCompartments::GetLuggageCompartment(size_t index) + { + if (index < 1 || index > GetLuggageCompartmentCount()) { + throw CTiglError("Invalid index in std::vector>::GetLuggageCompartment", TIGL_INDEX_ERROR); + } + index--; + return *m_luggageCompartments[index]; + } + + const CCPACSDeckComponentBase& CPACSLuggageCompartments::GetLuggageCompartment(size_t index) const + { + if (index < 1 || index > GetLuggageCompartmentCount()) { + throw CTiglError("Invalid index in std::vector>::GetLuggageCompartment", TIGL_INDEX_ERROR); + } + index--; + return *m_luggageCompartments[index]; + } + + CCPACSDeckComponentBase& CPACSLuggageCompartments::GetLuggageCompartment(const std::string& UID) + { + for (auto& elem : m_luggageCompartments ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSLuggageCompartments::GetLuggageCompartment. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CCPACSDeckComponentBase& CPACSLuggageCompartments::GetLuggageCompartment(const std::string& UID) const + { + for (auto& elem : m_luggageCompartments ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSLuggageCompartments::GetLuggageCompartment. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CCPACSDeckComponentBase& CPACSLuggageCompartments::AddLuggageCompartment() + { + m_luggageCompartments.push_back(std::make_unique(this, m_uidMgr)); + return *m_luggageCompartments.back(); + } + + void CPACSLuggageCompartments::RemoveLuggageCompartment(CCPACSDeckComponentBase& ref) + { + for (std::size_t i = 0; i < m_luggageCompartments.size(); i++) { + if (m_luggageCompartments[i].get() == &ref) { + m_luggageCompartments.erase(m_luggageCompartments.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSLuggageCompartments.h b/src/generated/CPACSLuggageCompartments.h new file mode 100644 index 0000000000..3df854d5fa --- /dev/null +++ b/src/generated/CPACSLuggageCompartments.h @@ -0,0 +1,95 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeckComponentBase; +class CCPACSDeck; + +namespace generated +{ + // This class is used in: + // CPACSDeck + + /// @brief Luggage compartments + /// + /// + class CPACSLuggageCompartments + { + public: + TIGL_EXPORT CPACSLuggageCompartments(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSLuggageCompartments(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetLuggageCompartments() const; + TIGL_EXPORT virtual std::vector>& GetLuggageCompartments(); + + TIGL_EXPORT virtual size_t GetLuggageCompartmentCount() const; + TIGL_EXPORT virtual size_t GetLuggageCompartmentIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetLuggageCompartment(size_t index) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetLuggageCompartment(size_t index); + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetLuggageCompartment(const std::string& UID) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetLuggageCompartment(const std::string& UID); + + TIGL_EXPORT virtual CCPACSDeckComponentBase& AddLuggageCompartment(); + TIGL_EXPORT virtual void RemoveLuggageCompartment(CCPACSDeckComponentBase& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + /// Luggage compartment + std::vector> m_luggageCompartments; + + private: + CPACSLuggageCompartments(const CPACSLuggageCompartments&) = delete; + CPACSLuggageCompartments& operator=(const CPACSLuggageCompartments&) = delete; + + CPACSLuggageCompartments(CPACSLuggageCompartments&&) = delete; + CPACSLuggageCompartments& operator=(CPACSLuggageCompartments&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSLuggageCompartments = generated::CPACSLuggageCompartments; +} // namespace tigl diff --git a/src/generated/CPACSMassInertia.cpp b/src/generated/CPACSMassInertia.cpp index 63fb8a9c01..8c77713def 100644 --- a/src/generated/CPACSMassInertia.cpp +++ b/src/generated/CPACSMassInertia.cpp @@ -16,7 +16,6 @@ // limitations under the License. #include -#include "CPACSDeckElementMass.h" #include "CPACSElementMass.h" #include "CPACSMassInertia.h" #include "CTiglError.h" @@ -28,39 +27,33 @@ namespace tigl { namespace generated { - CPACSMassInertia::CPACSMassInertia(CPACSDeckElementMass* parent) + CPACSMassInertia::CPACSMassInertia(CPACSElementMass* parent) : m_Jxx(0) , m_Jyy(0) , m_Jzz(0) { //assert(parent != NULL); m_parent = parent; - m_parentType = &typeid(CPACSDeckElementMass); } - CPACSMassInertia::CPACSMassInertia(CPACSElementMass* parent) - : m_Jxx(0) - , m_Jyy(0) - , m_Jzz(0) + CPACSMassInertia::~CPACSMassInertia() { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSElementMass); } - CPACSMassInertia::~CPACSMassInertia() + const CPACSElementMass* CPACSMassInertia::GetParent() const + { + return m_parent; + } + + CPACSElementMass* CPACSMassInertia::GetParent() { + return m_parent; } const CTiglUIDObject* CPACSMassInertia::GetNextUIDParent() const { if (m_parent) { - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } + return m_parent->GetNextUIDParent(); } return nullptr; } @@ -68,12 +61,7 @@ namespace generated CTiglUIDObject* CPACSMassInertia::GetNextUIDParent() { if (m_parent) { - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } + return m_parent->GetNextUIDParent(); } return nullptr; } diff --git a/src/generated/CPACSMassInertia.h b/src/generated/CPACSMassInertia.h index ebdc593e11..2c445c17c2 100644 --- a/src/generated/CPACSMassInertia.h +++ b/src/generated/CPACSMassInertia.h @@ -21,8 +21,6 @@ #include #include #include -#include -#include "CTiglError.h" #include "tigl_internal.h" namespace tigl @@ -31,11 +29,9 @@ class CTiglUIDObject; namespace generated { - class CPACSDeckElementMass; class CPACSElementMass; // This class is used in: - // CPACSDeckElementMass // CPACSElementMass /// @brief Mass intertia @@ -45,36 +41,13 @@ namespace generated class CPACSMassInertia { public: - TIGL_EXPORT CPACSMassInertia(CPACSDeckElementMass* parent); TIGL_EXPORT CPACSMassInertia(CPACSElementMass* parent); TIGL_EXPORT virtual ~CPACSMassInertia(); - template - bool IsParent() const - { - return m_parentType != NULL && *m_parentType == typeid(P); - } - - template - P* GetParent() - { - static_assert(std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSMassInertia"); - if (!IsParent

()) { - throw CTiglError("bad parent"); - } - return static_cast(m_parent); - } - - template - const P* GetParent() const - { - static_assert(std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSMassInertia"); - if (!IsParent

()) { - throw CTiglError("bad parent"); - } - return static_cast(m_parent); - } + TIGL_EXPORT CPACSElementMass* GetParent(); + + TIGL_EXPORT const CPACSElementMass* GetParent() const; TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; @@ -101,8 +74,7 @@ namespace generated TIGL_EXPORT virtual void SetJyz(const boost::optional& value); protected: - void* m_parent; - const std::type_info* m_parentType; + CPACSElementMass* m_parent; double m_Jxx; double m_Jyy; @@ -122,6 +94,5 @@ namespace generated // Aliases in tigl namespace using CCPACSMassInertia = generated::CPACSMassInertia; -using CCPACSDeckElementMass = generated::CPACSDeckElementMass; using CCPACSElementMass = generated::CPACSElementMass; } // namespace tigl diff --git a/src/generated/CPACSPoint.cpp b/src/generated/CPACSPoint.cpp index d31ed9dc93..413f4f18fd 100644 --- a/src/generated/CPACSPoint.cpp +++ b/src/generated/CPACSPoint.cpp @@ -18,10 +18,8 @@ #include #include "CCPACSTransformation.h" #include "CCPACSTransformationSE3.h" -#include "CPACSBoundingBox.h" #include "CPACSControlSurfaceHingePoint.h" #include "CPACSControlSurfaceStep.h" -#include "CPACSDeckElementMass.h" #include "CPACSElementMass.h" #include "CPACSPoint.h" #include "CPACSPointList.h" @@ -34,14 +32,6 @@ namespace tigl { namespace generated { - CPACSPoint::CPACSPoint(CPACSBoundingBox* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSBoundingBox); - } - CPACSPoint::CPACSPoint(CPACSControlSurfaceHingePoint* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) { @@ -58,14 +48,6 @@ namespace generated m_parentType = &typeid(CPACSControlSurfaceStep); } - CPACSPoint::CPACSPoint(CPACSDeckElementMass* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSDeckElementMass); - } - CPACSPoint::CPACSPoint(CPACSElementMass* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) { @@ -106,18 +88,12 @@ namespace generated const CTiglUIDObject* CPACSPoint::GetNextUIDParent() const { if (m_parent) { - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } if (IsParent()) { return GetParent()->GetNextUIDParent(); } if (IsParent()) { return GetParent()->GetNextUIDParent(); } - if (IsParent()) { - return GetParent(); - } if (IsParent()) { return GetParent()->GetNextUIDParent(); } @@ -143,18 +119,12 @@ namespace generated CTiglUIDObject* CPACSPoint::GetNextUIDParent() { if (m_parent) { - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } if (IsParent()) { return GetParent()->GetNextUIDParent(); } if (IsParent()) { return GetParent()->GetNextUIDParent(); } - if (IsParent()) { - return GetParent(); - } if (IsParent()) { return GetParent()->GetNextUIDParent(); } diff --git a/src/generated/CPACSPoint.h b/src/generated/CPACSPoint.h index 438f6047ec..6b148e245c 100644 --- a/src/generated/CPACSPoint.h +++ b/src/generated/CPACSPoint.h @@ -34,18 +34,14 @@ class CCPACSTransformationSE3; namespace generated { - class CPACSBoundingBox; class CPACSControlSurfaceHingePoint; class CPACSControlSurfaceStep; - class CPACSDeckElementMass; class CPACSElementMass; class CPACSPointList; // This class is used in: - // CPACSBoundingBox // CPACSControlSurfaceHingePoint // CPACSControlSurfaceStep - // CPACSDeckElementMass // CPACSElementMass // CPACSPointList // CPACSTransformation @@ -58,10 +54,8 @@ namespace generated class CPACSPoint : public CTiglOptUIDObject { public: - TIGL_EXPORT CPACSPoint(CPACSBoundingBox* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSPoint(CPACSControlSurfaceHingePoint* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSPoint(CPACSControlSurfaceStep* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSPoint(CPACSDeckElementMass* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSPoint(CPACSElementMass* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSPoint(CPACSPointList* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSPoint(CCPACSTransformation* parent, CTiglUIDManager* uidMgr); @@ -78,7 +72,7 @@ namespace generated template P* GetParent() { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSPoint"); + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSPoint"); if (!IsParent

()) { throw CTiglError("bad parent"); } @@ -88,7 +82,7 @@ namespace generated template const P* GetParent() const { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSPoint"); + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSPoint"); if (!IsParent

()) { throw CTiglError("bad parent"); } @@ -145,10 +139,8 @@ namespace generated // CPACSPoint is customized, use type CCPACSPoint directly // Aliases in tigl namespace -using CCPACSBoundingBox = generated::CPACSBoundingBox; using CCPACSControlSurfaceHingePoint = generated::CPACSControlSurfaceHingePoint; using CCPACSControlSurfaceStep = generated::CPACSControlSurfaceStep; -using CCPACSDeckElementMass = generated::CPACSDeckElementMass; using CCPACSElementMass = generated::CPACSElementMass; using CCPACSPointList = generated::CPACSPointList; } // namespace tigl diff --git a/src/generated/CPACSSeatElement.cpp b/src/generated/CPACSSeatElement.cpp index 5181670f2e..ae54ed9f3c 100644 --- a/src/generated/CPACSSeatElement.cpp +++ b/src/generated/CPACSSeatElement.cpp @@ -95,6 +95,17 @@ namespace generated LOG(ERROR) << "Required attribute uID is missing at xpath " << xpath; } + // read element name + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { + m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); + if (m_name.empty()) { + LOG(WARNING) << "Required element name is empty at xpath " << xpath; + } + } + else { + LOG(ERROR) << "Required element name is missing at xpath " << xpath; + } + // read element description if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); @@ -141,6 +152,10 @@ namespace generated // write attribute uID tixi::TixiSaveAttribute(tixiHandle, xpath, "uID", m_uID); + // write element name + tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/name"); + tixi::TixiSaveElement(tixiHandle, xpath + "/name", m_name); + // write element description if (m_description) { tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/description"); @@ -198,6 +213,16 @@ namespace generated m_uID = value; } + const std::string& CPACSSeatElement::GetName() const + { + return m_name; + } + + void CPACSSeatElement::SetName(const std::string& value) + { + m_name = value; + } + const boost::optional& CPACSSeatElement::GetDescription() const { return m_description; @@ -208,22 +233,22 @@ namespace generated m_description = value; } - const CPACSDeckElementGeometry& CPACSSeatElement::GetGeometry() const + const CPACSElementGeometry& CPACSSeatElement::GetGeometry() const { return m_geometry; } - CPACSDeckElementGeometry& CPACSSeatElement::GetGeometry() + CPACSElementGeometry& CPACSSeatElement::GetGeometry() { return m_geometry; } - const boost::optional& CPACSSeatElement::GetMass() const + const boost::optional& CPACSSeatElement::GetMass() const { return m_mass; } - boost::optional& CPACSSeatElement::GetMass() + boost::optional& CPACSSeatElement::GetMass() { return m_mass; } @@ -238,7 +263,7 @@ namespace generated return m_numberOfSeats; } - CPACSDeckElementMass& CPACSSeatElement::GetMass(CreateIfNotExistsTag) + CPACSElementMass& CPACSSeatElement::GetMass(CreateIfNotExistsTag) { if (!m_mass) m_mass = boost::in_place(this, m_uidMgr); diff --git a/src/generated/CPACSSeatElement.h b/src/generated/CPACSSeatElement.h index ee7c88c57a..7f10103d8b 100644 --- a/src/generated/CPACSSeatElement.h +++ b/src/generated/CPACSSeatElement.h @@ -21,8 +21,8 @@ #include #include #include -#include "CPACSDeckElementGeometry.h" -#include "CPACSDeckElementMass.h" +#include "CPACSElementGeometry.h" +#include "CPACSElementMass.h" #include "CPACSPosExcl0IntBase.h" #include "CreateIfNotExists.h" #include "CTiglUIDObject.h" @@ -66,19 +66,22 @@ namespace generated TIGL_EXPORT virtual const std::string& GetUID() const; TIGL_EXPORT virtual void SetUID(const std::string& value); + TIGL_EXPORT virtual const std::string& GetName() const; + TIGL_EXPORT virtual void SetName(const std::string& value); + TIGL_EXPORT virtual const boost::optional& GetDescription() const; TIGL_EXPORT virtual void SetDescription(const boost::optional& value); - TIGL_EXPORT virtual const CPACSDeckElementGeometry& GetGeometry() const; - TIGL_EXPORT virtual CPACSDeckElementGeometry& GetGeometry(); + TIGL_EXPORT virtual const CPACSElementGeometry& GetGeometry() const; + TIGL_EXPORT virtual CPACSElementGeometry& GetGeometry(); - TIGL_EXPORT virtual const boost::optional& GetMass() const; - TIGL_EXPORT virtual boost::optional& GetMass(); + TIGL_EXPORT virtual const boost::optional& GetMass() const; + TIGL_EXPORT virtual boost::optional& GetMass(); TIGL_EXPORT virtual const boost::optional& GetNumberOfSeats() const; TIGL_EXPORT virtual boost::optional& GetNumberOfSeats(); - TIGL_EXPORT virtual CPACSDeckElementMass& GetMass(CreateIfNotExistsTag); + TIGL_EXPORT virtual CPACSElementMass& GetMass(CreateIfNotExistsTag); TIGL_EXPORT virtual void RemoveMass(); TIGL_EXPORT virtual CPACSPosExcl0IntBase& GetNumberOfSeats(CreateIfNotExistsTag); @@ -91,12 +94,15 @@ namespace generated std::string m_uID; + /// Name + std::string m_name; + /// Description boost::optional m_description; - CPACSDeckElementGeometry m_geometry; + CPACSElementGeometry m_geometry; - boost::optional m_mass; + boost::optional m_mass; /// Number of seats boost::optional m_numberOfSeats; diff --git a/src/generated/CPACSSeatModules.cpp b/src/generated/CPACSSeatModules.cpp index 18e5d68073..c7418d5db6 100644 --- a/src/generated/CPACSSeatModules.cpp +++ b/src/generated/CPACSSeatModules.cpp @@ -16,9 +16,9 @@ // limitations under the License. #include -#include "CPACSDeckComponent2DBase.h" +#include +#include "CCPACSDeck.h" #include "CPACSSeatModules.h" -#include "CPACSStructuralElements.h" #include "CTiglError.h" #include "CTiglLogging.h" #include "CTiglUIDManager.h" @@ -29,7 +29,7 @@ namespace tigl { namespace generated { - CPACSSeatModules::CPACSSeatModules(CPACSStructuralElements* parent, CTiglUIDManager* uidMgr) + CPACSSeatModules::CPACSSeatModules(CCPACSDeck* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) { //assert(parent != NULL); @@ -40,30 +40,24 @@ namespace generated { } - const CPACSStructuralElements* CPACSSeatModules::GetParent() const + const CCPACSDeck* CPACSSeatModules::GetParent() const { return m_parent; } - CPACSStructuralElements* CPACSSeatModules::GetParent() + CCPACSDeck* CPACSSeatModules::GetParent() { return m_parent; } const CTiglUIDObject* CPACSSeatModules::GetNextUIDParent() const { - if (m_parent) { - return m_parent->GetNextUIDParent(); - } - return nullptr; + return m_parent; } CTiglUIDObject* CPACSSeatModules::GetNextUIDParent() { - if (m_parent) { - return m_parent->GetNextUIDParent(); - } - return nullptr; + return m_parent; } CTiglUIDManager& CPACSSeatModules::GetUIDManager() @@ -98,12 +92,12 @@ namespace generated } - const std::vector>& CPACSSeatModules::GetSeatModules() const + const std::vector>& CPACSSeatModules::GetSeatModules() const { return m_seatModules; } - std::vector>& CPACSSeatModules::GetSeatModules() + std::vector>& CPACSSeatModules::GetSeatModules() { return m_seatModules; } @@ -124,25 +118,25 @@ namespace generated throw CTiglError("Invalid UID in CPACSSeatModules::GetSeatModuleIndex", TIGL_UID_ERROR); } - CPACSDeckComponent2DBase& CPACSSeatModules::GetSeatModule(size_t index) + CCPACSDeckComponentBase& CPACSSeatModules::GetSeatModule(size_t index) { if (index < 1 || index > GetSeatModuleCount()) { - throw CTiglError("Invalid index in std::vector>::GetSeatModule", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetSeatModule", TIGL_INDEX_ERROR); } index--; return *m_seatModules[index]; } - const CPACSDeckComponent2DBase& CPACSSeatModules::GetSeatModule(size_t index) const + const CCPACSDeckComponentBase& CPACSSeatModules::GetSeatModule(size_t index) const { if (index < 1 || index > GetSeatModuleCount()) { - throw CTiglError("Invalid index in std::vector>::GetSeatModule", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetSeatModule", TIGL_INDEX_ERROR); } index--; return *m_seatModules[index]; } - CPACSDeckComponent2DBase& CPACSSeatModules::GetSeatModule(const std::string& UID) + CCPACSDeckComponentBase& CPACSSeatModules::GetSeatModule(const std::string& UID) { for (auto& elem : m_seatModules ) { if (elem->GetUID() == UID) @@ -151,7 +145,7 @@ namespace generated throw CTiglError("Invalid UID in CPACSSeatModules::GetSeatModule. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); } - const CPACSDeckComponent2DBase& CPACSSeatModules::GetSeatModule(const std::string& UID) const + const CCPACSDeckComponentBase& CPACSSeatModules::GetSeatModule(const std::string& UID) const { for (auto& elem : m_seatModules ) { if (elem->GetUID() == UID) @@ -161,13 +155,13 @@ namespace generated } - CPACSDeckComponent2DBase& CPACSSeatModules::AddSeatModule() + CCPACSDeckComponentBase& CPACSSeatModules::AddSeatModule() { - m_seatModules.push_back(std::make_unique(this, m_uidMgr)); + m_seatModules.push_back(std::make_unique(this, m_uidMgr)); return *m_seatModules.back(); } - void CPACSSeatModules::RemoveSeatModule(CPACSDeckComponent2DBase& ref) + void CPACSSeatModules::RemoveSeatModule(CCPACSDeckComponentBase& ref) { for (std::size_t i = 0; i < m_seatModules.size(); i++) { if (m_seatModules[i].get() == &ref) { diff --git a/src/generated/CPACSSeatModules.h b/src/generated/CPACSSeatModules.h index c0df17b809..2b4b94b3c3 100644 --- a/src/generated/CPACSSeatModules.h +++ b/src/generated/CPACSSeatModules.h @@ -27,14 +27,13 @@ namespace tigl { class CTiglUIDManager; class CTiglUIDObject; +class CCPACSDeckComponentBase; +class CCPACSDeck; namespace generated { - class CPACSDeckComponent2DBase; - class CPACSStructuralElements; - // This class is used in: - // CPACSStructuralElements + // CPACSDeck /// @brief Seat modules /// @@ -43,13 +42,13 @@ namespace generated class CPACSSeatModules { public: - TIGL_EXPORT CPACSSeatModules(CPACSStructuralElements* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSSeatModules(CCPACSDeck* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT virtual ~CPACSSeatModules(); - TIGL_EXPORT CPACSStructuralElements* GetParent(); + TIGL_EXPORT CCPACSDeck* GetParent(); - TIGL_EXPORT const CPACSStructuralElements* GetParent() const; + TIGL_EXPORT const CCPACSDeck* GetParent() const; TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; @@ -60,28 +59,28 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const std::vector>& GetSeatModules() const; - TIGL_EXPORT virtual std::vector>& GetSeatModules(); + TIGL_EXPORT virtual const std::vector>& GetSeatModules() const; + TIGL_EXPORT virtual std::vector>& GetSeatModules(); TIGL_EXPORT virtual size_t GetSeatModuleCount() const; TIGL_EXPORT virtual size_t GetSeatModuleIndex(const std::string& UID) const; - TIGL_EXPORT virtual const CPACSDeckComponent2DBase& GetSeatModule(size_t index) const; - TIGL_EXPORT virtual CPACSDeckComponent2DBase& GetSeatModule(size_t index); + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetSeatModule(size_t index) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetSeatModule(size_t index); - TIGL_EXPORT virtual const CPACSDeckComponent2DBase& GetSeatModule(const std::string& UID) const; - TIGL_EXPORT virtual CPACSDeckComponent2DBase& GetSeatModule(const std::string& UID); + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetSeatModule(const std::string& UID) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetSeatModule(const std::string& UID); - TIGL_EXPORT virtual CPACSDeckComponent2DBase& AddSeatModule(); - TIGL_EXPORT virtual void RemoveSeatModule(CPACSDeckComponent2DBase& ref); + TIGL_EXPORT virtual CCPACSDeckComponentBase& AddSeatModule(); + TIGL_EXPORT virtual void RemoveSeatModule(CCPACSDeckComponentBase& ref); protected: - CPACSStructuralElements* m_parent; + CCPACSDeck* m_parent; CTiglUIDManager* m_uidMgr; /// Seat module - std::vector> m_seatModules; + std::vector> m_seatModules; private: CPACSSeatModules(const CPACSSeatModules&) = delete; @@ -94,6 +93,4 @@ namespace generated // Aliases in tigl namespace using CCPACSSeatModules = generated::CPACSSeatModules; -using CCPACSDeckComponent2DBase = generated::CPACSDeckComponent2DBase; -using CCPACSStructuralElements = generated::CPACSStructuralElements; } // namespace tigl diff --git a/src/generated/CPACSSidewallPanelElements.cpp b/src/generated/CPACSSidewallPanelElements.cpp index 9933dd1304..9264d79374 100644 --- a/src/generated/CPACSSidewallPanelElements.cpp +++ b/src/generated/CPACSSidewallPanelElements.cpp @@ -16,9 +16,9 @@ // limitations under the License. #include -#include "CPACSDeckElementBase.h" #include "CPACSDeckElements.h" #include "CPACSSidewallPanelElements.h" +#include "CPACSVehicleElementBase.h" #include "CTiglError.h" #include "CTiglLogging.h" #include "CTiglUIDManager.h" @@ -98,12 +98,12 @@ namespace generated } - const std::vector>& CPACSSidewallPanelElements::GetSidewallPanelElements() const + const std::vector>& CPACSSidewallPanelElements::GetSidewallPanelElements() const { return m_sidewallPanelElements; } - std::vector>& CPACSSidewallPanelElements::GetSidewallPanelElements() + std::vector>& CPACSSidewallPanelElements::GetSidewallPanelElements() { return m_sidewallPanelElements; } @@ -124,25 +124,25 @@ namespace generated throw CTiglError("Invalid UID in CPACSSidewallPanelElements::GetSidewallPanelElementIndex", TIGL_UID_ERROR); } - CPACSDeckElementBase& CPACSSidewallPanelElements::GetSidewallPanelElement(size_t index) + CPACSVehicleElementBase& CPACSSidewallPanelElements::GetSidewallPanelElement(size_t index) { if (index < 1 || index > GetSidewallPanelElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetSidewallPanelElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetSidewallPanelElement", TIGL_INDEX_ERROR); } index--; return *m_sidewallPanelElements[index]; } - const CPACSDeckElementBase& CPACSSidewallPanelElements::GetSidewallPanelElement(size_t index) const + const CPACSVehicleElementBase& CPACSSidewallPanelElements::GetSidewallPanelElement(size_t index) const { if (index < 1 || index > GetSidewallPanelElementCount()) { - throw CTiglError("Invalid index in std::vector>::GetSidewallPanelElement", TIGL_INDEX_ERROR); + throw CTiglError("Invalid index in std::vector>::GetSidewallPanelElement", TIGL_INDEX_ERROR); } index--; return *m_sidewallPanelElements[index]; } - CPACSDeckElementBase& CPACSSidewallPanelElements::GetSidewallPanelElement(const std::string& UID) + CPACSVehicleElementBase& CPACSSidewallPanelElements::GetSidewallPanelElement(const std::string& UID) { for (auto& elem : m_sidewallPanelElements ) { if (elem->GetUID() == UID) @@ -151,7 +151,7 @@ namespace generated throw CTiglError("Invalid UID in CPACSSidewallPanelElements::GetSidewallPanelElement. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); } - const CPACSDeckElementBase& CPACSSidewallPanelElements::GetSidewallPanelElement(const std::string& UID) const + const CPACSVehicleElementBase& CPACSSidewallPanelElements::GetSidewallPanelElement(const std::string& UID) const { for (auto& elem : m_sidewallPanelElements ) { if (elem->GetUID() == UID) @@ -161,13 +161,13 @@ namespace generated } - CPACSDeckElementBase& CPACSSidewallPanelElements::AddSidewallPanelElement() + CPACSVehicleElementBase& CPACSSidewallPanelElements::AddSidewallPanelElement() { - m_sidewallPanelElements.push_back(std::make_unique(this, m_uidMgr)); + m_sidewallPanelElements.push_back(std::make_unique(this, m_uidMgr)); return *m_sidewallPanelElements.back(); } - void CPACSSidewallPanelElements::RemoveSidewallPanelElement(CPACSDeckElementBase& ref) + void CPACSSidewallPanelElements::RemoveSidewallPanelElement(CPACSVehicleElementBase& ref) { for (std::size_t i = 0; i < m_sidewallPanelElements.size(); i++) { if (m_sidewallPanelElements[i].get() == &ref) { diff --git a/src/generated/CPACSSidewallPanelElements.h b/src/generated/CPACSSidewallPanelElements.h index cd0ba45659..f847345355 100644 --- a/src/generated/CPACSSidewallPanelElements.h +++ b/src/generated/CPACSSidewallPanelElements.h @@ -30,7 +30,7 @@ class CTiglUIDObject; namespace generated { - class CPACSDeckElementBase; + class CPACSVehicleElementBase; class CPACSDeckElements; // This class is used in: @@ -60,20 +60,20 @@ namespace generated TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; - TIGL_EXPORT virtual const std::vector>& GetSidewallPanelElements() const; - TIGL_EXPORT virtual std::vector>& GetSidewallPanelElements(); + TIGL_EXPORT virtual const std::vector>& GetSidewallPanelElements() const; + TIGL_EXPORT virtual std::vector>& GetSidewallPanelElements(); TIGL_EXPORT virtual size_t GetSidewallPanelElementCount() const; TIGL_EXPORT virtual size_t GetSidewallPanelElementIndex(const std::string& UID) const; - TIGL_EXPORT virtual const CPACSDeckElementBase& GetSidewallPanelElement(size_t index) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetSidewallPanelElement(size_t index); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetSidewallPanelElement(size_t index) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetSidewallPanelElement(size_t index); - TIGL_EXPORT virtual const CPACSDeckElementBase& GetSidewallPanelElement(const std::string& UID) const; - TIGL_EXPORT virtual CPACSDeckElementBase& GetSidewallPanelElement(const std::string& UID); + TIGL_EXPORT virtual const CPACSVehicleElementBase& GetSidewallPanelElement(const std::string& UID) const; + TIGL_EXPORT virtual CPACSVehicleElementBase& GetSidewallPanelElement(const std::string& UID); - TIGL_EXPORT virtual CPACSDeckElementBase& AddSidewallPanelElement(); - TIGL_EXPORT virtual void RemoveSidewallPanelElement(CPACSDeckElementBase& ref); + TIGL_EXPORT virtual CPACSVehicleElementBase& AddSidewallPanelElement(); + TIGL_EXPORT virtual void RemoveSidewallPanelElement(CPACSVehicleElementBase& ref); protected: CPACSDeckElements* m_parent; @@ -81,7 +81,7 @@ namespace generated CTiglUIDManager* m_uidMgr; /// Sidewall panel element for use in the decks - std::vector> m_sidewallPanelElements; + std::vector> m_sidewallPanelElements; private: CPACSSidewallPanelElements(const CPACSSidewallPanelElements&) = delete; @@ -94,6 +94,6 @@ namespace generated // Aliases in tigl namespace using CCPACSSidewallPanelElements = generated::CPACSSidewallPanelElements; -using CCPACSDeckElementBase = generated::CPACSDeckElementBase; +using CCPACSVehicleElementBase = generated::CPACSVehicleElementBase; using CCPACSDeckElements = generated::CPACSDeckElements; } // namespace tigl diff --git a/src/generated/CPACSSidewallPanels.cpp b/src/generated/CPACSSidewallPanels.cpp new file mode 100644 index 0000000000..23fccb9a45 --- /dev/null +++ b/src/generated/CPACSSidewallPanels.cpp @@ -0,0 +1,176 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include "CCPACSDeck.h" +#include "CPACSSidewallPanels.h" +#include "CTiglError.h" +#include "CTiglLogging.h" +#include "CTiglUIDManager.h" +#include "CTiglUIDObject.h" +#include "TixiHelper.h" + +namespace tigl +{ +namespace generated +{ + CPACSSidewallPanels::CPACSSidewallPanels(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + } + + CPACSSidewallPanels::~CPACSSidewallPanels() + { + } + + const CCPACSDeck* CPACSSidewallPanels::GetParent() const + { + return m_parent; + } + + CCPACSDeck* CPACSSidewallPanels::GetParent() + { + return m_parent; + } + + const CTiglUIDObject* CPACSSidewallPanels::GetNextUIDParent() const + { + return m_parent; + } + + CTiglUIDObject* CPACSSidewallPanels::GetNextUIDParent() + { + return m_parent; + } + + CTiglUIDManager& CPACSSidewallPanels::GetUIDManager() + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + const CTiglUIDManager& CPACSSidewallPanels::GetUIDManager() const + { + if (!m_uidMgr) { + throw CTiglError("UIDManager is null"); + } + return *m_uidMgr; + } + + void CPACSSidewallPanels::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) + { + // read element sidewallPanel + if (tixi::TixiCheckElement(tixiHandle, xpath + "/sidewallPanel")) { + tixi::TixiReadElements(tixiHandle, xpath + "/sidewallPanel", m_sidewallPanels, 1, tixi::xsdUnbounded, this, m_uidMgr); + } + + } + + void CPACSSidewallPanels::WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const + { + // write element sidewallPanel + tixi::TixiSaveElements(tixiHandle, xpath + "/sidewallPanel", m_sidewallPanels); + + } + + const std::vector>& CPACSSidewallPanels::GetSidewallPanels() const + { + return m_sidewallPanels; + } + + std::vector>& CPACSSidewallPanels::GetSidewallPanels() + { + return m_sidewallPanels; + } + + size_t CPACSSidewallPanels::GetSidewallPanelCount() const + { + return m_sidewallPanels.size(); + } + + size_t CPACSSidewallPanels::GetSidewallPanelIndex(const std::string& UID) const + { + for (size_t i=0; i < GetSidewallPanelCount(); i++) { + const std::string tmpUID(m_sidewallPanels[i]->GetUID()); + if (tmpUID == UID) { + return i+1; + } + } + throw CTiglError("Invalid UID in CPACSSidewallPanels::GetSidewallPanelIndex", TIGL_UID_ERROR); + } + + CCPACSDeckComponentBase& CPACSSidewallPanels::GetSidewallPanel(size_t index) + { + if (index < 1 || index > GetSidewallPanelCount()) { + throw CTiglError("Invalid index in std::vector>::GetSidewallPanel", TIGL_INDEX_ERROR); + } + index--; + return *m_sidewallPanels[index]; + } + + const CCPACSDeckComponentBase& CPACSSidewallPanels::GetSidewallPanel(size_t index) const + { + if (index < 1 || index > GetSidewallPanelCount()) { + throw CTiglError("Invalid index in std::vector>::GetSidewallPanel", TIGL_INDEX_ERROR); + } + index--; + return *m_sidewallPanels[index]; + } + + CCPACSDeckComponentBase& CPACSSidewallPanels::GetSidewallPanel(const std::string& UID) + { + for (auto& elem : m_sidewallPanels ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSSidewallPanels::GetSidewallPanel. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + const CCPACSDeckComponentBase& CPACSSidewallPanels::GetSidewallPanel(const std::string& UID) const + { + for (auto& elem : m_sidewallPanels ) { + if (elem->GetUID() == UID) + return *elem; + } + throw CTiglError("Invalid UID in CPACSSidewallPanels::GetSidewallPanel. \""+ UID + "\" not found in CPACS file!" , TIGL_UID_ERROR); + } + + + CCPACSDeckComponentBase& CPACSSidewallPanels::AddSidewallPanel() + { + m_sidewallPanels.push_back(std::make_unique(this, m_uidMgr)); + return *m_sidewallPanels.back(); + } + + void CPACSSidewallPanels::RemoveSidewallPanel(CCPACSDeckComponentBase& ref) + { + for (std::size_t i = 0; i < m_sidewallPanels.size(); i++) { + if (m_sidewallPanels[i].get() == &ref) { + m_sidewallPanels.erase(m_sidewallPanels.begin() + i); + return; + } + } + throw CTiglError("Element not found"); + } + +} // namespace generated +} // namespace tigl diff --git a/src/generated/CPACSSidewallPanels.h b/src/generated/CPACSSidewallPanels.h new file mode 100644 index 0000000000..ecdc4b1158 --- /dev/null +++ b/src/generated/CPACSSidewallPanels.h @@ -0,0 +1,96 @@ +// Copyright (c) 2020 RISC Software GmbH +// +// This file was generated by CPACSGen from CPACS XML Schema (c) German Aerospace Center (DLR/SC). +// Do not edit, all changes are lost when files are re-generated. +// +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include +#include +#include +#include +#include "tigl_internal.h" + +namespace tigl +{ +class CTiglUIDManager; +class CTiglUIDObject; +class CCPACSDeckComponentBase; +class CCPACSDeck; + +namespace generated +{ + // This class is used in: + // CPACSDeck + + /// @brief Sidewall panels + /// + /// Sidewall panel instance collection type. + /// + class CPACSSidewallPanels + { + public: + TIGL_EXPORT CPACSSidewallPanels(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + + TIGL_EXPORT virtual ~CPACSSidewallPanels(); + + TIGL_EXPORT CCPACSDeck* GetParent(); + + TIGL_EXPORT const CCPACSDeck* GetParent() const; + + TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); + TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; + + TIGL_EXPORT CTiglUIDManager& GetUIDManager(); + TIGL_EXPORT const CTiglUIDManager& GetUIDManager() const; + + TIGL_EXPORT virtual void ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath); + TIGL_EXPORT virtual void WriteCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) const; + + TIGL_EXPORT virtual const std::vector>& GetSidewallPanels() const; + TIGL_EXPORT virtual std::vector>& GetSidewallPanels(); + + TIGL_EXPORT virtual size_t GetSidewallPanelCount() const; + TIGL_EXPORT virtual size_t GetSidewallPanelIndex(const std::string& UID) const; + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetSidewallPanel(size_t index) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetSidewallPanel(size_t index); + + TIGL_EXPORT virtual const CCPACSDeckComponentBase& GetSidewallPanel(const std::string& UID) const; + TIGL_EXPORT virtual CCPACSDeckComponentBase& GetSidewallPanel(const std::string& UID); + + TIGL_EXPORT virtual CCPACSDeckComponentBase& AddSidewallPanel(); + TIGL_EXPORT virtual void RemoveSidewallPanel(CCPACSDeckComponentBase& ref); + + protected: + CCPACSDeck* m_parent; + + CTiglUIDManager* m_uidMgr; + + /// Sidewall panel + std::vector> m_sidewallPanels; + + private: + CPACSSidewallPanels(const CPACSSidewallPanels&) = delete; + CPACSSidewallPanels& operator=(const CPACSSidewallPanels&) = delete; + + CPACSSidewallPanels(CPACSSidewallPanels&&) = delete; + CPACSSidewallPanels& operator=(CPACSSidewallPanels&&) = delete; + }; +} // namespace generated + +// Aliases in tigl namespace +using CCPACSSidewallPanels = generated::CPACSSidewallPanels; +} // namespace tigl diff --git a/src/generated/CPACSSourceTarget.cpp b/src/generated/CPACSSourceTarget.cpp index 1b296af1d5..b5e3cfb98c 100644 --- a/src/generated/CPACSSourceTarget.cpp +++ b/src/generated/CPACSSourceTarget.cpp @@ -85,17 +85,17 @@ namespace generated void CPACSSourceTarget::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { // read element externalElement - if (tixi::TixiCheckElement(tixiHandle, xpath + "/externalElement")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/externalElement")) { m_externalElement_choice1 = stringToCPACSSourceTarget_externalElement(tixi::TixiGetElement(tixiHandle, xpath + "/externalElement")); } // read element ataChapter - if (tixi::TixiCheckElement(tixiHandle, xpath + "/ataChapter")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/ataChapter")) { m_ataChapter_choice2 = stringToCPACSAtaChapterList(tixi::TixiGetElement(tixiHandle, xpath + "/ataChapter")); } // read element systemArchitectureUID - if (tixi::TixiCheckElement(tixiHandle, xpath + "/systemArchitectureUID")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/systemArchitectureUID")) { m_systemArchitectureUID_choice3 = tixi::TixiGetElement(tixiHandle, xpath + "/systemArchitectureUID"); if (m_systemArchitectureUID_choice3->empty()) { LOG(WARNING) << "Optional element systemArchitectureUID is present but empty at xpath " << xpath; @@ -104,7 +104,7 @@ namespace generated } // read element componentUID - if (tixi::TixiCheckElement(tixiHandle, xpath + "/componentUID")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/componentUID")) { m_componentUID_choice4 = tixi::TixiGetElement(tixiHandle, xpath + "/componentUID"); if (m_componentUID_choice4->empty()) { LOG(WARNING) << "Optional element componentUID is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSStructuralElements.cpp b/src/generated/CPACSStructuralElements.cpp index ac0d06de56..5ac157783b 100644 --- a/src/generated/CPACSStructuralElements.cpp +++ b/src/generated/CPACSStructuralElements.cpp @@ -160,17 +160,6 @@ namespace generated } } - // read element seatModules - if (tixi::TixiCheckElement(tixiHandle, xpath + "/seatModules")) { - m_seatModules = boost::in_place(this, m_uidMgr); - try { - m_seatModules->ReadCPACS(tixiHandle, xpath + "/seatModules"); - } catch(const std::exception& e) { - LOG(ERROR) << "Failed to read seatModules at xpath " << xpath << ": " << e.what(); - m_seatModules = boost::none; - } - } - // read element rivets if (tixi::TixiCheckElement(tixiHandle, xpath + "/rivets")) { m_rivets = boost::in_place(this, m_uidMgr); @@ -263,17 +252,6 @@ namespace generated } } - // write element seatModules - if (m_seatModules) { - tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/seatModules"); - m_seatModules->WriteCPACS(tixiHandle, xpath + "/seatModules"); - } - else { - if (tixi::TixiCheckElement(tixiHandle, xpath + "/seatModules")) { - tixi::TixiRemoveElement(tixiHandle, xpath + "/seatModules"); - } - } - // write element rivets if (m_rivets) { tixi::TixiCreateElementIfNotExists(tixiHandle, xpath + "/rivets"); @@ -357,16 +335,6 @@ namespace generated return m_doorSurroundStructures; } - const boost::optional& CPACSStructuralElements::GetSeatModules() const - { - return m_seatModules; - } - - boost::optional& CPACSStructuralElements::GetSeatModules() - { - return m_seatModules; - } - const boost::optional& CPACSStructuralElements::GetRivets() const { return m_rivets; @@ -461,18 +429,6 @@ namespace generated m_doorSurroundStructures = boost::none; } - CPACSSeatModules& CPACSStructuralElements::GetSeatModules(CreateIfNotExistsTag) - { - if (!m_seatModules) - m_seatModules = boost::in_place(this, m_uidMgr); - return *m_seatModules; - } - - void CPACSStructuralElements::RemoveSeatModules() - { - m_seatModules = boost::none; - } - CPACSRivets& CPACSStructuralElements::GetRivets(CreateIfNotExistsTag) { if (!m_rivets) diff --git a/src/generated/CPACSStructuralElements.h b/src/generated/CPACSStructuralElements.h index f9dfea00b3..681620acae 100644 --- a/src/generated/CPACSStructuralElements.h +++ b/src/generated/CPACSStructuralElements.h @@ -26,7 +26,6 @@ #include "CPACSPressureBulkheads.h" #include "CPACSProfileBasedStructuralElements.h" #include "CPACSRivets.h" -#include "CPACSSeatModules.h" #include "CPACSSheetBasedStructuralElements.h" #include "CPACSStructuralWallElements.h" #include "CPACSWindows.h" @@ -91,9 +90,6 @@ namespace generated TIGL_EXPORT virtual const boost::optional& GetDoorSurroundStructures() const; TIGL_EXPORT virtual boost::optional& GetDoorSurroundStructures(); - TIGL_EXPORT virtual const boost::optional& GetSeatModules() const; - TIGL_EXPORT virtual boost::optional& GetSeatModules(); - TIGL_EXPORT virtual const boost::optional& GetRivets() const; TIGL_EXPORT virtual boost::optional& GetRivets(); @@ -118,9 +114,6 @@ namespace generated TIGL_EXPORT virtual CPACSDoorSurroundStructuresAssembly& GetDoorSurroundStructures(CreateIfNotExistsTag); TIGL_EXPORT virtual void RemoveDoorSurroundStructures(); - TIGL_EXPORT virtual CPACSSeatModules& GetSeatModules(CreateIfNotExistsTag); - TIGL_EXPORT virtual void RemoveSeatModules(); - TIGL_EXPORT virtual CPACSRivets& GetRivets(CreateIfNotExistsTag); TIGL_EXPORT virtual void RemoveRivets(); @@ -130,22 +123,12 @@ namespace generated CTiglUIDManager* m_uidMgr; boost::optional m_sheetBasedStructuralElements; - boost::optional m_profileBasedStructuralElements; - boost::optional m_structuralWallElements; - boost::optional m_pressureBulkheads; - boost::optional m_windows; - boost::optional m_doors; - boost::optional m_doorSurroundStructures; - - /// Seat elements (Deprecation warning: This element will soon be removed from the official CPACS. Use the new seat modules located at cpacs/vehicles/deckElements!) - boost::optional m_seatModules; - boost::optional m_rivets; private: diff --git a/src/generated/CPACSSysElemBattery.cpp b/src/generated/CPACSSysElemBattery.cpp index 8f1ea911c1..c7741b1086 100644 --- a/src/generated/CPACSSysElemBattery.cpp +++ b/src/generated/CPACSSysElemBattery.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemCable.cpp b/src/generated/CPACSSysElemCable.cpp index e2417e30e9..065c18726e 100644 --- a/src/generated/CPACSSysElemCable.cpp +++ b/src/generated/CPACSSysElemCable.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemCompressor.cpp b/src/generated/CPACSSysElemCompressor.cpp index 2cb53886c7..6fce2a516e 100644 --- a/src/generated/CPACSSysElemCompressor.cpp +++ b/src/generated/CPACSSysElemCompressor.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemConverter.cpp b/src/generated/CPACSSysElemConverter.cpp index 9c72cb9de2..7f3acf5452 100644 --- a/src/generated/CPACSSysElemConverter.cpp +++ b/src/generated/CPACSSysElemConverter.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemDCDCConverter.cpp b/src/generated/CPACSSysElemDCDCConverter.cpp index b54eb885d5..a7d31d32fd 100644 --- a/src/generated/CPACSSysElemDCDCConverter.cpp +++ b/src/generated/CPACSSysElemDCDCConverter.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemElectricMachine.cpp b/src/generated/CPACSSysElemElectricMachine.cpp index 7cf288ae95..ed10e7663e 100644 --- a/src/generated/CPACSSysElemElectricMachine.cpp +++ b/src/generated/CPACSSysElemElectricMachine.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemElectricMotor.cpp b/src/generated/CPACSSysElemElectricMotor.cpp index c4c67ec8a9..637231e45e 100644 --- a/src/generated/CPACSSysElemElectricMotor.cpp +++ b/src/generated/CPACSSysElemElectricMotor.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemFuelCell.cpp b/src/generated/CPACSSysElemFuelCell.cpp index a170698337..2a72a8ca99 100644 --- a/src/generated/CPACSSysElemFuelCell.cpp +++ b/src/generated/CPACSSysElemFuelCell.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemGearBox.cpp b/src/generated/CPACSSysElemGearBox.cpp index 6fd35a1f1f..316775ce18 100644 --- a/src/generated/CPACSSysElemGearBox.cpp +++ b/src/generated/CPACSSysElemGearBox.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemGenerator.cpp b/src/generated/CPACSSysElemGenerator.cpp index c0a079e9c7..5be6a00451 100644 --- a/src/generated/CPACSSysElemGenerator.cpp +++ b/src/generated/CPACSSysElemGenerator.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemHeatExchanger.cpp b/src/generated/CPACSSysElemHeatExchanger.cpp index 491604a90e..110150cb3d 100644 --- a/src/generated/CPACSSysElemHeatExchanger.cpp +++ b/src/generated/CPACSSysElemHeatExchanger.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemInverter.cpp b/src/generated/CPACSSysElemInverter.cpp index e45f509659..bf73c6052c 100644 --- a/src/generated/CPACSSysElemInverter.cpp +++ b/src/generated/CPACSSysElemInverter.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemPowerDistributionUnit.cpp b/src/generated/CPACSSysElemPowerDistributionUnit.cpp index 7677b75deb..0acd5e738c 100644 --- a/src/generated/CPACSSysElemPowerDistributionUnit.cpp +++ b/src/generated/CPACSSysElemPowerDistributionUnit.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemPowerElectronic.cpp b/src/generated/CPACSSysElemPowerElectronic.cpp index f808397020..7119cbb315 100644 --- a/src/generated/CPACSSysElemPowerElectronic.cpp +++ b/src/generated/CPACSSysElemPowerElectronic.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemPump.cpp b/src/generated/CPACSSysElemPump.cpp index 47b1cec47d..98a796e7df 100644 --- a/src/generated/CPACSSysElemPump.cpp +++ b/src/generated/CPACSSysElemPump.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemRectifier.cpp b/src/generated/CPACSSysElemRectifier.cpp index 6c7ee057e7..5584636718 100644 --- a/src/generated/CPACSSysElemRectifier.cpp +++ b/src/generated/CPACSSysElemRectifier.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemReservoir.cpp b/src/generated/CPACSSysElemReservoir.cpp index c8be40964a..c5ca0ad9d1 100644 --- a/src/generated/CPACSSysElemReservoir.cpp +++ b/src/generated/CPACSSysElemReservoir.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemSwitchgear.cpp b/src/generated/CPACSSysElemSwitchgear.cpp index f19a847930..477c84726d 100644 --- a/src/generated/CPACSSysElemSwitchgear.cpp +++ b/src/generated/CPACSSysElemSwitchgear.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSysElemTurboGenerator.cpp b/src/generated/CPACSSysElemTurboGenerator.cpp index eb4d534e77..cbb60d8b3e 100644 --- a/src/generated/CPACSSysElemTurboGenerator.cpp +++ b/src/generated/CPACSSysElemTurboGenerator.cpp @@ -96,7 +96,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +107,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSystemArchitecture.cpp b/src/generated/CPACSSystemArchitecture.cpp index d37d2741d3..28a7877eea 100644 --- a/src/generated/CPACSSystemArchitecture.cpp +++ b/src/generated/CPACSSystemArchitecture.cpp @@ -92,7 +92,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -103,7 +103,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSSystemConnection.cpp b/src/generated/CPACSSystemConnection.cpp index da3b5f423d..c3427891cc 100644 --- a/src/generated/CPACSSystemConnection.cpp +++ b/src/generated/CPACSSystemConnection.cpp @@ -97,7 +97,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -108,7 +108,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; @@ -116,7 +116,7 @@ namespace generated } // read element connectionType - if (tixi::TixiCheckElement(tixiHandle, xpath + "/connectionType")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/connectionType")) { m_connectionType = stringToCPACSSystemConnection_connectionType(tixi::TixiGetElement(tixiHandle, xpath + "/connectionType")); } diff --git a/src/generated/CPACSSystemState.cpp b/src/generated/CPACSSystemState.cpp index 6f3b8b5741..d5c35bb489 100644 --- a/src/generated/CPACSSystemState.cpp +++ b/src/generated/CPACSSystemState.cpp @@ -62,7 +62,7 @@ namespace generated void CPACSSystemState::ReadCPACS(const TixiDocumentHandle& tixiHandle, const std::string& xpath) { // read element controlParameterActive - if (tixi::TixiCheckElement(tixiHandle, xpath + "/controlParameterActive")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/controlParameterActive")) { m_controlParameterActive = tixi::TixiGetElement(tixiHandle, xpath + "/controlParameterActive"); } else { @@ -70,7 +70,7 @@ namespace generated } // read element controlParameterInactive - if (tixi::TixiCheckElement(tixiHandle, xpath + "/controlParameterInactive")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/controlParameterInactive")) { m_controlParameterInactive = tixi::TixiGetElement(tixiHandle, xpath + "/controlParameterInactive"); } else { diff --git a/src/generated/CPACSTransformation.cpp b/src/generated/CPACSTransformation.cpp index d7c5dc762c..e711fa2eb5 100644 --- a/src/generated/CPACSTransformation.cpp +++ b/src/generated/CPACSTransformation.cpp @@ -16,6 +16,8 @@ // limitations under the License. #include +#include "CCPACSDeck.h" +#include "CCPACSDeckComponentBase.h" #include "CCPACSDuct.h" #include "CCPACSDuctAssembly.h" #include "CCPACSEnginePosition.h" @@ -34,7 +36,6 @@ #include "CCPACSWingSectionElement.h" #include "CPACSElementGeometry.h" #include "CPACSExternalGeometry.h" -#include "CPACSGenericGeometryComponent.h" #include "CPACSLandingGearBase.h" #include "CPACSTransformation.h" #include "CTiglError.h" @@ -46,6 +47,22 @@ namespace tigl { namespace generated { + CPACSTransformation::CPACSTransformation(CCPACSDeck* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CCPACSDeck); + } + + CPACSTransformation::CPACSTransformation(CCPACSDeckComponentBase* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CCPACSDeckComponentBase); + } + CPACSTransformation::CPACSTransformation(CCPACSDuct* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) { @@ -134,14 +151,6 @@ namespace generated m_parentType = &typeid(CCPACSExternalObject); } - CPACSTransformation::CPACSTransformation(CPACSGenericGeometryComponent* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSGenericGeometryComponent); - } - CPACSTransformation::CPACSTransformation(CPACSLandingGearBase* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) { @@ -214,6 +223,12 @@ namespace generated const CTiglUIDObject* CPACSTransformation::GetNextUIDParent() const { if (m_parent) { + if (IsParent()) { + return GetParent(); + } + if (IsParent()) { + return GetParent(); + } if (IsParent()) { return GetParent(); } @@ -247,9 +262,6 @@ namespace generated if (IsParent()) { return GetParent(); } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } if (IsParent()) { return GetParent(); } @@ -281,6 +293,12 @@ namespace generated CTiglUIDObject* CPACSTransformation::GetNextUIDParent() { if (m_parent) { + if (IsParent()) { + return GetParent(); + } + if (IsParent()) { + return GetParent(); + } if (IsParent()) { return GetParent(); } @@ -314,9 +332,6 @@ namespace generated if (IsParent()) { return GetParent(); } - if (IsParent()) { - return GetParent()->GetNextUIDParent(); - } if (IsParent()) { return GetParent(); } diff --git a/src/generated/CPACSTransformation.h b/src/generated/CPACSTransformation.h index 1ec2193541..106659b760 100644 --- a/src/generated/CPACSTransformation.h +++ b/src/generated/CPACSTransformation.h @@ -32,6 +32,8 @@ namespace tigl { class CTiglUIDManager; +class CCPACSDeck; +class CCPACSDeckComponentBase; class CCPACSDuct; class CCPACSDuctAssembly; class CCPACSEnginePosition; @@ -53,10 +55,11 @@ namespace generated { class CPACSElementGeometry; class CPACSExternalGeometry; - class CPACSGenericGeometryComponent; class CPACSLandingGearBase; // This class is used in: + // CPACSDeck + // CPACSDeckComponentBase // CPACSDuct // CPACSDuctAssembly // CPACSElementGeometry @@ -68,7 +71,6 @@ namespace generated // CPACSFuselageElement // CPACSFuselageSection // CPACSGenericGeometricComponent - // CPACSGenericGeometryComponent // CPACSLandingGearBase // CPACSNacelleSection // CPACSRotor @@ -94,6 +96,8 @@ namespace generated class CPACSTransformation : public CTiglOptUIDObject { public: + TIGL_EXPORT CPACSTransformation(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSTransformation(CCPACSDeckComponentBase* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSTransformation(CCPACSDuct* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSTransformation(CCPACSDuctAssembly* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSTransformation(CPACSElementGeometry* parent, CTiglUIDManager* uidMgr); @@ -105,7 +109,6 @@ namespace generated TIGL_EXPORT CPACSTransformation(CCPACSFuselageSectionElement* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSTransformation(CCPACSFuselageSection* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSTransformation(CCPACSExternalObject* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CPACSTransformation(CPACSGenericGeometryComponent* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSTransformation(CPACSLandingGearBase* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSTransformation(CCPACSNacelleSection* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSTransformation(CCPACSRotor* parent, CTiglUIDManager* uidMgr); @@ -126,7 +129,7 @@ namespace generated template P* GetParent() { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSTransformation"); + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSTransformation"); if (!IsParent

()) { throw CTiglError("bad parent"); } @@ -136,7 +139,7 @@ namespace generated template const P* GetParent() const { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSTransformation"); + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSTransformation"); if (!IsParent

()) { throw CTiglError("bad parent"); } @@ -212,6 +215,5 @@ namespace generated // Aliases in tigl namespace using CCPACSElementGeometry = generated::CPACSElementGeometry; using CCPACSExternalGeometry = generated::CPACSExternalGeometry; -using CCPACSGenericGeometryComponent = generated::CPACSGenericGeometryComponent; using CCPACSLandingGearBase = generated::CPACSLandingGearBase; } // namespace tigl diff --git a/src/generated/CPACSTransformation2D.cpp b/src/generated/CPACSTransformation2D.cpp index 0629bf98f6..69615ab3dd 100644 --- a/src/generated/CPACSTransformation2D.cpp +++ b/src/generated/CPACSTransformation2D.cpp @@ -17,7 +17,6 @@ #include #include "CCPACSProfileBasedStructuralElement.h" -#include "CPACSDeckComponent2DBase.h" #include "CPACSTransformation2D.h" #include "CTiglError.h" #include "CTiglLogging.h" @@ -28,20 +27,11 @@ namespace tigl { namespace generated { - CPACSTransformation2D::CPACSTransformation2D(CPACSDeckComponent2DBase* parent, CTiglUIDManager* uidMgr) - : m_uidMgr(uidMgr) - { - //assert(parent != NULL); - m_parent = parent; - m_parentType = &typeid(CPACSDeckComponent2DBase); - } - CPACSTransformation2D::CPACSTransformation2D(CCPACSProfileBasedStructuralElement* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) { //assert(parent != NULL); m_parent = parent; - m_parentType = &typeid(CCPACSProfileBasedStructuralElement); } CPACSTransformation2D::~CPACSTransformation2D() @@ -49,30 +39,24 @@ namespace generated if (m_uidMgr && m_uID) m_uidMgr->TryUnregisterObject(*m_uID); } + const CCPACSProfileBasedStructuralElement* CPACSTransformation2D::GetParent() const + { + return m_parent; + } + + CCPACSProfileBasedStructuralElement* CPACSTransformation2D::GetParent() + { + return m_parent; + } + const CTiglUIDObject* CPACSTransformation2D::GetNextUIDParent() const { - if (m_parent) { - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - } - return nullptr; + return m_parent; } CTiglUIDObject* CPACSTransformation2D::GetNextUIDParent() { - if (m_parent) { - if (IsParent()) { - return GetParent(); - } - if (IsParent()) { - return GetParent(); - } - } - return nullptr; + return m_parent; } CTiglUIDManager& CPACSTransformation2D::GetUIDManager() diff --git a/src/generated/CPACSTransformation2D.h b/src/generated/CPACSTransformation2D.h index 8173f85d34..ffcf4a1e47 100644 --- a/src/generated/CPACSTransformation2D.h +++ b/src/generated/CPACSTransformation2D.h @@ -22,10 +22,8 @@ #include #include #include -#include #include "CPACSPointZ.h" #include "CreateIfNotExists.h" -#include "CTiglError.h" #include "CTiglUIDObject.h" #include "tigl_internal.h" @@ -36,10 +34,7 @@ class CCPACSProfileBasedStructuralElement; namespace generated { - class CPACSDeckComponent2DBase; - // This class is used in: - // CPACSDeckComponent2DBase // CPACSProfileBasedStructuralElement /// @brief 2D transformation @@ -49,36 +44,13 @@ namespace generated class CPACSTransformation2D : public CTiglOptUIDObject { public: - TIGL_EXPORT CPACSTransformation2D(CPACSDeckComponent2DBase* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSTransformation2D(CCPACSProfileBasedStructuralElement* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT virtual ~CPACSTransformation2D(); - template - bool IsParent() const - { - return m_parentType != NULL && *m_parentType == typeid(P); - } - - template - P* GetParent() - { - static_assert(std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSTransformation2D"); - if (!IsParent

()) { - throw CTiglError("bad parent"); - } - return static_cast(m_parent); - } - - template - const P* GetParent() const - { - static_assert(std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSTransformation2D"); - if (!IsParent

()) { - throw CTiglError("bad parent"); - } - return static_cast(m_parent); - } + TIGL_EXPORT CCPACSProfileBasedStructuralElement* GetParent(); + + TIGL_EXPORT const CCPACSProfileBasedStructuralElement* GetParent() const; TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; @@ -111,8 +83,7 @@ namespace generated TIGL_EXPORT virtual void RemoveTranslation(); protected: - void* m_parent; - const std::type_info* m_parentType; + CCPACSProfileBasedStructuralElement* m_parent; CTiglUIDManager* m_uidMgr; @@ -138,5 +109,4 @@ namespace generated // Aliases in tigl namespace using CCPACSTransformation2D = generated::CPACSTransformation2D; -using CCPACSDeckComponent2DBase = generated::CPACSDeckComponent2DBase; } // namespace tigl diff --git a/src/generated/CPACSVehicleElementBase.cpp b/src/generated/CPACSVehicleElementBase.cpp index af468e6b4f..a2e032028e 100644 --- a/src/generated/CPACSVehicleElementBase.cpp +++ b/src/generated/CPACSVehicleElementBase.cpp @@ -16,6 +16,13 @@ // limitations under the License. #include +#include "CPACSCargoContainerElements.h" +#include "CPACSCeilingPanelElements.h" +#include "CPACSClassDividerElements.h" +#include "CPACSGenericFloorElements.h" +#include "CPACSLavatoryElements.h" +#include "CPACSLuggageCompartmentElements.h" +#include "CPACSSidewallPanelElements.h" #include "CPACSSysElemGenericComponents.h" #include "CPACSVehicleElementBase.h" #include "CTiglError.h" @@ -27,33 +34,110 @@ namespace tigl { namespace generated { - CPACSVehicleElementBase::CPACSVehicleElementBase(CPACSSysElemGenericComponents* parent, CTiglUIDManager* uidMgr) + CPACSVehicleElementBase::CPACSVehicleElementBase(CPACSCargoContainerElements* parent, CTiglUIDManager* uidMgr) : m_uidMgr(uidMgr) , m_geometry(this, m_uidMgr) { //assert(parent != NULL); m_parent = parent; + m_parentType = &typeid(CPACSCargoContainerElements); } - CPACSVehicleElementBase::~CPACSVehicleElementBase() + CPACSVehicleElementBase::CPACSVehicleElementBase(CPACSCeilingPanelElements* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_geometry(this, m_uidMgr) { - if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSCeilingPanelElements); } - const CPACSSysElemGenericComponents* CPACSVehicleElementBase::GetParent() const + CPACSVehicleElementBase::CPACSVehicleElementBase(CPACSClassDividerElements* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_geometry(this, m_uidMgr) { - return m_parent; + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSClassDividerElements); } - CPACSSysElemGenericComponents* CPACSVehicleElementBase::GetParent() + CPACSVehicleElementBase::CPACSVehicleElementBase(CPACSGenericFloorElements* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_geometry(this, m_uidMgr) { - return m_parent; + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSGenericFloorElements); + } + + CPACSVehicleElementBase::CPACSVehicleElementBase(CPACSLavatoryElements* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_geometry(this, m_uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSLavatoryElements); + } + + CPACSVehicleElementBase::CPACSVehicleElementBase(CPACSLuggageCompartmentElements* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_geometry(this, m_uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSLuggageCompartmentElements); + } + + CPACSVehicleElementBase::CPACSVehicleElementBase(CPACSSidewallPanelElements* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_geometry(this, m_uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSSidewallPanelElements); + } + + CPACSVehicleElementBase::CPACSVehicleElementBase(CPACSSysElemGenericComponents* parent, CTiglUIDManager* uidMgr) + : m_uidMgr(uidMgr) + , m_geometry(this, m_uidMgr) + { + //assert(parent != NULL); + m_parent = parent; + m_parentType = &typeid(CPACSSysElemGenericComponents); + } + + CPACSVehicleElementBase::~CPACSVehicleElementBase() + { + if (m_uidMgr) m_uidMgr->TryUnregisterObject(m_uID); } const CTiglUIDObject* CPACSVehicleElementBase::GetNextUIDParent() const { if (m_parent) { - return m_parent->GetNextUIDParent(); + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } } return nullptr; } @@ -61,7 +145,30 @@ namespace generated CTiglUIDObject* CPACSVehicleElementBase::GetNextUIDParent() { if (m_parent) { - return m_parent->GetNextUIDParent(); + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } + if (IsParent()) { + return GetParent()->GetNextUIDParent(); + } } return nullptr; } @@ -96,7 +203,7 @@ namespace generated } // read element name - if (tixi::TixiCheckElement(tixiHandle, xpath + "/name")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/name")) { m_name = tixi::TixiGetElement(tixiHandle, xpath + "/name"); if (m_name.empty()) { LOG(WARNING) << "Required element name is empty at xpath " << xpath; @@ -107,7 +214,7 @@ namespace generated } // read element description - if (tixi::TixiCheckElement(tixiHandle, xpath + "/description")) { + if (tixi::TixiCheckElementHasTextContent(tixiHandle, xpath + "/description")) { m_description = tixi::TixiGetElement(tixiHandle, xpath + "/description"); if (m_description->empty()) { LOG(WARNING) << "Optional element description is present but empty at xpath " << xpath; diff --git a/src/generated/CPACSVehicleElementBase.h b/src/generated/CPACSVehicleElementBase.h index 9cf8624079..fe0a2c0c2a 100644 --- a/src/generated/CPACSVehicleElementBase.h +++ b/src/generated/CPACSVehicleElementBase.h @@ -21,9 +21,11 @@ #include #include #include +#include #include "CPACSElementGeometry.h" #include "CPACSElementMass.h" #include "CreateIfNotExists.h" +#include "CTiglError.h" #include "CTiglUIDObject.h" #include "tigl_internal.h" @@ -33,9 +35,23 @@ class CTiglUIDManager; namespace generated { + class CPACSCargoContainerElements; + class CPACSCeilingPanelElements; + class CPACSClassDividerElements; + class CPACSGenericFloorElements; + class CPACSLavatoryElements; + class CPACSLuggageCompartmentElements; + class CPACSSidewallPanelElements; class CPACSSysElemGenericComponents; // This class is used in: + // CPACSCargoContainerElements + // CPACSCeilingPanelElements + // CPACSClassDividerElements + // CPACSGenericFloorElements + // CPACSLavatoryElements + // CPACSLuggageCompartmentElements + // CPACSSidewallPanelElements // CPACSSysElemGenericComponents /// @brief System element @@ -44,13 +60,42 @@ namespace generated class CPACSVehicleElementBase : public CTiglReqUIDObject { public: + TIGL_EXPORT CPACSVehicleElementBase(CPACSCargoContainerElements* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSVehicleElementBase(CPACSCeilingPanelElements* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSVehicleElementBase(CPACSClassDividerElements* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSVehicleElementBase(CPACSGenericFloorElements* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSVehicleElementBase(CPACSLavatoryElements* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSVehicleElementBase(CPACSLuggageCompartmentElements* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CPACSVehicleElementBase(CPACSSidewallPanelElements* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CPACSVehicleElementBase(CPACSSysElemGenericComponents* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT virtual ~CPACSVehicleElementBase(); - TIGL_EXPORT CPACSSysElemGenericComponents* GetParent(); - - TIGL_EXPORT const CPACSSysElemGenericComponents* GetParent() const; + template + bool IsParent() const + { + return m_parentType != NULL && *m_parentType == typeid(P); + } + + template + P* GetParent() + { + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSVehicleElementBase"); + if (!IsParent

()) { + throw CTiglError("bad parent"); + } + return static_cast(m_parent); + } + + template + const P* GetParent() const + { + static_assert(std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value || std::is_same::value, "template argument for P is not a parent class of CPACSVehicleElementBase"); + if (!IsParent

()) { + throw CTiglError("bad parent"); + } + return static_cast(m_parent); + } TIGL_EXPORT virtual CTiglUIDObject* GetNextUIDParent(); TIGL_EXPORT virtual const CTiglUIDObject* GetNextUIDParent() const; @@ -80,7 +125,8 @@ namespace generated TIGL_EXPORT virtual void RemoveMass(); protected: - CPACSSysElemGenericComponents* m_parent; + void* m_parent; + const std::type_info* m_parentType; CTiglUIDManager* m_uidMgr; @@ -107,5 +153,12 @@ namespace generated // Aliases in tigl namespace using CCPACSVehicleElementBase = generated::CPACSVehicleElementBase; +using CCPACSCargoContainerElements = generated::CPACSCargoContainerElements; +using CCPACSCeilingPanelElements = generated::CPACSCeilingPanelElements; +using CCPACSClassDividerElements = generated::CPACSClassDividerElements; +using CCPACSGenericFloorElements = generated::CPACSGenericFloorElements; +using CCPACSLavatoryElements = generated::CPACSLavatoryElements; +using CCPACSLuggageCompartmentElements = generated::CPACSLuggageCompartmentElements; +using CCPACSSidewallPanelElements = generated::CPACSSidewallPanelElements; using CCPACSSysElemGenericComponents = generated::CPACSSysElemGenericComponents; } // namespace tigl diff --git a/src/geometry/CCPACSTransformation.cpp b/src/geometry/CCPACSTransformation.cpp index 17144c72f2..46d5c65456 100644 --- a/src/geometry/CCPACSTransformation.cpp +++ b/src/geometry/CCPACSTransformation.cpp @@ -65,13 +65,19 @@ CCPACSTransformation::CCPACSTransformation(CCPACSFuselageSection* parent, CTiglU { } -CCPACSTransformation::CCPACSTransformation(CCPACSExternalObject* parent, CTiglUIDManager* uidMgr) +CCPACSTransformation::CCPACSTransformation(CCPACSDeck* parent, CTiglUIDManager* uidMgr) : generated::CPACSTransformation(parent, uidMgr) , _transformationMatrix(*this, &CCPACSTransformation::updateMatrix) { } -CCPACSTransformation::CCPACSTransformation(CCPACSGenericGeometryComponent* parent, CTiglUIDManager* uidMgr) +CCPACSTransformation::CCPACSTransformation(CCPACSDeckComponentBase* parent, CTiglUIDManager* uidMgr) + : generated::CPACSTransformation(parent, uidMgr) + , _transformationMatrix(*this, &CCPACSTransformation::updateMatrix) +{ +} + +CCPACSTransformation::CCPACSTransformation(CCPACSExternalObject* parent, CTiglUIDManager* uidMgr) : generated::CPACSTransformation(parent, uidMgr) , _transformationMatrix(*this, &CCPACSTransformation::updateMatrix) { @@ -146,8 +152,8 @@ CCPACSTransformation::CCPACSTransformation(CCPACSElementGeometry* parent, CTiglU CCPACSTransformation::CCPACSTransformation(CTiglUIDManager* uidMgr) : generated::CPACSTransformation((CCPACSWingSection*)nullptr, uidMgr) , _transformationMatrix(*this, &CCPACSTransformation::updateMatrix) -{} - +{ +} void CCPACSTransformation::reset() { @@ -163,10 +169,10 @@ void CCPACSTransformation::reset() } } -CCPACSTransformation &CCPACSTransformation::operator =(const CCPACSTransformation &trafo) +CCPACSTransformation& CCPACSTransformation::operator=(const CCPACSTransformation& trafo) { - m_scaling = trafo.m_scaling; - m_rotation = trafo.m_rotation; + m_scaling = trafo.m_scaling; + m_rotation = trafo.m_rotation; m_translation = trafo.m_translation; _transformationMatrix.clear(); @@ -174,7 +180,7 @@ CCPACSTransformation &CCPACSTransformation::operator =(const CCPACSTransformatio return *this; } -void CCPACSTransformation::setTranslation(const CTiglPoint & translation) +void CCPACSTransformation::setTranslation(const CTiglPoint& translation) { GetTranslation(CreateIfNotExists).SetAsPoint(translation); } @@ -220,7 +226,6 @@ void CCPACSTransformation::setTransformationMatrix(const CTiglTransformation& ma double translation[3]; matrix.Decompose(&scale[0], &rotation[0], &translation[0]); - if (!m_translation) { m_translation = boost::in_place(this, m_uidMgr); } @@ -228,7 +233,6 @@ void CCPACSTransformation::setTransformationMatrix(const CTiglTransformation& ma m_translation->SetY(translation[1]); m_translation->SetZ(translation[2]); - if (!m_scaling) { m_scaling = boost::in_place(this, m_uidMgr); } @@ -321,7 +325,6 @@ void CCPACSTransformation::InvalidateImpl(const boost::optional& so } } - void CCPACSTransformation::Init(const std::string& baseUID) { if (GetUIDManager().IsUIDRegistered(baseUID)) { diff --git a/src/geometry/CCPACSTransformation.h b/src/geometry/CCPACSTransformation.h index 6cadf8f34f..9f06f18db0 100644 --- a/src/geometry/CCPACSTransformation.h +++ b/src/geometry/CCPACSTransformation.h @@ -42,7 +42,6 @@ class CCPACSTransformation : public generated::CPACSTransformation TIGL_EXPORT CCPACSTransformation(CCPACSExternalObject* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSTransformation(CCPACSVessel* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSTransformation(CCPACSFuelTank* parent, CTiglUIDManager* uidMgr); - TIGL_EXPORT CCPACSTransformation(CCPACSGenericGeometryComponent* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSTransformation(CCPACSLandingGearBase* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSTransformation(CCPACSNacelleSection* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSTransformation(CCPACSRotor* parent, CTiglUIDManager* uidMgr); @@ -52,7 +51,9 @@ class CCPACSTransformation : public generated::CPACSTransformation TIGL_EXPORT CCPACSTransformation(CCPACSWingSection* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSTransformation(CCPACSExternalGeometry* parent, CTiglUIDManager* uidMgr); TIGL_EXPORT CCPACSTransformation(CCPACSElementGeometry* parent, CTiglUIDManager* uidMgr); - + TIGL_EXPORT CCPACSTransformation(CCPACSDeck* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CCPACSTransformation(CCPACSDeckComponentBase* parent, CTiglUIDManager* uidMgr); + TIGL_EXPORT CCPACSTransformation(CTiglUIDManager* uidMgr); TIGL_EXPORT void reset(); diff --git a/src/geometry/CTiglRelativelyPositionedComponent.cpp b/src/geometry/CTiglRelativelyPositionedComponent.cpp index f2e73f54b4..5b9d53992f 100644 --- a/src/geometry/CTiglRelativelyPositionedComponent.cpp +++ b/src/geometry/CTiglRelativelyPositionedComponent.cpp @@ -50,6 +50,7 @@ CTiglRelativelyPositionedComponent::CTiglRelativelyPositionedComponent(tigl::CTi CTiglRelativelyPositionedComponent::CTiglRelativelyPositionedComponent(tigl::CTiglRelativelyPositionedComponent *parent, MaybeOptionalPtr trans, boost::optional* symmetryAxis) : _parent(parent), _transformation(trans), _symmetryAxis(symmetryAxis){} + void CTiglRelativelyPositionedComponent::Reset() const { CTiglAbstractGeometricComponent::Reset(); @@ -180,16 +181,20 @@ ECPACSTranslationType CTiglRelativelyPositionedComponent::GetRotationType() cons { if (GetTransformSE3()) return GetTransformSE3()->getRotationType(); - else + else if (GetTransform()) return GetTransform()->getRotationType(); + else + return ABS_GLOBAL; } ECPACSTranslationType CTiglRelativelyPositionedComponent::GetScalingType() const { if (GetTransformSE3()) return ABS_GLOBAL; + else if (GetTransform()) + return GetTransform()->getScalingType(); else - return GetTransform()->getScalingType(); + return ABS_GLOBAL; } // Returns a pointer to the list of children of a component. diff --git a/src/geometry/CTiglTransformation.cpp b/src/geometry/CTiglTransformation.cpp index 819a5bf1b4..b4e89c24fd 100644 --- a/src/geometry/CTiglTransformation.cpp +++ b/src/geometry/CTiglTransformation.cpp @@ -833,6 +833,20 @@ tigl::CTiglTransformation tigl::CTiglTransformation::GetRotationFromAxisRotation return R; } +double CTiglTransformation::GetLinearDeterminant() const +{ + gp_XYZ col1(GetValue(0, 0), GetValue(1, 0), GetValue(2, 0)); + gp_XYZ col2(GetValue(0, 1), GetValue(1, 1), GetValue(2, 1)); + gp_XYZ col3(GetValue(0, 2), GetValue(1, 2), GetValue(2, 2)); + + gp_Mat M(col1, col2, col3); + return M.Determinant(); +} + +double CTiglTransformation::GetVolumeScaleFactor() const +{ + return std::abs(GetLinearDeterminant()); +} std::ostream& operator<<(std::ostream& os, const CTiglTransformation& t) { diff --git a/src/geometry/CTiglTransformation.h b/src/geometry/CTiglTransformation.h index e5026c55f2..3c2a5a70ca 100644 --- a/src/geometry/CTiglTransformation.h +++ b/src/geometry/CTiglTransformation.h @@ -166,6 +166,13 @@ class CTiglTransformation // Return a transformation that only contains a axial rotation defined by the two parameters. TIGL_EXPORT static CTiglTransformation GetRotationFromAxisRotation( tigl::CTiglPoint axis, double angle ); + // Get Linear Determinant + TIGL_EXPORT double GetLinearDeterminant() const; + + // Get the absolute volume scaling factor of the affine transformation, + // i.e. abs(det(A)) of the upper-left 3x3 linear part. + TIGL_EXPORT double GetVolumeScaleFactor() const; + // Return true if the transformation has a zero scaling TIGL_EXPORT bool HasZeroScaling() const; diff --git a/tests/unittests/TestData/simpletest-decks.cpacs.xml b/tests/unittests/TestData/simpletest-decks.cpacs.xml new file mode 100644 index 0000000000..41262287f1 --- /dev/null +++ b/tests/unittests/TestData/simpletest-decks.cpacs.xml @@ -0,0 +1,699 @@ + + +

+ Decks test + Simple decks definitions for unit testing + 1.0.0 + + + First test set + Marko Alder + 2026-01-18T12:00:00 + 3.5 + + +
+ + + + Test aircraft + + + Simple fuselage + + + 0.5 + + + 1.0 + 10.0 + 10.0 + + + +
+ Fuselage Section 1 + + + + Fuselage Section 1 + fuselageCircleProfile + + + +
+
+ Fuselage Section 2 + + + + Fuselage Section 2 + fuselageCircleProfile + + + +
+
+ Fuselage Section 3 + + + + Fuselage Section 3 + fuselageCircleProfile + + + +
+
+ + + Fuselage Positioning 1 + 0. + 90 + 0 + fuselage_Section1 + + + Fuselage Positioning 2 + 2. + 90 + 0 + fuselage_Section1 + fuselage_section2 + + + Fuselage Positioning 3 + 15. + 90 + 0 + fuselage_section2 + fuselage_section3 + + + + + Fuselage Segment 2 + fuselage_section1_element1 + fuselage_section2_element1 + + + Fuselage Segment 3 + fuselage_section2_element1 + fuselage_section3_element1 + + + + + Deck + + + 2.0 + + + passenger + + Cabin geometry + + + 0;1;2;3 + 4 + + + 5;6;7;8 + + + + Seat module 1 LH + predSeatElement + + + Seat module 1 LH + predSeatElement + + + -2.2 + + + + + Seat module 1 LH + predSeatElement2 + + + 2 + 2 + 2 + + + -0.5 + -1 + -1 + + + -90 + + + + + + + Ceiling panel + predCeilingPanel + + + 75. + + + 2.5 + 1.5 + + + + + + + Sidewall panel + predSidewallPanel + + + 2.7 + 0.3 + + + + + + + Luggage compartment + predLuggageCompartment + + + 0.5 + 1.3 + 1 + + + 5 + 1 + 0.5 + + + + + + + Class divider + predClassDivider + + + 8 + 0 + 1 + + + + + + + Galley + predGalleyElement + + + -90 + + + 5 + -2 + + + + + + + Lavatory + predLavatoryElement + + + 10 + -2 + + + + + + + Generic floor module + predGenericFloorElement + + + 10 + 2 + + + + + + + Cargo container + predCargoContainer + + + -2 + + + + + + + Deck empty + This schema-valid deck intentionally contains no components. + + + 0.0 + + + passenger + + Cabin geometry + + + 0;1;2;3 + 4 + + + 5;6;7;8 + + + +
+
+ + + Simple Wing + SimpleFuselage + + + 5. + 5. + + + 2 + 1.5 + 2 + + + +
+ root section + + + 0.0 + 0.0 + 0.0 + + + 1 + 1 + 1 + + + 0.0 + 0.0 + 0.0 + + + + + wing root element + NACA0009 + + + 0.0 + 0.0 + 0.0 + + + 3 + 1 + 2 + + + 0.0 + 0.0 + 0.0 + + + + +
+
+ tip section + + + 0.0 + 0.0 + 0.0 + + + 1 + 1 + 1 + + + 1.5 + 10.0 + 0.0 + + + + + wing tip element + NACA0009 + + + 0.0 + 0.0 + 0.0 + + + 1.5 + 1 + 2 + + + 0.0 + 0.0 + 0.0 + + + + +
+
+ + + wing segment + wing1section1element1 + wing1section2element1 + + +
+
+
+
+ + + + NACA0009 Airfoil + NACA 4-digit symmetrical airfoil with a thickness of 9percent + + 1.0;0.99572;0.98296;0.96194;0.93301;0.89668;0.85355;0.80438;0.75;0.69134;0.62941;0.56526;0.5;0.43474;0.37059;0.33928;0.30866;0.27886;0.25;0.22221;0.19562;0.17033;0.14645;0.12408;0.10332;0.08427;0.06699;0.05156;0.03806;0.02653;0.01704;0.00961;0.00428;0.00107;0.0;0.00107;0.00428;0.00961;0.01704;0.02653;0.03806;0.05156;0.06699;0.08427;0.10332;0.12408;0.14645;0.17033;0.19562;0.22221;0.25;0.27886;0.30866;0.33928;0.37059;0.43474;0.5;0.56526;0.62941;0.69134;0.75;0.80438;0.85355;0.89668;0.93301;0.96194;0.98296;0.99572;1.0 + 0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0 + 0.0;0.00057;0.00218;0.00463;0.0077;0.01127;0.01522;0.01945;0.02384;0.02823;0.03247;0.03638;0.03978;0.04248;0.04431;0.04484;0.04509;0.04504;0.04466;0.04397;0.04295;0.04161;0.03994;0.03795;0.03564;0.03305;0.03023;0.0272;0.02395;0.02039;0.01646;0.01214;0.00767;0.00349;0.0;-0.00349;-0.00767;-0.01214;-0.01646;-0.02039;-0.02395;-0.0272;-0.03023;-0.03305;-0.03564;-0.03795;-0.03994;-0.04161;-0.04295;-0.04397;-0.04466;-0.04504;-0.04509;-0.04484;-0.04431;-0.04248;-0.03978;-0.03638;-0.03247;-0.02823;-0.02384;-0.01945;-0.01522;-0.01127;-0.0077;-0.00463;-0.00218;-0.00057;0.0 + + + + + + Circle + Profile build up from set of Points on Circle where may Dimensions are 1..-1 + + + 0.5 + 2 + 2 + 2 + 2 + + + + + Luggage compartment profile + + + 0.5 + 1.5 + 1.5 + 0.5 + 0.5 + + + + + + + + + Predefined ceiling panel + + + + 3 + 0.2 + 2.0 + + + + + + + + Predefined sidewall panel + + + + 5 + 0.1 + 1.5 + 0.1 + 4.9 + + + + + + + + Predefined seat element + + + + 0.8 + 2.0 + 1 + + + 0.2 + + + + + + + 0.3 + + + + + 12 + + + + Predefined element used to test scaling at deck level + + + + 1 + 1 + 1 + 0.5 + 0.5 + 0.5 + 0.5 + + + + + 1 + + 0.5 + 0.5 + 0 + + + + + + + Predefined luggage compartment + + + + 0.8 + 2 + + + + + 123. + + 0.2 + 0.3 + 0.4 + + + + + + + Predefined class devider + + + + 0.2 + 2.5 + 1.0 + + + + + 123. + + 1 + 2 + 3 + + + + + + + Predefined galley element + + + + -90 + + + + + +
+ Section 1 + + + Element 1 + luggageCompartmentProfile + + + 0 + 1 + 1 + + + + + +
+
+ Section 2 + + + Element 2 + luggageCompartmentProfile + + + 0 + 1 + 1 + + + + + + + 1.5 + + +
+
+ + + Segment 1 + predGE_el1 + predGE_el2 + + +
+
+
+
+
+ + + Predefined lavatory Element + + + + nacelle.stp + + + 0.3 + 0.9 + 0.9 + + + 90. + + + 0.77 + + + + + + + + + + Predefined floor element + + + + 0.5 + 1.2 + + + + + + + + Predefined cargo container + + + + 2 + 1 + 0.7 + 0 + 1.5 + + + 2 + 1.5 + 0.7 + + + 0.7 + + + + + + + +
+
+ \ No newline at end of file diff --git a/tests/unittests/TestData/simpletest-invalid-decks.cpacs.xml b/tests/unittests/TestData/simpletest-invalid-decks.cpacs.xml new file mode 100644 index 0000000000..e2c6d311ae --- /dev/null +++ b/tests/unittests/TestData/simpletest-invalid-decks.cpacs.xml @@ -0,0 +1,143 @@ + + +
+ Decks test + Simple decks definitions for unit testing + 1.0.0 + + + First test set + Marko Alder + 2026-01-18T12:00:00 + 3.5 + + +
+ + + + Test aircraft + + + Simple fuselage + + + 0.5 + + + 1.0 + 10.0 + 10.0 + + + +
+ Fuselage Section 1 + + + + Fuselage Section 1 + fuselageCircleProfile + + + +
+
+ Fuselage Section 2 + + + + Fuselage Section 2 + fuselageCircleProfile + + + +
+
+ Fuselage Section 3 + + + + Fuselage Section 3 + fuselageCircleProfile + + + +
+
+ + + Fuselage Positioning 1 + 0. + 90 + 0 + fuselage_Section1 + + + Fuselage Positioning 2 + 2. + 90 + 0 + fuselage_Section1 + fuselage_section2 + + + Fuselage Positioning 3 + 15. + 90 + 0 + fuselage_section2 + fuselage_section3 + + + + + Fuselage Segment 2 + fuselage_section1_element1 + fuselage_section2_element1 + + + Fuselage Segment 3 + fuselage_section2_element1 + fuselage_section3_element1 + + + + + Deck 1 + + + + passenger + + + Seat module + fuselageCircleProfile + + + + +
+
+
+
+ + + + Circle + Profile build up from set of Points on Circle where may Dimensions are 1..-1 + + + 0.5 + 2 + 2 + 2 + 2 + + + + + +
+
\ No newline at end of file diff --git a/tests/unittests/test_decks.py b/tests/unittests/test_decks.py new file mode 100644 index 0000000000..ed32055222 --- /dev/null +++ b/tests/unittests/test_decks.py @@ -0,0 +1,189 @@ +############################################################################# +# Copyright (C) 2007-2026 German Aerospace Center (DLR/SC) +# +# Created: 2026-01-30 Marko Alder +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################# + +import unittest + +from tigl3.tigl3wrapper import * +from tixi3.tixi3wrapper import * +from tigl3 import configuration, geometry + +from OCC.Core.Bnd import Bnd_Box +from OCC.Core.BRepBndLib import brepbndlib_Add + + +class Decks(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.tixi = Tixi3() + cls.tigl = Tigl3() + + cls.assertIsNone = staticmethod(unittest.TestCase().assertIsNone) + cls.assertIsNone(cls.tixi.open("TestData/simpletest-decks.cpacs.xml")) + cls.assertIsNone(cls.tigl.open(cls.tixi, "testAircraft")) + + mgr = configuration.CCPACSConfigurationManager.get_instance() + cls.config = mgr.get_configuration(cls.tigl._handle.value) + cls.uid_mgr = cls.config.get_uidmanager() + + @classmethod + def tearDownClass(cls): + cls.tigl.close() + cls.tixi.close() + + def test_deck(self): + + deck = self.uid_mgr.get_geometric_component("deck1") + self.assertIsInstance(deck, geometry.ITiglGeometricComponent) + self.assertIsInstance(deck, configuration.CCPACSDeck) + + # Cabin geometry + cabinGeometry = deck.get_cabin_geometry() + self.assertIsInstance(cabinGeometry, configuration.CPACSCabinGeometry) + self.assertIsInstance( + cabinGeometry.get_contours(), configuration.CPACSCabinGeometryContours + ) + contour = cabinGeometry.get_contours().get_contour(1) + self.assertIsInstance( + contour, + configuration.CPACSCabinGeometryContour, + ) + self.assertIsInstance( + contour.get_y(), + configuration.CPACSDoubleVectorBase, + ) + + # Deck components + self.assertIsInstance(deck.get_seat_modules(), configuration.CPACSSeatModules) + self.assertIsInstance( + deck.get_seat_modules().get_seat_module(1), + configuration.CCPACSDeckComponentBase, + ) + + self.assertIsInstance( + deck.get_sidewall_panels(), configuration.CPACSSidewallPanels + ) + self.assertIsInstance( + deck.get_sidewall_panels().get_sidewall_panel(1), + configuration.CCPACSDeckComponentBase, + ) + + self.assertIsInstance( + deck.get_luggage_compartments(), configuration.CPACSLuggageCompartments + ) + self.assertIsInstance( + deck.get_luggage_compartments().get_luggage_compartment(1), + configuration.CCPACSDeckComponentBase, + ) + + self.assertIsInstance( + deck.get_ceiling_panels(), configuration.CPACSCeilingPanels + ) + self.assertIsInstance( + deck.get_ceiling_panels().get_ceiling_panel(1), + configuration.CCPACSDeckComponentBase, + ) + + self.assertIsInstance(deck.get_galleys(), configuration.CPACSGalleys) + self.assertIsInstance( + deck.get_galleys().get_galley(1), + configuration.CCPACSDeckComponentBase, + ) + + self.assertIsInstance( + deck.get_generic_floor_modules(), configuration.CPACSGenericFloorModules + ) + self.assertIsInstance( + deck.get_generic_floor_modules().get_generic_floor_module(1), + configuration.CCPACSDeckComponentBase, + ) + + self.assertIsInstance(deck.get_lavatories(), configuration.CPACSLavatories) + self.assertIsInstance( + deck.get_lavatories().get_lavatory(1), + configuration.CCPACSDeckComponentBase, + ) + + self.assertIsInstance( + deck.get_class_dividers(), configuration.CPACSClassDividers + ) + self.assertIsInstance( + deck.get_class_dividers().get_class_divider(1), + configuration.CCPACSDeckComponentBase, + ) + + self.assertIsInstance( + deck.get_cargo_containers(), configuration.CPACSCargoContainers + ) + self.assertIsInstance( + deck.get_cargo_containers().get_cargo_container(1), + configuration.CCPACSDeckComponentBase, + ) + + with self.assertRaises(AttributeError): + deck.get_seat_modules().get_seat_modules() + with self.assertRaises(AttributeError): + deck.get_sidewall_panels().get_sidewall_panels() + with self.assertRaises(AttributeError): + deck.get_luggage_compartments().get_luggage_compartments() + with self.assertRaises(AttributeError): + deck.get_ceiling_panels().get_ceiling_panels() + with self.assertRaises(AttributeError): + deck.get_galleys().get_galleys() + with self.assertRaises(AttributeError): + deck.get_generic_floor_modules().get_generic_floor_modules() + with self.assertRaises(AttributeError): + deck.get_lavatories().get_lavatorys() + with self.assertRaises(AttributeError): + deck.get_class_dividers().get_class_dividers() + with self.assertRaises(AttributeError): + deck.get_cargo_containers().get_cargo_containers() + + def test_deckComponentBase(self): + + component = self.uid_mgr.get_geometric_component("classDivider") + self.assertIsInstance( + component, + configuration.CCPACSDeckComponentBase, + ) + + self.assertIsInstance(component.get_mass(), float) + self.assertIsInstance( + component.get_center_of_gravity_global(), geometry.CTiglPoint + ) + self.assertIsInstance( + component.get_center_of_gravity_local(), geometry.CTiglPoint + ) + self.assertIsInstance( + component.get_mass_inertia_local(), configuration.CTiglMassInertia + ) + + self.assertIsInstance(component.get_component_intent(), int) + self.assertIsInstance(component.get_component_representation(), int) + self.assertIsInstance(component.get_component_representation_as_string(), str) + self.assertIsInstance(component.get_component_type(), int) + + self.assertIsInstance( + component.get_configuration(), configuration.CCPACSConfiguration + ) + + self.assertIsInstance(component.get_defaulted_uid(), str) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/unittests/tiglDecks.cpp b/tests/unittests/tiglDecks.cpp new file mode 100644 index 0000000000..8717c7944c --- /dev/null +++ b/tests/unittests/tiglDecks.cpp @@ -0,0 +1,354 @@ +/* +* Copyright (C) 2007-2026 German Aerospace Center (DLR/SC) +* +* Created: 2026-03-18 Marko Alder +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "test.h" +#include "tigl.h" +#include "testUtils.h" + +#include + +#include "CCPACSConfigurationManager.h" +#include "CCPACSDeck.h" +#include "CCPACSDeckComponentBase.h" + +#include "CNamedShape.h" +#include +#include + +class Decks : public ::testing::Test +{ +protected: + static void SetUpTestCase() + { + const char* filename = "TestData/simpletest-decks.cpacs.xml"; + ASSERT_EQ(tixiOpenDocument(filename, &tixiHandle), SUCCESS); + ASSERT_EQ(tiglOpenCPACSConfiguration(tixiHandle, "testAircraft", &tiglHandle), TIGL_SUCCESS); + } + + static void TearDownTestCase() + { + ASSERT_EQ(tiglCloseCPACSConfiguration(tiglHandle), TIGL_SUCCESS); + ASSERT_EQ(tixiCloseDocument(tixiHandle), SUCCESS); + tiglHandle = -1; + tixiHandle = -1; + } + + const tigl::CTiglUIDManager& GetUIDManager() const + { + return tigl::CCPACSConfigurationManager::GetInstance().GetConfiguration(tiglHandle).GetUIDManager(); + } + + const tigl::CCPACSDeck& GetDeck(const std::string& uid) const + { + return GetUIDManager().ResolveObject(uid); + } + + const tigl::CCPACSDeckComponentBase& GetComponent(const std::string& uid) const + { + return GetUIDManager().ResolveObject(uid); + } + + static TixiDocumentHandle tixiHandle; + static TiglCPACSConfigurationHandle tiglHandle; +}; + +TixiDocumentHandle Decks::tixiHandle = 0; +TiglCPACSConfigurationHandle Decks::tiglHandle = 0; + +TEST_F(Decks, Basics) +{ + const auto& deck = GetDeck("deck"); + const auto& component = GetComponent("seatModule1_rh"); + + EXPECT_EQ(deck.GetDefaultedUID(), "deck"); + EXPECT_EQ(component.GetDefaultedUID(), "seatModule1_rh"); + + EXPECT_EQ(deck.GetComponentType(), TIGL_COMPONENT_DECK); + EXPECT_EQ(deck.GetComponentIntent(), TIGL_INTENT_PHYSICAL); + + EXPECT_EQ(component.GetComponentType(), TIGL_COMPONENT_DECK_COMPONENT); + EXPECT_EQ(component.GetComponentIntent(), TIGL_INTENT_PHYSICAL); + + EXPECT_EQ(deck.GetConfiguration().GetUID(), "testAircraft"); + EXPECT_EQ(component.GetConfiguration().GetUID(), "testAircraft"); +} + +TEST_F(Decks, DeckGeometry) +{ + const auto& deck = GetDeck("deck"); + + const PNamedShape shape = deck.GetLoft(); + ASSERT_TRUE(shape); + EXPECT_EQ(shape->Name(), "deck"); + + // 2 seat modules + 8 further deck components + unsigned shapeCount = 0; + for (TopoDS_Iterator it(shape->Shape()); it.More(); it.Next()) { + ++shapeCount; + } + EXPECT_EQ(shapeCount, 11u); +} + +TEST_F(Decks, ComponentRepresentation) +{ + const auto& seat = GetComponent("seatModule1_rh"); + const auto& ceiling = GetComponent("ceilingPanel1"); + const auto& galley = GetComponent("galley"); + const auto& lavatory = GetComponent("lavatory"); + + EXPECT_EQ(seat.GetComponentRepresentation(), TIGL_GEOMREP_ENVELOPE); + EXPECT_EQ(seat.GetComponentRepresentationAsString(), "envelope"); + + EXPECT_EQ(ceiling.GetComponentRepresentation(), TIGL_GEOMREP_PHYSICAL); + EXPECT_EQ(ceiling.GetComponentRepresentationAsString(), "physical"); + EXPECT_EQ(galley.GetComponentRepresentation(), TIGL_GEOMREP_PHYSICAL); + EXPECT_EQ(lavatory.GetComponentRepresentation(), TIGL_GEOMREP_PHYSICAL); +} + +TEST_F(Decks, ComponentGeometryBuilders) +{ + { + const auto& component = GetComponent("seatModule1_rh"); + const auto shape = component.GetLoft(); + ASSERT_TRUE(shape); + EXPECT_EQ(shape->Name(), "seatModule1_rh_cuboid_1"); + EXPECT_EQ(shape->GetFaceCount(), 6u); + } + + { + const auto& component = GetComponent("luggageCompartment"); + const auto shape = component.GetLoft(); + ASSERT_TRUE(shape); + EXPECT_EQ(shape->Name(), "luggageCompartment_cylinder_1"); + EXPECT_EQ(shape->GetFaceCount(), 3u); + } + + { + const auto& component = GetComponent("classDivider"); + const auto shape = component.GetLoft(); + ASSERT_TRUE(shape); + EXPECT_EQ(shape->Name(), "classDivider_ellipsoid_1"); + EXPECT_EQ(shape->GetFaceCount(), 1u); + } + + { + const auto& component = GetComponent("galley"); + const auto shape = component.GetLoft(); + ASSERT_TRUE(shape); + EXPECT_EQ(shape->Name(), "galley_multiSegmentShape_1"); + EXPECT_GT(shape->GetFaceCount(), 0u); + } + + { + const auto& component = GetComponent("lavatory"); + const auto shape = component.GetLoft(); + ASSERT_TRUE(shape); + EXPECT_EQ(shape->Name(), "lavatory_external_1"); + EXPECT_GT(shape->GetFaceCount(), 0u); + } + + { + const auto& component = GetComponent("floorModule"); + const auto shape = component.GetLoft(); + ASSERT_TRUE(shape); + EXPECT_EQ(shape->Name(), "floorModule_cone_1"); + EXPECT_GT(shape->GetFaceCount(), 0u); + } +} + +TEST_F(Decks, MultiPrimitiveComponentGeometry) +{ + const double eps = 1e-6; + + const auto& component = GetComponent("cargoContainer"); + const auto shape = component.GetLoft(); + ASSERT_TRUE(shape); + + // cargoContainer is composed of two cuboids + EXPECT_GT(shape->GetFaceCount(), 6u); + + Bnd_Box box; + BRepBndLib::Add(shape->Shape(), box); + double xmin, ymin, zmin, xmax, ymax, zmax; + box.Get(xmin, ymin, zmin, xmax, ymax, zmax); + + EXPECT_NEAR(xmax - xmin, 2, eps); + EXPECT_NEAR(ymax - ymin, 1.5, eps); + EXPECT_NEAR(zmax - zmin, 1.4, eps); +} + +TEST_F(Decks, ComponentMass_DensityBased) +{ + const auto& seat = GetComponent("seatModule1_rh"); + const double eps = 1e-6; + + const auto mass = seat.GetMass(); + ASSERT_TRUE(mass); + EXPECT_NEAR(*mass, 19.2, eps); + + const auto cogLocal = seat.GetCenterOfGravityLocal(); + ASSERT_TRUE(cogLocal); + // 0.4 geometric center + 0.2 local cuboid translation + 0.3 local geometry translation + EXPECT_NEAR(cogLocal->x, 0.9, eps); + EXPECT_NEAR(cogLocal->y, 1.0, eps); + EXPECT_NEAR(cogLocal->z, 0.5, eps); + + const auto cogGlobal = seat.GetCenterOfGravityGlobal(); + ASSERT_TRUE(cogGlobal); + EXPECT_NEAR(cogGlobal->x, 3.4, eps); // 0.9 local + 2.5 global translation + EXPECT_NEAR(cogGlobal->y, 1.0, eps); + EXPECT_NEAR(cogGlobal->z, 0.5, eps); +} + +TEST_F(Decks, ComponentMass_ExplicitMassAndLocation) +{ + const auto& luggage = GetComponent("luggageCompartment"); + const double eps = 1e-6; + + const auto mass = luggage.GetMass(); + ASSERT_TRUE(mass); + EXPECT_NEAR(*mass, 79.95, eps); + + const auto cogLocal = luggage.GetCenterOfGravityLocal(); + ASSERT_TRUE(cogLocal); + EXPECT_NEAR(cogLocal->x, 0.2, eps); + EXPECT_NEAR(cogLocal->y, 0.3, eps); + EXPECT_NEAR(cogLocal->z, 0.4, eps); + + const auto cogGlobal = luggage.GetCenterOfGravityGlobal(); + ASSERT_TRUE(cogGlobal); + + EXPECT_NEAR(cogGlobal->x, 7.6, eps); + EXPECT_NEAR(cogGlobal->y, 1.39, eps); + EXPECT_NEAR(cogGlobal->z, 0.9, eps); +} + +TEST_F(Decks, ComponentMass_ExplicitMassInertia) +{ + const auto& classDivider = GetComponent("classDivider"); + const double eps = 1e-6; + + const auto mass = classDivider.GetMass(); + ASSERT_TRUE(mass); + EXPECT_NEAR(*mass, 123.0, eps); + + const auto inertia = classDivider.GetMassInertiaLocal(); + ASSERT_TRUE(inertia); + EXPECT_NEAR(inertia->Jxx, 1.0, eps); + EXPECT_NEAR(inertia->Jyy, 2.0, eps); + EXPECT_NEAR(inertia->Jzz, 3.0, eps); + + EXPECT_FALSE(inertia->Jxy); + EXPECT_FALSE(inertia->Jxz); + EXPECT_FALSE(inertia->Jyz); +} + +TEST_F(Decks, NoMass) +{ + // Deck component without mass definition (which is ok) + const auto& comp = GetComponent("galley"); + ASSERT_FALSE(comp.GetMass()); + EXPECT_FALSE(comp.GetCenterOfGravityLocal()); + EXPECT_FALSE(comp.GetCenterOfGravityGlobal()); + EXPECT_FALSE(comp.GetMassInertiaLocal()); +} + +// This test serves an intuitive testing of the scaling effect on mass properties at deck level +TEST_F(Decks, MassProperties_ScalingOfDeckInstance) +{ + const auto& comp = GetComponent("seatModule_massScaleTest"); + const double eps = 1e-6; + + const auto mass = comp.GetMass(); + ASSERT_TRUE(mass); + EXPECT_NEAR(*mass, 2.6666666, eps); + + const auto cogLocal = comp.GetCenterOfGravityLocal(); + ASSERT_TRUE(cogLocal); + EXPECT_NEAR(cogLocal->x, 0.5, eps); + EXPECT_NEAR(cogLocal->y, 0.5, eps); + EXPECT_NEAR(cogLocal->z, 0, eps); + + const auto cogGlobal = comp.GetCenterOfGravityGlobal(); + ASSERT_TRUE(cogGlobal); + EXPECT_NEAR(cogGlobal->x, 2, eps); + EXPECT_NEAR(cogGlobal->y, 0.0, eps); + EXPECT_NEAR(cogGlobal->z, 0.0, eps); +} + +TEST_F(Decks, EmptyDeck) +{ + const auto& deck = GetDeck("deck_empty"); + + EXPECT_EQ(deck.GetDefaultedUID(), "deck_empty"); + EXPECT_EQ(deck.GetComponentType(), TIGL_COMPONENT_DECK); + EXPECT_EQ(deck.GetComponentIntent(), TIGL_INTENT_PHYSICAL); + + const PNamedShape shape = deck.GetLoft(); + ASSERT_TRUE(shape); + EXPECT_EQ(shape->Name(), "deck_empty"); + EXPECT_EQ(shape->GetFaceCount(), 0u); + + unsigned shapeCount = 0; + for (TopoDS_Iterator it(shape->Shape()); it.More(); it.Next()) { + ++shapeCount; + } + EXPECT_EQ(shapeCount, 0u); +} + +class InvalidDecks : public ::testing::Test +{ +protected: + static void SetUpTestCase() + { + const char* filename = "TestData/simpletest-invalid-decks.cpacs.xml"; + ASSERT_EQ(tixiOpenDocument(filename, &tixiHandle), SUCCESS); + ASSERT_EQ(tiglOpenCPACSConfiguration(tixiHandle, "testAircraft", &tiglHandle), TIGL_SUCCESS); + } + + static void TearDownTestCase() + { + ASSERT_EQ(tiglCloseCPACSConfiguration(tiglHandle), TIGL_SUCCESS); + ASSERT_EQ(tixiCloseDocument(tixiHandle), SUCCESS); + tiglHandle = -1; + tixiHandle = -1; + } + + const tigl::CTiglUIDManager& GetUIDManager() const + { + return tigl::CCPACSConfigurationManager::GetInstance().GetConfiguration(tiglHandle).GetUIDManager(); + } + + const tigl::CCPACSDeckComponentBase& GetComponent(const std::string& uid) const + { + return GetUIDManager().ResolveObject(uid); + } + + static TixiDocumentHandle tixiHandle; + static TiglCPACSConfigurationHandle tiglHandle; +}; + +TixiDocumentHandle InvalidDecks::tixiHandle = 0; +TiglCPACSConfigurationHandle InvalidDecks::tiglHandle = 0; + +TEST_F(InvalidDecks, UnsupportedReferences) +{ + // Deck component references a profile UID + const auto& comp = GetComponent("seatModule"); + CheckExceptionMessage([&] { (void)comp.GetLoft(); }, "Unsupported deck element for uID \"fuselageCircleProfile\"."); +}