diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0b4ab4f9cb..86b19ebf93 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -429,8 +429,7 @@ function(files_for_ifc_version IFC_VERSION RESULT_NAME) ${IFC_PARSE_DIR}/Ifc${IFC_VERSION}.h ${IFC_PARSE_DIR}/Ifc${IFC_VERSION}enum.h ${IFC_PARSE_DIR}/Ifc${IFC_VERSION}.cpp - ${IFC_PARSE_DIR}/Ifc${IFC_VERSION}-schema.cpp - PARENT_SCOPE + PARENT_SCOPE ) endfunction() diff --git a/src/ifcexpressparser/nodes.py b/src/ifcexpressparser/nodes.py index cc480e84bf..bba5880a0d 100644 --- a/src/ifcexpressparser/nodes.py +++ b/src/ifcexpressparser/nodes.py @@ -137,7 +137,7 @@ class AttributeList(Node): class InverseAttribute(Node): name = property(lambda self: self.tokens[0]) - type = property(lambda self: self.tokens[2]) + type = property(lambda self: self.tokens[2] if self.tokens[2] != self.tokens[-4] else None) bounds = property(lambda self: None if len(self.tokens) != 9 else self.tokens[3]) entity = property(lambda self: self.tokens[-4]) attribute = property(lambda self: self.tokens[-2]) diff --git a/src/ifcexpressparser/schema_class.py b/src/ifcexpressparser/schema_class.py index cade035d97..8fbc4ee67f 100644 --- a/src/ifcexpressparser/schema_class.py +++ b/src/ifcexpressparser/schema_class.py @@ -194,11 +194,13 @@ class SchemaClass(codegen.Base): #endif """) + statements.append("namespace %s {" % mapping.schema.name) + statements.extend(('const schema_definition& get_schema() {', '', ' static const schema_definition* s = populate_schema();', ' return *s;', - '}','','')) + '}','}','','')) self.str = "\n".join(statements) diff --git a/src/ifcexpressparser/templates.py b/src/ifcexpressparser/templates.py index 45a87e3eff..c550b4a1b6 100644 --- a/src/ifcexpressparser/templates.py +++ b/src/ifcexpressparser/templates.py @@ -36,12 +36,12 @@ header = """ #include "../ifcparse/%(schema_name)senum.h" -const IfcParse::schema_definition& get_schema(); - #define IfcSchema %(schema_name)s namespace %(schema_name)s { +const IfcParse::schema_definition& get_schema(); + const char* const Identifier = "%(schema_name_upper)s"; // Forward definitions diff --git a/src/ifcparse/Ifc2x3-schema.cpp b/src/ifcparse/Ifc2x3-schema.cpp index 261bd388f8..97d9ee5445 100644 --- a/src/ifcparse/Ifc2x3-schema.cpp +++ b/src/ifcparse/Ifc2x3-schema.cpp @@ -24,8 +24,6 @@ * * ********************************************************************************/ -#ifndef USE_IFC4 - #include "../ifcparse/IfcSchema.h" using namespace IfcParse; @@ -9394,6 +9392,373 @@ schema_definition* populate_schema() { derived.push_back(false); derived.push_back(false); derived.push_back(false); derived.push_back(false); derived.push_back(false); IfcZone_type->set_attributes(attributes, derived); } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("IsActingUpon", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToActor_type, IfcRelAssignsToActor_type->attributes()[0])); + IfcActor_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("OfPerson", entity::inverse_attribute::set_type, 0, -1, IfcPerson_type, IfcPerson_type->attributes()[7])); + attributes.push_back(new entity::inverse_attribute("OfOrganization", entity::inverse_attribute::set_type, 0, -1, IfcOrganization_type, IfcOrganization_type->attributes()[4])); + IfcAddress_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ContainedInStructure", entity::inverse_attribute::set_type, 0, 1, IfcRelContainedInSpatialStructure_type, IfcRelContainedInSpatialStructure_type->attributes()[0])); + IfcAnnotation_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("ValuesReferenced", entity::inverse_attribute::set_type, 0, -1, IfcReferencesValueDocument_type, IfcReferencesValueDocument_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ValueOfComponents", entity::inverse_attribute::set_type, 0, -1, IfcAppliedValueRelationship_type, IfcAppliedValueRelationship_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("IsComponentIn", entity::inverse_attribute::set_type, 0, -1, IfcAppliedValueRelationship_type, IfcAppliedValueRelationship_type->attributes()[1])); + IfcAppliedValue_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("Actors", entity::inverse_attribute::set_type, 0, -1, IfcApprovalActorRelationship_type, IfcApprovalActorRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsRelatedWith", entity::inverse_attribute::set_type, 0, -1, IfcApprovalRelationship_type, IfcApprovalRelationship_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("Relates", entity::inverse_attribute::set_type, 0, -1, IfcApprovalRelationship_type, IfcApprovalRelationship_type->attributes()[1])); + IfcApproval_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("Contains", entity::inverse_attribute::set_type, 0, -1, IfcClassificationItem_type, IfcClassificationItem_type->attributes()[1])); + IfcClassification_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("IsClassifiedItemIn", entity::inverse_attribute::set_type, 0, 1, IfcClassificationItemRelationship_type, IfcClassificationItemRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsClassifyingItemIn", entity::inverse_attribute::set_type, 0, 1, IfcClassificationItemRelationship_type, IfcClassificationItemRelationship_type->attributes()[0])); + IfcClassificationItem_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("UsingCurves", entity::inverse_attribute::set_type, 1, -1, IfcCompositeCurve_type, IfcCompositeCurve_type->attributes()[0])); + IfcCompositeCurveSegment_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(6); + attributes.push_back(new entity::inverse_attribute("ClassifiedAs", entity::inverse_attribute::set_type, 0, -1, IfcConstraintClassificationRelationship_type, IfcConstraintClassificationRelationship_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("RelatesConstraints", entity::inverse_attribute::set_type, 0, -1, IfcConstraintRelationship_type, IfcConstraintRelationship_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("IsRelatedWith", entity::inverse_attribute::set_type, 0, -1, IfcConstraintRelationship_type, IfcConstraintRelationship_type->attributes()[3])); + attributes.push_back(new entity::inverse_attribute("PropertiesForConstraint", entity::inverse_attribute::set_type, 0, -1, IfcPropertyConstraintRelationship_type, IfcPropertyConstraintRelationship_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("Aggregates", entity::inverse_attribute::set_type, 0, -1, IfcConstraintAggregationRelationship_type, IfcConstraintAggregationRelationship_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("IsAggregatedIn", entity::inverse_attribute::set_type, 0, -1, IfcConstraintAggregationRelationship_type, IfcConstraintAggregationRelationship_type->attributes()[3])); + IfcConstraint_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("Controls", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToControl_type, IfcRelAssignsToControl_type->attributes()[0])); + IfcControl_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("CoversSpaces", entity::inverse_attribute::set_type, 0, 1, IfcRelCoversSpaces_type, IfcRelCoversSpaces_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("Covers", entity::inverse_attribute::set_type, 0, 1, IfcRelCoversBldgElements_type, IfcRelCoversBldgElements_type->attributes()[1])); + IfcCovering_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("AnnotatedBySymbols", entity::inverse_attribute::set_type, 0, 2, IfcTerminatorSymbol_type, IfcTerminatorSymbol_type->attributes()[0])); + IfcDimensionCurve_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("AssignedToFlowElement", entity::inverse_attribute::set_type, 0, 1, IfcRelFlowControlElements_type, IfcRelFlowControlElements_type->attributes()[0])); + IfcDistributionControlElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasControlElements", entity::inverse_attribute::set_type, 0, 1, IfcRelFlowControlElements_type, IfcRelFlowControlElements_type->attributes()[1])); + IfcDistributionFlowElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("IsPointedTo", entity::inverse_attribute::set_type, 0, -1, IfcDocumentInformationRelationship_type, IfcDocumentInformationRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsPointer", entity::inverse_attribute::set_type, 0, 1, IfcDocumentInformationRelationship_type, IfcDocumentInformationRelationship_type->attributes()[0])); + IfcDocumentInformation_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ReferenceToDocument", entity::inverse_attribute::set_type, 0, 1, IfcDocumentInformation_type, IfcDocumentInformation_type->attributes()[3])); + IfcDocumentReference_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("IsRelatedFromCallout", entity::inverse_attribute::set_type, 0, -1, IfcDraughtingCalloutRelationship_type, IfcDraughtingCalloutRelationship_type->attributes()[3])); + attributes.push_back(new entity::inverse_attribute("IsRelatedToCallout", entity::inverse_attribute::set_type, 0, -1, IfcDraughtingCalloutRelationship_type, IfcDraughtingCalloutRelationship_type->attributes()[2])); + IfcDraughtingCallout_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(12); + attributes.push_back(new entity::inverse_attribute("HasStructuralMember", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsStructuralElement_type, IfcRelConnectsStructuralElement_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("FillsVoids", entity::inverse_attribute::set_type, 0, 1, IfcRelFillsElement_type, IfcRelFillsElement_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ConnectedTo", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsElements_type, IfcRelConnectsElements_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasCoverings", entity::inverse_attribute::set_type, 0, -1, IfcRelCoversBldgElements_type, IfcRelCoversBldgElements_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasProjections", entity::inverse_attribute::set_type, 0, -1, IfcRelProjectsElement_type, IfcRelProjectsElement_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("ReferencedInStructures", entity::inverse_attribute::set_type, 0, -1, IfcRelReferencedInSpatialStructure_type, IfcRelReferencedInSpatialStructure_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasPorts", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsPortToElement_type, IfcRelConnectsPortToElement_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasOpenings", entity::inverse_attribute::set_type, 0, -1, IfcRelVoidsElement_type, IfcRelVoidsElement_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("IsConnectionRealization", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsWithRealizingElements_type, IfcRelConnectsWithRealizingElements_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("ProvidesBoundaries", entity::inverse_attribute::set_type, 0, -1, IfcRelSpaceBoundary_type, IfcRelSpaceBoundary_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ConnectedFrom", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsElements_type, IfcRelConnectsElements_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("ContainedInStructure", entity::inverse_attribute::set_type, 0, 1, IfcRelContainedInSpatialStructure_type, IfcRelContainedInSpatialStructure_type->attributes()[0])); + IfcElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ProjectsElements", entity::inverse_attribute::unspecified_type, -1, -1, IfcRelProjectsElement_type, IfcRelProjectsElement_type->attributes()[1])); + IfcFeatureElementAddition_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("VoidsElements", entity::inverse_attribute::unspecified_type, -1, -1, IfcRelVoidsElement_type, IfcRelVoidsElement_type->attributes()[1])); + IfcFeatureElementSubtraction_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasSubContexts", entity::inverse_attribute::set_type, 0, -1, IfcGeometricRepresentationSubContext_type, IfcGeometricRepresentationSubContext_type->attributes()[0])); + IfcGeometricRepresentationContext_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ContainedInStructure", entity::inverse_attribute::set_type, 0, 1, IfcRelContainedInSpatialStructure_type, IfcRelContainedInSpatialStructure_type->attributes()[0])); + IfcGrid_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(4); + attributes.push_back(new entity::inverse_attribute("PartOfW", entity::inverse_attribute::set_type, 0, 1, IfcGrid_type, IfcGrid_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("PartOfV", entity::inverse_attribute::set_type, 0, 1, IfcGrid_type, IfcGrid_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("PartOfU", entity::inverse_attribute::set_type, 0, 1, IfcGrid_type, IfcGrid_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasIntersections", entity::inverse_attribute::set_type, 0, -1, IfcVirtualGridIntersection_type, IfcVirtualGridIntersection_type->attributes()[0])); + IfcGridAxis_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("IsGroupedBy", entity::inverse_attribute::unspecified_type, -1, -1, IfcRelAssignsToGroup_type, IfcRelAssignsToGroup_type->attributes()[0])); + IfcGroup_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ReferenceIntoLibrary", entity::inverse_attribute::set_type, 0, 1, IfcLibraryInformation_type, IfcLibraryInformation_type->attributes()[4])); + IfcLibraryReference_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasRepresentation", entity::inverse_attribute::set_type, 0, 1, IfcMaterialDefinitionRepresentation_type, IfcMaterialDefinitionRepresentation_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("ClassifiedAs", entity::inverse_attribute::set_type, 0, 1, IfcMaterialClassificationRelationship_type, IfcMaterialClassificationRelationship_type->attributes()[1])); + IfcMaterial_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ToMaterialLayerSet", entity::inverse_attribute::unspecified_type, -1, -1, IfcMaterialLayerSet_type, IfcMaterialLayerSet_type->attributes()[0])); + IfcMaterialLayer_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("IsDefinedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelDefines_type, IfcRelDefines_type->attributes()[0])); + IfcObject_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(4); + attributes.push_back(new entity::inverse_attribute("HasAssignments", entity::inverse_attribute::set_type, 0, -1, IfcRelAssigns_type, IfcRelAssigns_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("IsDecomposedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelDecomposes_type, IfcRelDecomposes_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("Decomposes", entity::inverse_attribute::set_type, 0, 1, IfcRelDecomposes_type, IfcRelDecomposes_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasAssociations", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociates_type, IfcRelAssociates_type->attributes()[0])); + IfcObjectDefinition_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("PlacesObject", entity::inverse_attribute::set_type, 1, 1, IfcProduct_type, IfcProduct_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("ReferencedByPlacements", entity::inverse_attribute::set_type, 0, -1, IfcLocalPlacement_type, IfcLocalPlacement_type->attributes()[0])); + IfcObjectPlacement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasFillings", entity::inverse_attribute::set_type, 0, -1, IfcRelFillsElement_type, IfcRelFillsElement_type->attributes()[0])); + IfcOpeningElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("IsRelatedBy", entity::inverse_attribute::set_type, 0, -1, IfcOrganizationRelationship_type, IfcOrganizationRelationship_type->attributes()[3])); + attributes.push_back(new entity::inverse_attribute("Relates", entity::inverse_attribute::set_type, 0, -1, IfcOrganizationRelationship_type, IfcOrganizationRelationship_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("Engages", entity::inverse_attribute::set_type, 0, -1, IfcPersonAndOrganization_type, IfcPersonAndOrganization_type->attributes()[1])); + IfcOrganization_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("EngagedIn", entity::inverse_attribute::set_type, 0, -1, IfcPersonAndOrganization_type, IfcPersonAndOrganization_type->attributes()[0])); + IfcPerson_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("PartOfComplex", entity::inverse_attribute::set_type, 0, 1, IfcPhysicalComplexQuantity_type, IfcPhysicalComplexQuantity_type->attributes()[0])); + IfcPhysicalQuantity_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("ContainedIn", entity::inverse_attribute::unspecified_type, -1, -1, IfcRelConnectsPortToElement_type, IfcRelConnectsPortToElement_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("ConnectedFrom", entity::inverse_attribute::set_type, 0, 1, IfcRelConnectsPorts_type, IfcRelConnectsPorts_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ConnectedTo", entity::inverse_attribute::set_type, 0, 1, IfcRelConnectsPorts_type, IfcRelConnectsPorts_type->attributes()[0])); + IfcPort_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("OperatesOn", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToProcess_type, IfcRelAssignsToProcess_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("IsSuccessorFrom", entity::inverse_attribute::set_type, 0, -1, IfcRelSequence_type, IfcRelSequence_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsPredecessorTo", entity::inverse_attribute::set_type, 0, -1, IfcRelSequence_type, IfcRelSequence_type->attributes()[0])); + IfcProcess_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ReferencedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToProduct_type, IfcRelAssignsToProduct_type->attributes()[0])); + IfcProduct_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("ShapeOfProduct", entity::inverse_attribute::set_type, 1, 1, IfcProduct_type, IfcProduct_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasShapeAspects", entity::inverse_attribute::set_type, 0, -1, IfcShapeAspect_type, IfcShapeAspect_type->attributes()[4])); + IfcProductDefinitionShape_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("PropertyForDependance", entity::inverse_attribute::set_type, 0, -1, IfcPropertyDependencyRelationship_type, IfcPropertyDependencyRelationship_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("PropertyDependsOn", entity::inverse_attribute::set_type, 0, -1, IfcPropertyDependencyRelationship_type, IfcPropertyDependencyRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("PartOfComplex", entity::inverse_attribute::set_type, 0, 1, IfcComplexProperty_type, IfcComplexProperty_type->attributes()[1])); + IfcProperty_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasAssociations", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociates_type, IfcRelAssociates_type->attributes()[0])); + IfcPropertyDefinition_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("PropertyDefinitionOf", entity::inverse_attribute::set_type, 0, 1, IfcRelDefinesByProperties_type, IfcRelDefinesByProperties_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("DefinesType", entity::inverse_attribute::set_type, 0, 1, IfcTypeObject_type, IfcTypeObject_type->attributes()[1])); + IfcPropertySetDefinition_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("RepresentationMap", entity::inverse_attribute::set_type, 0, 1, IfcRepresentationMap_type, IfcRepresentationMap_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("LayerAssignments", entity::inverse_attribute::set_type, 0, -1, IfcPresentationLayerAssignment_type, IfcPresentationLayerAssignment_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("OfProductRepresentation", entity::inverse_attribute::set_type, 0, 1, IfcProductRepresentation_type, IfcProductRepresentation_type->attributes()[2])); + IfcRepresentation_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("RepresentationsInContext", entity::inverse_attribute::set_type, 0, -1, IfcRepresentation_type, IfcRepresentation_type->attributes()[0])); + IfcRepresentationContext_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("LayerAssignments", entity::inverse_attribute::set_type, 0, -1, IfcPresentationLayerAssignment_type, IfcPresentationLayerAssignment_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("StyledByItem", entity::inverse_attribute::set_type, 0, 1, IfcStyledItem_type, IfcStyledItem_type->attributes()[0])); + IfcRepresentationItem_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("MapUsage", entity::inverse_attribute::set_type, 0, -1, IfcMappedItem_type, IfcMappedItem_type->attributes()[0])); + IfcRepresentationMap_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ResourceOf", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToResource_type, IfcRelAssignsToResource_type->attributes()[0])); + IfcResource_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ScheduleTimeControlAssigned", entity::inverse_attribute::unspecified_type, -1, -1, IfcRelAssignsTasks_type, IfcRelAssignsTasks_type->attributes()[0])); + IfcScheduleTimeControl_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("OfShapeAspect", entity::inverse_attribute::set_type, 0, 1, IfcShapeAspect_type, IfcShapeAspect_type->attributes()[0])); + IfcShapeModel_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasCoverings", entity::inverse_attribute::set_type, 0, -1, IfcRelCoversSpaces_type, IfcRelCoversSpaces_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("BoundedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelSpaceBoundary_type, IfcRelSpaceBoundary_type->attributes()[0])); + IfcSpace_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasInteractionReqsFrom", entity::inverse_attribute::set_type, 0, -1, IfcRelInteractionRequirements_type, IfcRelInteractionRequirements_type->attributes()[3])); + attributes.push_back(new entity::inverse_attribute("HasInteractionReqsTo", entity::inverse_attribute::set_type, 0, -1, IfcRelInteractionRequirements_type, IfcRelInteractionRequirements_type->attributes()[4])); + IfcSpaceProgram_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("ReferencesElements", entity::inverse_attribute::set_type, 0, -1, IfcRelReferencedInSpatialStructure_type, IfcRelReferencedInSpatialStructure_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ServicedBySystems", entity::inverse_attribute::set_type, 0, -1, IfcRelServicesBuildings_type, IfcRelServicesBuildings_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ContainsElements", entity::inverse_attribute::set_type, 0, -1, IfcRelContainedInSpatialStructure_type, IfcRelContainedInSpatialStructure_type->attributes()[1])); + IfcSpatialStructureElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("AssignedToStructuralItem", entity::inverse_attribute::unspecified_type, -1, -1, IfcRelConnectsStructuralActivity_type, IfcRelConnectsStructuralActivity_type->attributes()[1])); + IfcStructuralActivity_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ConnectsStructuralMembers", entity::inverse_attribute::set_type, 1, -1, IfcRelConnectsStructuralMember_type, IfcRelConnectsStructuralMember_type->attributes()[1])); + IfcStructuralConnection_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("AssignedStructuralActivity", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsStructuralActivity_type, IfcRelConnectsStructuralActivity_type->attributes()[0])); + IfcStructuralItem_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("SourceOfResultGroup", entity::inverse_attribute::set_type, 0, 1, IfcStructuralResultGroup_type, IfcStructuralResultGroup_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("LoadGroupFor", entity::inverse_attribute::set_type, 0, -1, IfcStructuralAnalysisModel_type, IfcStructuralAnalysisModel_type->attributes()[2])); + IfcStructuralLoadGroup_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("ReferencesElement", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsStructuralElement_type, IfcRelConnectsStructuralElement_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ConnectedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsStructuralMember_type, IfcRelConnectsStructuralMember_type->attributes()[0])); + IfcStructuralMember_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("Causes", entity::inverse_attribute::set_type, 0, -1, IfcStructuralAction_type, IfcStructuralAction_type->attributes()[1])); + IfcStructuralReaction_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ResultGroupFor", entity::inverse_attribute::set_type, 0, 1, IfcStructuralAnalysisModel_type, IfcStructuralAnalysisModel_type->attributes()[3])); + IfcStructuralResultGroup_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ServicesBuildings", entity::inverse_attribute::set_type, 0, 1, IfcRelServicesBuildings_type, IfcRelServicesBuildings_type->attributes()[0])); + IfcSystem_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("OfTable", entity::inverse_attribute::unspecified_type, -1, -1, IfcTable_type, IfcTable_type->attributes()[1])); + IfcTableRow_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("AnnotatedSurface", entity::inverse_attribute::set_type, 1, 1, IfcAnnotationSurface_type, IfcAnnotationSurface_type->attributes()[1])); + IfcTextureCoordinate_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("DocumentedBy", entity::inverse_attribute::set_type, 0, 1, IfcTimeSeriesReferenceRelationship_type, IfcTimeSeriesReferenceRelationship_type->attributes()[0])); + IfcTimeSeries_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ObjectTypeOf", entity::inverse_attribute::set_type, 0, 1, IfcRelDefinesByType_type, IfcRelDefinesByType_type->attributes()[0])); + IfcTypeObject_type->set_inverse_attributes(attributes); + } std::vector declarations; declarations.reserve(980); declarations.push_back(IfcAbsorbedDoseMeasure_type); @@ -10384,10 +10749,11 @@ schema_definition* populate_schema() { #pragma optimize("", on) #endif +namespace IFC2X3 { const schema_definition& get_schema() { static const schema_definition* s = populate_schema(); return *s; } +} -#endif diff --git a/src/ifcparse/Ifc2x3.h b/src/ifcparse/Ifc2x3.h index 2d1394da8f..2d7c8f4dae 100644 --- a/src/ifcparse/Ifc2x3.h +++ b/src/ifcparse/Ifc2x3.h @@ -42,12 +42,12 @@ #include "../ifcparse/Ifc2x3enum.h" -const IfcParse::schema_definition& get_schema(); - #define IfcSchema Ifc2x3 namespace Ifc2x3 { +const IfcParse::schema_definition& get_schema(); + const char* const Identifier = "IFC2X3"; // Forward definitions diff --git a/src/ifcparse/Ifc4-schema.cpp b/src/ifcparse/Ifc4-schema.cpp index 15968b365a..723b9303e7 100644 --- a/src/ifcparse/Ifc4-schema.cpp +++ b/src/ifcparse/Ifc4-schema.cpp @@ -24,8 +24,6 @@ * * ********************************************************************************/ -#ifdef USE_IFC4 - #include "../ifcparse/IfcSchema.h" using namespace IfcParse; @@ -11145,6 +11143,482 @@ schema_definition* populate_schema() { derived.push_back(false); derived.push_back(false); derived.push_back(false); derived.push_back(false); derived.push_back(false); derived.push_back(false); IfcZone_type->set_attributes(attributes, derived); } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("IsActingUpon", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToActor_type, IfcRelAssignsToActor_type->attributes()[0])); + IfcActor_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasExternalReference", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + IfcActorRole_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("OfPerson", entity::inverse_attribute::set_type, 0, -1, IfcPerson_type, IfcPerson_type->attributes()[7])); + attributes.push_back(new entity::inverse_attribute("OfOrganization", entity::inverse_attribute::set_type, 0, -1, IfcOrganization_type, IfcOrganization_type->attributes()[4])); + IfcAddress_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ContainedInStructure", entity::inverse_attribute::set_type, 0, 1, IfcRelContainedInSpatialStructure_type, IfcRelContainedInSpatialStructure_type->attributes()[0])); + IfcAnnotation_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasExternalReference", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + IfcAppliedValue_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(5); + attributes.push_back(new entity::inverse_attribute("HasExternalReferences", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ApprovedObjects", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociatesApproval_type, IfcRelAssociatesApproval_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("ApprovedResources", entity::inverse_attribute::set_type, 0, -1, IfcResourceApprovalRelationship_type, IfcResourceApprovalRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsRelatedWith", entity::inverse_attribute::set_type, 0, -1, IfcApprovalRelationship_type, IfcApprovalRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("Relates", entity::inverse_attribute::set_type, 0, -1, IfcApprovalRelationship_type, IfcApprovalRelationship_type->attributes()[0])); + IfcApproval_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("ClassificationForObjects", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociatesClassification_type, IfcRelAssociatesClassification_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasReferences", entity::inverse_attribute::set_type, 0, -1, IfcClassificationReference_type, IfcClassificationReference_type->attributes()[0])); + IfcClassification_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("ClassificationRefForObjects", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociatesClassification_type, IfcRelAssociatesClassification_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasReferences", entity::inverse_attribute::set_type, 0, -1, IfcClassificationReference_type, IfcClassificationReference_type->attributes()[0])); + IfcClassificationReference_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("UsingCurves", entity::inverse_attribute::set_type, 1, -1, IfcCompositeCurve_type, IfcCompositeCurve_type->attributes()[0])); + IfcCompositeCurveSegment_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasExternalReferences", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("PropertiesForConstraint", entity::inverse_attribute::set_type, 0, -1, IfcResourceConstraintRelationship_type, IfcResourceConstraintRelationship_type->attributes()[0])); + IfcConstraint_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("IsDefinedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelDefinesByProperties_type, IfcRelDefinesByProperties_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("Declares", entity::inverse_attribute::set_type, 0, -1, IfcRelDeclares_type, IfcRelDeclares_type->attributes()[0])); + IfcContext_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasExternalReference", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + IfcContextDependentUnit_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("Controls", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToControl_type, IfcRelAssignsToControl_type->attributes()[0])); + IfcControl_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasExternalReference", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + IfcConversionBasedUnit_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasCoordinateOperation", entity::inverse_attribute::set_type, 0, 1, IfcCoordinateOperation_type, IfcCoordinateOperation_type->attributes()[0])); + IfcCoordinateReferenceSystem_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("CoversSpaces", entity::inverse_attribute::set_type, 0, 1, IfcRelCoversSpaces_type, IfcRelCoversSpaces_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("CoversElements", entity::inverse_attribute::set_type, 0, 1, IfcRelCoversBldgElements_type, IfcRelCoversBldgElements_type->attributes()[1])); + IfcCovering_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("AssignedToFlowElement", entity::inverse_attribute::set_type, 0, 1, IfcRelFlowControlElements_type, IfcRelFlowControlElements_type->attributes()[0])); + IfcDistributionControlElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasPorts", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsPortToElement_type, IfcRelConnectsPortToElement_type->attributes()[1])); + IfcDistributionElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasControlElements", entity::inverse_attribute::set_type, 0, 1, IfcRelFlowControlElements_type, IfcRelFlowControlElements_type->attributes()[1])); + IfcDistributionFlowElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(4); + attributes.push_back(new entity::inverse_attribute("DocumentInfoForObjects", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociatesDocument_type, IfcRelAssociatesDocument_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasDocumentReferences", entity::inverse_attribute::set_type, 0, -1, IfcDocumentReference_type, IfcDocumentReference_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsPointedTo", entity::inverse_attribute::set_type, 0, -1, IfcDocumentInformationRelationship_type, IfcDocumentInformationRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsPointer", entity::inverse_attribute::set_type, 0, 1, IfcDocumentInformationRelationship_type, IfcDocumentInformationRelationship_type->attributes()[0])); + IfcDocumentInformation_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("DocumentRefForObjects", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociatesDocument_type, IfcRelAssociatesDocument_type->attributes()[0])); + IfcDocumentReference_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(12); + attributes.push_back(new entity::inverse_attribute("FillsVoids", entity::inverse_attribute::set_type, 0, 1, IfcRelFillsElement_type, IfcRelFillsElement_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ConnectedTo", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsElements_type, IfcRelConnectsElements_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsInterferedByElements", entity::inverse_attribute::set_type, 0, -1, IfcRelInterferesElements_type, IfcRelInterferesElements_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("InterferesElements", entity::inverse_attribute::set_type, 0, -1, IfcRelInterferesElements_type, IfcRelInterferesElements_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasProjections", entity::inverse_attribute::set_type, 0, -1, IfcRelProjectsElement_type, IfcRelProjectsElement_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("ReferencedInStructures", entity::inverse_attribute::set_type, 0, -1, IfcRelReferencedInSpatialStructure_type, IfcRelReferencedInSpatialStructure_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasOpenings", entity::inverse_attribute::set_type, 0, -1, IfcRelVoidsElement_type, IfcRelVoidsElement_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("IsConnectionRealization", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsWithRealizingElements_type, IfcRelConnectsWithRealizingElements_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("ProvidesBoundaries", entity::inverse_attribute::set_type, 0, -1, IfcRelSpaceBoundary_type, IfcRelSpaceBoundary_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ConnectedFrom", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsElements_type, IfcRelConnectsElements_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("ContainedInStructure", entity::inverse_attribute::set_type, 0, 1, IfcRelContainedInSpatialStructure_type, IfcRelContainedInSpatialStructure_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasCoverings", entity::inverse_attribute::set_type, 0, -1, IfcRelCoversBldgElements_type, IfcRelCoversBldgElements_type->attributes()[0])); + IfcElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ExternalReferenceForResources", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[0])); + IfcExternalReference_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("BoundedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelSpaceBoundary_type, IfcRelSpaceBoundary_type->attributes()[0])); + IfcExternalSpatialElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasTextureMaps", entity::inverse_attribute::set_type, 0, -1, IfcTextureMap_type, IfcTextureMap_type->attributes()[1])); + IfcFace_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ProjectsElements", entity::inverse_attribute::unspecified_type, -1, -1, IfcRelProjectsElement_type, IfcRelProjectsElement_type->attributes()[1])); + IfcFeatureElementAddition_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("VoidsElements", entity::inverse_attribute::unspecified_type, -1, -1, IfcRelVoidsElement_type, IfcRelVoidsElement_type->attributes()[1])); + IfcFeatureElementSubtraction_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasSubContexts", entity::inverse_attribute::set_type, 0, -1, IfcGeometricRepresentationSubContext_type, IfcGeometricRepresentationSubContext_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasCoordinateOperation", entity::inverse_attribute::set_type, 0, 1, IfcCoordinateOperation_type, IfcCoordinateOperation_type->attributes()[0])); + IfcGeometricRepresentationContext_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ContainedInStructure", entity::inverse_attribute::set_type, 0, 1, IfcRelContainedInSpatialStructure_type, IfcRelContainedInSpatialStructure_type->attributes()[0])); + IfcGrid_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(4); + attributes.push_back(new entity::inverse_attribute("PartOfW", entity::inverse_attribute::set_type, 0, 1, IfcGrid_type, IfcGrid_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("PartOfV", entity::inverse_attribute::set_type, 0, 1, IfcGrid_type, IfcGrid_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("PartOfU", entity::inverse_attribute::set_type, 0, 1, IfcGrid_type, IfcGrid_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasIntersections", entity::inverse_attribute::set_type, 0, -1, IfcVirtualGridIntersection_type, IfcVirtualGridIntersection_type->attributes()[0])); + IfcGridAxis_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("IsGroupedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToGroup_type, IfcRelAssignsToGroup_type->attributes()[0])); + IfcGroup_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("LibraryInfoForObjects", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociatesLibrary_type, IfcRelAssociatesLibrary_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasLibraryReferences", entity::inverse_attribute::set_type, 0, -1, IfcLibraryReference_type, IfcLibraryReference_type->attributes()[2])); + IfcLibraryInformation_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("LibraryRefForObjects", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociatesLibrary_type, IfcRelAssociatesLibrary_type->attributes()[0])); + IfcLibraryReference_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("HasRepresentation", entity::inverse_attribute::set_type, 0, 1, IfcMaterialDefinitionRepresentation_type, IfcMaterialDefinitionRepresentation_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("IsRelatedWith", entity::inverse_attribute::set_type, 0, -1, IfcMaterialRelationship_type, IfcMaterialRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("RelatesTo", entity::inverse_attribute::set_type, 0, 1, IfcMaterialRelationship_type, IfcMaterialRelationship_type->attributes()[0])); + IfcMaterial_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ToMaterialConstituentSet", entity::inverse_attribute::unspecified_type, -1, -1, IfcMaterialConstituentSet_type, IfcMaterialConstituentSet_type->attributes()[2])); + IfcMaterialConstituent_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("AssociatedTo", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociatesMaterial_type, IfcRelAssociatesMaterial_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasExternalReferences", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasProperties", entity::inverse_attribute::set_type, 0, -1, IfcMaterialProperties_type, IfcMaterialProperties_type->attributes()[0])); + IfcMaterialDefinition_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ToMaterialLayerSet", entity::inverse_attribute::unspecified_type, -1, -1, IfcMaterialLayerSet_type, IfcMaterialLayerSet_type->attributes()[0])); + IfcMaterialLayer_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ToMaterialProfileSet", entity::inverse_attribute::unspecified_type, -1, -1, IfcMaterialProfileSet_type, IfcMaterialProfileSet_type->attributes()[2])); + IfcMaterialProfile_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("AssociatedTo", entity::inverse_attribute::set_type, 1, -1, IfcRelAssociatesMaterial_type, IfcRelAssociatesMaterial_type->attributes()[0])); + IfcMaterialUsageDefinition_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(4); + attributes.push_back(new entity::inverse_attribute("IsDeclaredBy", entity::inverse_attribute::set_type, 0, 1, IfcRelDefinesByObject_type, IfcRelDefinesByObject_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("Declares", entity::inverse_attribute::set_type, 0, -1, IfcRelDefinesByObject_type, IfcRelDefinesByObject_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsTypedBy", entity::inverse_attribute::set_type, 0, 1, IfcRelDefinesByType_type, IfcRelDefinesByType_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("IsDefinedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelDefinesByProperties_type, IfcRelDefinesByProperties_type->attributes()[0])); + IfcObject_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(7); + attributes.push_back(new entity::inverse_attribute("HasAssignments", entity::inverse_attribute::set_type, 0, -1, IfcRelAssigns_type, IfcRelAssigns_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("Nests", entity::inverse_attribute::set_type, 0, 1, IfcRelNests_type, IfcRelNests_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsNestedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelNests_type, IfcRelNests_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasContext", entity::inverse_attribute::set_type, 0, 1, IfcRelDeclares_type, IfcRelDeclares_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsDecomposedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelAggregates_type, IfcRelAggregates_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("Decomposes", entity::inverse_attribute::set_type, 0, 1, IfcRelAggregates_type, IfcRelAggregates_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasAssociations", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociates_type, IfcRelAssociates_type->attributes()[0])); + IfcObjectDefinition_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("PlacesObject", entity::inverse_attribute::set_type, 0, -1, IfcProduct_type, IfcProduct_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("ReferencedByPlacements", entity::inverse_attribute::set_type, 0, -1, IfcLocalPlacement_type, IfcLocalPlacement_type->attributes()[0])); + IfcObjectPlacement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasFillings", entity::inverse_attribute::set_type, 0, -1, IfcRelFillsElement_type, IfcRelFillsElement_type->attributes()[0])); + IfcOpeningElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("IsRelatedBy", entity::inverse_attribute::set_type, 0, -1, IfcOrganizationRelationship_type, IfcOrganizationRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("Relates", entity::inverse_attribute::set_type, 0, -1, IfcOrganizationRelationship_type, IfcOrganizationRelationship_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("Engages", entity::inverse_attribute::set_type, 0, -1, IfcPersonAndOrganization_type, IfcPersonAndOrganization_type->attributes()[1])); + IfcOrganization_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("EngagedIn", entity::inverse_attribute::set_type, 0, -1, IfcPersonAndOrganization_type, IfcPersonAndOrganization_type->attributes()[0])); + IfcPerson_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasExternalReferences", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("PartOfComplex", entity::inverse_attribute::set_type, 0, 1, IfcPhysicalComplexQuantity_type, IfcPhysicalComplexQuantity_type->attributes()[0])); + IfcPhysicalQuantity_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("ContainedIn", entity::inverse_attribute::set_type, 0, 1, IfcRelConnectsPortToElement_type, IfcRelConnectsPortToElement_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("ConnectedFrom", entity::inverse_attribute::set_type, 0, 1, IfcRelConnectsPorts_type, IfcRelConnectsPorts_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ConnectedTo", entity::inverse_attribute::set_type, 0, 1, IfcRelConnectsPorts_type, IfcRelConnectsPorts_type->attributes()[0])); + IfcPort_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("IsPredecessorTo", entity::inverse_attribute::set_type, 0, -1, IfcRelSequence_type, IfcRelSequence_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("IsSuccessorFrom", entity::inverse_attribute::set_type, 0, -1, IfcRelSequence_type, IfcRelSequence_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("OperatesOn", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToProcess_type, IfcRelAssignsToProcess_type->attributes()[0])); + IfcProcess_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ReferencedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToProduct_type, IfcRelAssignsToProduct_type->attributes()[0])); + IfcProduct_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("ShapeOfProduct", entity::inverse_attribute::set_type, 1, -1, IfcProduct_type, IfcProduct_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasShapeAspects", entity::inverse_attribute::set_type, 0, -1, IfcShapeAspect_type, IfcShapeAspect_type->attributes()[4])); + IfcProductDefinitionShape_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasExternalReference", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasProperties", entity::inverse_attribute::set_type, 0, -1, IfcProfileProperties_type, IfcProfileProperties_type->attributes()[0])); + IfcProfileDef_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(6); + attributes.push_back(new entity::inverse_attribute("PartOfPset", entity::inverse_attribute::set_type, 0, -1, IfcPropertySet_type, IfcPropertySet_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("PropertyForDependance", entity::inverse_attribute::set_type, 0, -1, IfcPropertyDependencyRelationship_type, IfcPropertyDependencyRelationship_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("PropertyDependsOn", entity::inverse_attribute::set_type, 0, -1, IfcPropertyDependencyRelationship_type, IfcPropertyDependencyRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("PartOfComplex", entity::inverse_attribute::set_type, 0, -1, IfcComplexProperty_type, IfcComplexProperty_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasConstraints", entity::inverse_attribute::set_type, 0, -1, IfcResourceConstraintRelationship_type, IfcResourceConstraintRelationship_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasApprovals", entity::inverse_attribute::set_type, 0, -1, IfcResourceApprovalRelationship_type, IfcResourceApprovalRelationship_type->attributes()[0])); + IfcProperty_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasExternalReferences", entity::inverse_attribute::set_type, 0, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + IfcPropertyAbstraction_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasContext", entity::inverse_attribute::set_type, 0, 1, IfcRelDeclares_type, IfcRelDeclares_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("HasAssociations", entity::inverse_attribute::set_type, 0, -1, IfcRelAssociates_type, IfcRelAssociates_type->attributes()[0])); + IfcPropertyDefinition_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("DefinesType", entity::inverse_attribute::set_type, 0, -1, IfcTypeObject_type, IfcTypeObject_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("IsDefinedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelDefinesByTemplate_type, IfcRelDefinesByTemplate_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("DefinesOccurrence", entity::inverse_attribute::set_type, 0, -1, IfcRelDefinesByProperties_type, IfcRelDefinesByProperties_type->attributes()[1])); + IfcPropertySetDefinition_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("Defines", entity::inverse_attribute::set_type, 0, -1, IfcRelDefinesByTemplate_type, IfcRelDefinesByTemplate_type->attributes()[1])); + IfcPropertySetTemplate_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("PartOfComplexTemplate", entity::inverse_attribute::set_type, 0, -1, IfcComplexPropertyTemplate_type, IfcComplexPropertyTemplate_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("PartOfPsetTemplate", entity::inverse_attribute::set_type, 0, -1, IfcPropertySetTemplate_type, IfcPropertySetTemplate_type->attributes()[2])); + IfcPropertyTemplate_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("InnerBoundaries", entity::inverse_attribute::set_type, 0, -1, IfcRelSpaceBoundary1stLevel_type, IfcRelSpaceBoundary1stLevel_type->attributes()[0])); + IfcRelSpaceBoundary1stLevel_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("Corresponds", entity::inverse_attribute::set_type, 0, 1, IfcRelSpaceBoundary2ndLevel_type, IfcRelSpaceBoundary2ndLevel_type->attributes()[0])); + IfcRelSpaceBoundary2ndLevel_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("RepresentationMap", entity::inverse_attribute::set_type, 0, 1, IfcRepresentationMap_type, IfcRepresentationMap_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("LayerAssignments", entity::inverse_attribute::set_type, 0, -1, IfcPresentationLayerAssignment_type, IfcPresentationLayerAssignment_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("OfProductRepresentation", entity::inverse_attribute::set_type, 0, -1, IfcProductRepresentation_type, IfcProductRepresentation_type->attributes()[2])); + IfcRepresentation_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("RepresentationsInContext", entity::inverse_attribute::set_type, 0, -1, IfcRepresentation_type, IfcRepresentation_type->attributes()[0])); + IfcRepresentationContext_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("LayerAssignment", entity::inverse_attribute::set_type, 0, 1, IfcPresentationLayerAssignment_type, IfcPresentationLayerAssignment_type->attributes()[2])); + attributes.push_back(new entity::inverse_attribute("StyledByItem", entity::inverse_attribute::set_type, 0, 1, IfcStyledItem_type, IfcStyledItem_type->attributes()[0])); + IfcRepresentationItem_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasShapeAspects", entity::inverse_attribute::set_type, 0, -1, IfcShapeAspect_type, IfcShapeAspect_type->attributes()[4])); + attributes.push_back(new entity::inverse_attribute("MapUsage", entity::inverse_attribute::set_type, 0, -1, IfcMappedItem_type, IfcMappedItem_type->attributes()[0])); + IfcRepresentationMap_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ResourceOf", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToResource_type, IfcRelAssignsToResource_type->attributes()[0])); + IfcResource_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("OfShapeAspect", entity::inverse_attribute::set_type, 0, 1, IfcShapeAspect_type, IfcShapeAspect_type->attributes()[0])); + IfcShapeModel_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasCoverings", entity::inverse_attribute::set_type, 0, -1, IfcRelCoversSpaces_type, IfcRelCoversSpaces_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("BoundedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelSpaceBoundary_type, IfcRelSpaceBoundary_type->attributes()[0])); + IfcSpace_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(3); + attributes.push_back(new entity::inverse_attribute("ContainsElements", entity::inverse_attribute::set_type, 0, -1, IfcRelContainedInSpatialStructure_type, IfcRelContainedInSpatialStructure_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ServicedBySystems", entity::inverse_attribute::set_type, 0, -1, IfcRelServicesBuildings_type, IfcRelServicesBuildings_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("ReferencesElements", entity::inverse_attribute::set_type, 0, -1, IfcRelReferencedInSpatialStructure_type, IfcRelReferencedInSpatialStructure_type->attributes()[1])); + IfcSpatialElement_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("AssignedToStructuralItem", entity::inverse_attribute::set_type, 0, 1, IfcRelConnectsStructuralActivity_type, IfcRelConnectsStructuralActivity_type->attributes()[1])); + IfcStructuralActivity_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ConnectsStructuralMembers", entity::inverse_attribute::set_type, 1, -1, IfcRelConnectsStructuralMember_type, IfcRelConnectsStructuralMember_type->attributes()[1])); + IfcStructuralConnection_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("AssignedStructuralActivity", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsStructuralActivity_type, IfcRelConnectsStructuralActivity_type->attributes()[0])); + IfcStructuralItem_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("SourceOfResultGroup", entity::inverse_attribute::set_type, 0, 1, IfcStructuralResultGroup_type, IfcStructuralResultGroup_type->attributes()[1])); + attributes.push_back(new entity::inverse_attribute("LoadGroupFor", entity::inverse_attribute::set_type, 0, -1, IfcStructuralAnalysisModel_type, IfcStructuralAnalysisModel_type->attributes()[2])); + IfcStructuralLoadGroup_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ConnectedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelConnectsStructuralMember_type, IfcRelConnectsStructuralMember_type->attributes()[0])); + IfcStructuralMember_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ResultGroupFor", entity::inverse_attribute::set_type, 0, 1, IfcStructuralAnalysisModel_type, IfcStructuralAnalysisModel_type->attributes()[3])); + IfcStructuralResultGroup_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("IsMappedBy", entity::inverse_attribute::set_type, 0, -1, IfcTextureCoordinate_type, IfcTextureCoordinate_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("UsedInStyles", entity::inverse_attribute::set_type, 0, -1, IfcSurfaceStyleWithTextures_type, IfcSurfaceStyleWithTextures_type->attributes()[0])); + IfcSurfaceTexture_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ServicesBuildings", entity::inverse_attribute::set_type, 0, 1, IfcRelServicesBuildings_type, IfcRelServicesBuildings_type->attributes()[0])); + IfcSystem_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(2); + attributes.push_back(new entity::inverse_attribute("HasColours", entity::inverse_attribute::set_type, 0, 1, IfcIndexedColourMap_type, IfcIndexedColourMap_type->attributes()[0])); + attributes.push_back(new entity::inverse_attribute("HasTextures", entity::inverse_attribute::set_type, 0, -1, IfcIndexedTextureMap_type, IfcIndexedTextureMap_type->attributes()[0])); + IfcTessellatedFaceSet_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("HasExternalReference", entity::inverse_attribute::set_type, 1, -1, IfcExternalReferenceRelationship_type, IfcExternalReferenceRelationship_type->attributes()[1])); + IfcTimeSeries_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("Types", entity::inverse_attribute::set_type, 0, 1, IfcRelDefinesByType_type, IfcRelDefinesByType_type->attributes()[1])); + IfcTypeObject_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("OperatesOn", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToProcess_type, IfcRelAssignsToProcess_type->attributes()[0])); + IfcTypeProcess_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ReferencedBy", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToProduct_type, IfcRelAssignsToProduct_type->attributes()[0])); + IfcTypeProduct_type->set_inverse_attributes(attributes); + } + { + std::vector attributes; attributes.reserve(1); + attributes.push_back(new entity::inverse_attribute("ResourceOf", entity::inverse_attribute::set_type, 0, -1, IfcRelAssignsToResource_type, IfcRelAssignsToResource_type->attributes()[0])); + IfcTypeResource_type->set_inverse_attributes(attributes); + } std::vector declarations; declarations.reserve(1165); declarations.push_back(IfcAbsorbedDoseMeasure_type); @@ -12320,10 +12794,11 @@ schema_definition* populate_schema() { #pragma optimize("", on) #endif +namespace IFC4 { const schema_definition& get_schema() { static const schema_definition* s = populate_schema(); return *s; } +} -#endif diff --git a/src/ifcparse/Ifc4.h b/src/ifcparse/Ifc4.h index 2bf935a88d..6011f09900 100644 --- a/src/ifcparse/Ifc4.h +++ b/src/ifcparse/Ifc4.h @@ -42,12 +42,12 @@ #include "../ifcparse/Ifc4enum.h" -const IfcParse::schema_definition& get_schema(); - #define IfcSchema Ifc4 namespace Ifc4 { +const IfcParse::schema_definition& get_schema(); + const char* const Identifier = "IFC4"; // Forward definitions diff --git a/src/ifcparse/IfcEntityInstanceData.h b/src/ifcparse/IfcEntityInstanceData.h index a4855545dc..decd4ad0ff 100644 --- a/src/ifcparse/IfcEntityInstanceData.h +++ b/src/ifcparse/IfcEntityInstanceData.h @@ -38,7 +38,7 @@ public: IfcParse::IfcFile* file; protected: unsigned id_; - IfcSchema::Type::Enum type_; + const IfcParse::declaration* type_; mutable std::vector attributes_; // To reduce memory footprint, these two could potentially be combined, @@ -49,11 +49,11 @@ protected: unsigned offset_in_file_; public: - IfcEntityInstanceData(IfcSchema::Type::Enum type, IfcParse::IfcFile* file_, unsigned id = 0, unsigned offset_in_file = 0) + IfcEntityInstanceData(const IfcParse::declaration* type, IfcParse::IfcFile* file_, unsigned id = 0, unsigned offset_in_file = 0) : file(file_), id_(id), type_(type), initialized_(false), offset_in_file_(offset_in_file) {} - IfcEntityInstanceData(IfcSchema::Type::Enum type) + IfcEntityInstanceData(const IfcParse::declaration* type) : file(0), id_(0), type_(type), initialized_(true) {} @@ -89,7 +89,7 @@ public: return (unsigned int)attributes_.size(); } - IfcSchema::Type::Enum type() const { + const IfcParse::declaration* type() const { return type_; } diff --git a/src/ifcparse/IfcFile.h b/src/ifcparse/IfcFile.h index 115877e18f..7aa509044e 100644 --- a/src/ifcparse/IfcFile.h +++ b/src/ifcparse/IfcFile.h @@ -27,6 +27,7 @@ #include "../ifcparse/IfcParse.h" #include "../ifcparse/IfcSpfHeader.h" +#include "../ifcparse/IfcSchema.h" namespace IfcParse { @@ -64,7 +65,7 @@ public: private: typedef std::map entity_entity_map_t; - bool parsing_complete_; + bool parsing_complete_, good_; const IfcParse::schema_definition* schema_; @@ -81,12 +82,25 @@ private: void setDefaultHeaderValues(); + void initialize_(IfcParse::IfcSpfStream* f); + public: IfcParse::IfcSpfLexer* tokens; IfcParse::IfcSpfStream* stream; - IfcFile(); +#ifdef USE_MMAP + IfcFile(const std::string& fn, bool mmap = false); +#else + IfcFile(const std::string& fn); +#endif + IfcFile(std::istream& fn, int len); + IfcFile(void* data, int len); + IfcFile(IfcParse::IfcSpfStream* f); + IfcFile(const IfcParse::schema_definition* schema = IfcParse::schema_by_name(IfcSchema::Identifier)); + ~IfcFile(); + + bool good() const { return good_; } /// Returns the first entity in the file, this probably is the entity /// with the lowest id (EXPRESS ENTITY_INSTANCE_NAME) @@ -141,15 +155,6 @@ public: /// in the first function argument. IfcEntityList::ptr traverse(IfcUtil::IfcBaseClass* instance, int max_level=-1); -#ifdef USE_MMAP - bool Init(const std::string& fn, bool mmap=false); -#else - bool Init(const std::string& fn); -#endif - bool Init(std::istream& fn, int len); - bool Init(void* data, int len); - bool Init(IfcParse::IfcSpfStream* f); - IfcEntityList::ptr getInverse(int instance_id, IfcSchema::Type::Enum type, int attribute_index); unsigned int FreshId() { return ++MaxId; } diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index b39873d0cf..b08239aa8b 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -935,15 +935,6 @@ IfcEntityList::ptr IfcEntityInstanceData::getInverse(IfcSchema::Type::Enum type, return file->getInverse(id_, type, attribute_index); } -IfcFile::IfcFile() - : parsing_complete_(false) - , MaxId(0) - , tokens(0) - , stream(0) -{ - setDefaultHeaderValues(); -} - void IfcEntityInstanceData::load() const { file->load(*this); initialized_ = true; @@ -1125,7 +1116,7 @@ void IfcEntityInstanceData::setArgument(unsigned int i, Argument* a, IfcUtil::Ar // Remove leading and trailing '.' enum_literal = enum_literal.substr(1, enum_literal.size() - 2); - const IfcParse::enumeration_type* enum_type = get_schema().declaration_by_name(type())->as_entity()-> + const IfcParse::enumeration_type* enum_type = file->schema()->declaration_by_name(type())->as_entity()-> attribute_by_index(i)->type_of_attribute()->as_named_type()->declared_type()->as_enumeration_type(); std::vector::const_iterator it = std::find( @@ -1172,7 +1163,7 @@ void IfcEntityInstanceData::setArgument(unsigned int i, Argument* a, IfcUtil::Ar break; } case IfcUtil::Argument_EMPTY_AGGREGATE: case IfcUtil::Argument_AGGREGATE_OF_EMPTY_AGGREGATE: { - IfcUtil::ArgumentType t2 = IfcUtil::from_parameter_type(get_schema().declaration_by_name(type())->as_entity()->all_attributes()[i]->type_of_attribute()); + IfcUtil::ArgumentType t2 = IfcUtil::from_parameter_type(file->schema()->declaration_by_name(type())->as_entity()->all_attributes()[i]->type_of_attribute()); delete copy; copy = 0; setArgument(i, a, t2); @@ -1214,33 +1205,59 @@ void IfcEntityInstanceData::setArgument(unsigned int i, Argument* a, IfcUtil::Ar // Creates the maps // #ifdef USE_MMAP -bool IfcFile::Init(const std::string& fn, bool mmap) { +IfcFile::IfcFile(const std::string& fn, bool mmap) { return IfcFile::Init(new IfcSpfStream(fn, mmap)); } #else -bool IfcFile::Init(const std::string& fn) { - return IfcFile::Init(new IfcSpfStream(fn)); +IfcFile::IfcFile(const std::string& fn) { + initialize_(new IfcSpfStream(fn)); } #endif -bool IfcFile::Init(std::istream& f, int len) { - return IfcFile::Init(new IfcSpfStream(f,len)); +IfcFile::IfcFile(std::istream& f, int len) { + initialize_(new IfcSpfStream(f, len)); } -bool IfcFile::Init(void* data, int len) { - return IfcFile::Init(new IfcSpfStream(data,len)); +IfcFile::IfcFile(void* data, int len) { + initialize_(new IfcSpfStream(data, len)); } -bool IfcFile::Init(IfcParse::IfcSpfStream* s) { +IfcFile::IfcFile(IfcParse::IfcSpfStream* s) { + initialize_(s); +} + +IfcFile::IfcFile(const IfcParse::schema_definition* schema) + : schema_(schema) + , good_(false) + , parsing_complete_(false) + , MaxId(0) + , tokens(0) + , stream(0) +{ + setDefaultHeaderValues(); +} + +void IfcFile::initialize_(IfcParse::IfcSpfStream* s) { // Initialize a "C" locale for locale-independent // number parsing. See comment above on line 41. init_locale(); + good_ = false; + + parsing_complete_ = false; + MaxId = 0; + tokens = 0; + stream = 0; + + setDefaultHeaderValues(); + stream = s; if (!stream->valid) { - return false; + return; } + good_ = true; + tokens = new IfcSpfLexer(stream, this); _header.file(this); _header.tryRead(); @@ -1252,8 +1269,19 @@ bool IfcFile::Init(IfcParse::IfcSpfStream* s) { // Purposely empty catch block } - if (schemas.size() != 1 || schemas[0] != IfcSchema::Identifier) { - Logger::Message(Logger::LOG_ERROR, std::string("File schema encountered different from expected '") + IfcSchema::Identifier + "'"); + schema_ = 0; + + if (schemas.size() == 1) { + try { + schema_ = IfcParse::schema_by_name(schemas.front()); + } catch (const IfcParse::IfcException& e) { + Logger::Error(e); + } + } + + if (schema_ == 0) { + schema_ = IfcParse::schema_by_name(IfcSchema::Identifier); + Logger::Message(Logger::LOG_ERROR, "Unable to deduce schema version from header identifiers"); } boost::circular_buffer token_stream(3, Token()); @@ -1278,7 +1306,7 @@ bool IfcFile::Init(IfcParse::IfcSpfStream* s) { } catch (const IfcException& ex) { Logger::Message(Logger::LOG_ERROR, ex.what()); goto advance; - } + } data = new IfcEntityInstanceData(entity_type, this, current_id, token_stream[2].startPos); instance = IfcSchema::SchemaEntity(data); @@ -1362,7 +1390,7 @@ bool IfcFile::Init(IfcParse::IfcSpfStream* s) { parsing_complete_ = true; - return true; + return; } class traversal_visitor { diff --git a/src/ifcparse/IfcSchema.cpp b/src/ifcparse/IfcSchema.cpp index c56fe1b196..6c5cfa376a 100644 --- a/src/ifcparse/IfcSchema.cpp +++ b/src/ifcparse/IfcSchema.cpp @@ -1,5 +1,7 @@ #include "IfcSchema.h" +#include + bool IfcParse::declaration::is(const std::string& name) const { return is(IfcSchema::Type::FromString(name)); } @@ -18,4 +20,36 @@ bool IfcParse::named_type::is(const std::string& name) const { bool IfcParse::named_type::is(IfcSchema::Type::Enum name) const { return declared_type()->is(name); +} + +static std::map schemas; + +IfcParse::schema_definition::schema_definition(const std::string& name, const std::vector& declarations, const bool built_in = false) + : name_(name) + , declarations_(declarations) + , built_in_(built_in) +{ + std::sort(declarations_.begin(), declarations_.end(), declaration_by_enum_sort()); + for (std::vector::const_iterator it = declarations_.begin(); it != declarations_.end(); ++it) { + if ((**it).as_type_declaration()) type_declarations_.push_back((**it).as_type_declaration()); + if ((**it).as_select_type()) select_types_.push_back((**it).as_select_type()); + if ((**it).as_enumeration_type()) enumeration_types_.push_back((**it).as_enumeration_type()); + if ((**it).as_entity()) entities_.push_back((**it).as_entity()); + } + schemas[name_] = this; +} + +IfcParse::schema_definition::~schema_definition() { + schemas.erase(name_); + for (std::vector::const_iterator it = declarations_.begin(); it != declarations_.end(); ++it) { + delete *it; + } +} + +const IfcParse::schema_definition* schema_by_name(const std::string& name) { + std::map::const_iterator it = schemas.find(name); + if (it == schemas.end()) { + throw IfcParse::IfcException("No schema named " + name); + } + return it->second; } \ No newline at end of file diff --git a/src/ifcparse/IfcSchema.h b/src/ifcparse/IfcSchema.h index 9eb5962393..221fbbb60d 100644 --- a/src/ifcparse/IfcSchema.h +++ b/src/ifcparse/IfcSchema.h @@ -414,25 +414,9 @@ namespace IfcParse { }; public: - schema_definition(const std::string& name, const std::vector& declarations, const bool built_in = false) - : name_(name) - , declarations_(declarations) - , built_in_(built_in) - { - std::sort(declarations_.begin(), declarations_.end(), declaration_by_enum_sort()); - for (std::vector::const_iterator it = declarations_.begin(); it != declarations_.end(); ++it) { - if ((**it).as_type_declaration()) type_declarations_.push_back((**it).as_type_declaration()); - if ((**it).as_select_type()) select_types_.push_back((**it).as_select_type()); - if ((**it).as_enumeration_type()) enumeration_types_.push_back((**it).as_enumeration_type()); - if ((**it).as_entity()) entities_.push_back((**it).as_entity()); - } - } + schema_definition(const std::string& name, const std::vector& declarations, const bool built_in = false); - ~schema_definition() { - for (std::vector::const_iterator it = declarations_.begin(); it != declarations_.end(); ++it) { - delete *it; - } - } + ~schema_definition(); const declaration* declaration_by_name(const std::string& name) const { std::vector::const_iterator it = std::lower_bound(declarations_.begin(), declarations_.end(), name, declaration_by_name_cmp()); @@ -457,6 +441,7 @@ namespace IfcParse { const std::string& name() const { return name_; } }; + const schema_definition* schema_by_name(const std::string&); } #endif