From f3c26c372d5d172aeaa88dc87dbc434ef8cf25e0 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 5 Jan 2015 17:46:23 +0000 Subject: [PATCH] Parse the spf header and check schema_identifiers against compiled schema --- cmake/CMakeLists.txt | 2 + src/ifcexpressparser/templates.py | 2 + .../ifcopenshell/__init__.py | 5 +- src/ifcparse/Ifc2x3-latebound.cpp | 4 + src/ifcparse/Ifc2x3.h | 2 + src/ifcparse/Ifc4-latebound.cpp | 4 + src/ifcparse/Ifc4.h | 2 + src/ifcparse/IfcFile.h | 7 +- src/ifcparse/IfcParse.cpp | 55 +++++---- src/ifcparse/IfcParse.h | 16 +-- src/ifcparse/IfcSpfHeader.cpp | 108 ++++++++++++++++++ src/ifcparse/IfcSpfHeader.h | 96 ++++++++++++++++ src/ifcwrap/IfcParseWrapper.i | 55 +++++++++ win/IfcParse.vcproj | 8 ++ 14 files changed, 334 insertions(+), 32 deletions(-) create mode 100644 src/ifcparse/IfcSpfHeader.cpp create mode 100644 src/ifcparse/IfcSpfHeader.h diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index a7f197c4b9..ec1c1bb315 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -133,6 +133,7 @@ ADD_LIBRARY(IfcParse STATIC ../src/ifcparse/IfcHierarchyHelper.cpp ../src/ifcparse/IfcLateBoundEntity.cpp ../src/ifcparse/IfcParse.cpp + ../src/ifcparse/IfcSpfHeader.cpp ../src/ifcparse/IfcUtil.cpp ../src/ifcparse/IfcWrite.cpp ) @@ -220,6 +221,7 @@ SET(include_files_parse ../src/ifcparse/IfcHierarchyHelper.h ../src/ifcparse/IfcLateBoundEntity.h ../src/ifcparse/IfcParse.h + ../src/ifcparse/IfcSpfHeader.h ../src/ifcparse/IfcSpfStream.h ../src/ifcparse/IfcUtil.h ../src/ifcparse/IfcWritableEntity.h diff --git a/src/ifcexpressparser/templates.py b/src/ifcexpressparser/templates.py index f1920302fc..0f89f58c37 100644 --- a/src/ifcexpressparser/templates.py +++ b/src/ifcexpressparser/templates.py @@ -35,6 +35,8 @@ header = """ namespace %(schema_name)s { +const char* const Identifier = "%(schema_name_upper)s"; + // Forward definitions %(forward_definitions)s diff --git a/src/ifcopenshell-python/ifcopenshell/__init__.py b/src/ifcopenshell-python/ifcopenshell/__init__.py index df72c0d02e..d06f4ad84b 100644 --- a/src/ifcopenshell-python/ifcopenshell/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/__init__.py @@ -80,8 +80,9 @@ class file(object): self.wrapped_data.add(e.wrapped_data) self.instances.append(e) return e - def __getattr__(self,attr): + def __getattr__(self, attr): if attr[0:6] == 'create': return functools.partial(self.create_entity,attr[6:]) + else: return getattr(self.wrapped_data, attr) def __getitem__(self, key): if isinstance(key, int): return entity_instance(self.wrapped_data.by_id(key)) @@ -89,8 +90,6 @@ class file(object): return entity_instance(self.wrapped_data.by_guid(key)) def by_type(self, type): return [entity_instance(e) for e in self.wrapped_data.by_type(type)] - def write(self, fn): - self.wrapped_data.write(fn) def __iter__(self): return iter(self[id] for id in self.wrapped_data.entity_names()) diff --git a/src/ifcparse/Ifc2x3-latebound.cpp b/src/ifcparse/Ifc2x3-latebound.cpp index d3deaf4573..d9fe4626e5 100644 --- a/src/ifcparse/Ifc2x3-latebound.cpp +++ b/src/ifcparse/Ifc2x3-latebound.cpp @@ -24,6 +24,8 @@ * * ********************************************************************************/ +#ifndef USE_IFC4 + #include #include "../ifcparse/Ifc2x3.h" @@ -4253,3 +4255,5 @@ void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) { } } } + +#endif diff --git a/src/ifcparse/Ifc2x3.h b/src/ifcparse/Ifc2x3.h index 27db772898..967d9a2def 100644 --- a/src/ifcparse/Ifc2x3.h +++ b/src/ifcparse/Ifc2x3.h @@ -41,6 +41,8 @@ namespace Ifc2x3 { +const char* const Identifier = "IFC2X3"; + // Forward definitions class Ifc2DCompositeCurve; class IfcActionRequest; class IfcActor; class IfcActorRole; class IfcActuatorType; class IfcAddress; class IfcAirTerminalBoxType; class IfcAirTerminalType; class IfcAirToAirHeatRecoveryType; class IfcAlarmType; class IfcAngularDimension; class IfcAnnotation; class IfcAnnotationCurveOccurrence; class IfcAnnotationFillArea; class IfcAnnotationFillAreaOccurrence; class IfcAnnotationOccurrence; class IfcAnnotationSurface; class IfcAnnotationSurfaceOccurrence; class IfcAnnotationSymbolOccurrence; class IfcAnnotationTextOccurrence; class IfcApplication; class IfcAppliedValue; class IfcAppliedValueRelationship; class IfcApproval; class IfcApprovalActorRelationship; class IfcApprovalPropertyRelationship; class IfcApprovalRelationship; class IfcArbitraryClosedProfileDef; class IfcArbitraryOpenProfileDef; class IfcArbitraryProfileDefWithVoids; class IfcAsset; class IfcAsymmetricIShapeProfileDef; class IfcAxis1Placement; class IfcAxis2Placement2D; class IfcAxis2Placement3D; class IfcBSplineCurve; class IfcBeam; class IfcBeamType; class IfcBezierCurve; class IfcBlobTexture; class IfcBlock; class IfcBoilerType; class IfcBooleanClippingResult; class IfcBooleanResult; class IfcBoundaryCondition; class IfcBoundaryEdgeCondition; class IfcBoundaryFaceCondition; class IfcBoundaryNodeCondition; class IfcBoundaryNodeConditionWarping; class IfcBoundedCurve; class IfcBoundedSurface; class IfcBoundingBox; class IfcBoxedHalfSpace; class IfcBuilding; class IfcBuildingElement; class IfcBuildingElementComponent; class IfcBuildingElementPart; class IfcBuildingElementProxy; class IfcBuildingElementProxyType; class IfcBuildingElementType; class IfcBuildingStorey; class IfcCShapeProfileDef; class IfcCableCarrierFittingType; class IfcCableCarrierSegmentType; class IfcCableSegmentType; class IfcCalendarDate; class IfcCartesianPoint; class IfcCartesianTransformationOperator; class IfcCartesianTransformationOperator2D; class IfcCartesianTransformationOperator2DnonUniform; class IfcCartesianTransformationOperator3D; class IfcCartesianTransformationOperator3DnonUniform; class IfcCenterLineProfileDef; class IfcChamferEdgeFeature; class IfcChillerType; class IfcCircle; class IfcCircleHollowProfileDef; class IfcCircleProfileDef; class IfcClassification; class IfcClassificationItem; class IfcClassificationItemRelationship; class IfcClassificationNotation; class IfcClassificationNotationFacet; class IfcClassificationReference; class IfcClosedShell; class IfcCoilType; class IfcColourRgb; class IfcColourSpecification; class IfcColumn; class IfcColumnType; class IfcComplexProperty; class IfcCompositeCurve; class IfcCompositeCurveSegment; class IfcCompositeProfileDef; class IfcCompressorType; class IfcCondenserType; class IfcCondition; class IfcConditionCriterion; class IfcConic; class IfcConnectedFaceSet; class IfcConnectionCurveGeometry; class IfcConnectionGeometry; class IfcConnectionPointEccentricity; class IfcConnectionPointGeometry; class IfcConnectionPortGeometry; class IfcConnectionSurfaceGeometry; class IfcConstraint; class IfcConstraintAggregationRelationship; class IfcConstraintClassificationRelationship; class IfcConstraintRelationship; class IfcConstructionEquipmentResource; class IfcConstructionMaterialResource; class IfcConstructionProductResource; class IfcConstructionResource; class IfcContextDependentUnit; class IfcControl; class IfcControllerType; class IfcConversionBasedUnit; class IfcCooledBeamType; class IfcCoolingTowerType; class IfcCoordinatedUniversalTimeOffset; class IfcCostItem; class IfcCostSchedule; class IfcCostValue; class IfcCovering; class IfcCoveringType; class IfcCraneRailAShapeProfileDef; class IfcCraneRailFShapeProfileDef; class IfcCrewResource; class IfcCsgPrimitive3D; class IfcCsgSolid; class IfcCurrencyRelationship; class IfcCurtainWall; class IfcCurtainWallType; class IfcCurve; class IfcCurveBoundedPlane; class IfcCurveStyle; class IfcCurveStyleFont; class IfcCurveStyleFontAndScaling; class IfcCurveStyleFontPattern; class IfcDamperType; class IfcDateAndTime; class IfcDefinedSymbol; class IfcDerivedProfileDef; class IfcDerivedUnit; class IfcDerivedUnitElement; class IfcDiameterDimension; class IfcDimensionCalloutRelationship; class IfcDimensionCurve; class IfcDimensionCurveDirectedCallout; class IfcDimensionCurveTerminator; class IfcDimensionPair; class IfcDimensionalExponents; class IfcDirection; class IfcDiscreteAccessory; class IfcDiscreteAccessoryType; class IfcDistributionChamberElement; class IfcDistributionChamberElementType; class IfcDistributionControlElement; class IfcDistributionControlElementType; class IfcDistributionElement; class IfcDistributionElementType; class IfcDistributionFlowElement; class IfcDistributionFlowElementType; class IfcDistributionPort; class IfcDocumentElectronicFormat; class IfcDocumentInformation; class IfcDocumentInformationRelationship; class IfcDocumentReference; class IfcDoor; class IfcDoorLiningProperties; class IfcDoorPanelProperties; class IfcDoorStyle; class IfcDraughtingCallout; class IfcDraughtingCalloutRelationship; class IfcDraughtingPreDefinedColour; class IfcDraughtingPreDefinedCurveFont; class IfcDraughtingPreDefinedTextFont; class IfcDuctFittingType; class IfcDuctSegmentType; class IfcDuctSilencerType; class IfcEdge; class IfcEdgeCurve; class IfcEdgeFeature; class IfcEdgeLoop; class IfcElectricApplianceType; class IfcElectricDistributionPoint; class IfcElectricFlowStorageDeviceType; class IfcElectricGeneratorType; class IfcElectricHeaterType; class IfcElectricMotorType; class IfcElectricTimeControlType; class IfcElectricalBaseProperties; class IfcElectricalCircuit; class IfcElectricalElement; class IfcElement; class IfcElementAssembly; class IfcElementComponent; class IfcElementComponentType; class IfcElementQuantity; class IfcElementType; class IfcElementarySurface; class IfcEllipse; class IfcEllipseProfileDef; class IfcEnergyConversionDevice; class IfcEnergyConversionDeviceType; class IfcEnergyProperties; class IfcEnvironmentalImpactValue; class IfcEquipmentElement; class IfcEquipmentStandard; class IfcEvaporativeCoolerType; class IfcEvaporatorType; class IfcExtendedMaterialProperties; class IfcExternalReference; class IfcExternallyDefinedHatchStyle; class IfcExternallyDefinedSurfaceStyle; class IfcExternallyDefinedSymbol; class IfcExternallyDefinedTextFont; class IfcExtrudedAreaSolid; class IfcFace; class IfcFaceBasedSurfaceModel; class IfcFaceBound; class IfcFaceOuterBound; class IfcFaceSurface; class IfcFacetedBrep; class IfcFacetedBrepWithVoids; class IfcFailureConnectionCondition; class IfcFanType; class IfcFastener; class IfcFastenerType; class IfcFeatureElement; class IfcFeatureElementAddition; class IfcFeatureElementSubtraction; class IfcFillAreaStyle; class IfcFillAreaStyleHatching; class IfcFillAreaStyleTileSymbolWithStyle; class IfcFillAreaStyleTiles; class IfcFilterType; class IfcFireSuppressionTerminalType; class IfcFlowController; class IfcFlowControllerType; class IfcFlowFitting; class IfcFlowFittingType; class IfcFlowInstrumentType; class IfcFlowMeterType; class IfcFlowMovingDevice; class IfcFlowMovingDeviceType; class IfcFlowSegment; class IfcFlowSegmentType; class IfcFlowStorageDevice; class IfcFlowStorageDeviceType; class IfcFlowTerminal; class IfcFlowTerminalType; class IfcFlowTreatmentDevice; class IfcFlowTreatmentDeviceType; class IfcFluidFlowProperties; class IfcFooting; class IfcFuelProperties; class IfcFurnishingElement; class IfcFurnishingElementType; class IfcFurnitureStandard; class IfcFurnitureType; class IfcGasTerminalType; class IfcGeneralMaterialProperties; class IfcGeneralProfileProperties; class IfcGeometricCurveSet; class IfcGeometricRepresentationContext; class IfcGeometricRepresentationItem; class IfcGeometricRepresentationSubContext; class IfcGeometricSet; class IfcGrid; class IfcGridAxis; class IfcGridPlacement; class IfcGroup; class IfcHalfSpaceSolid; class IfcHeatExchangerType; class IfcHumidifierType; class IfcHygroscopicMaterialProperties; class IfcIShapeProfileDef; class IfcImageTexture; class IfcInventory; class IfcIrregularTimeSeries; class IfcIrregularTimeSeriesValue; class IfcJunctionBoxType; class IfcLShapeProfileDef; class IfcLaborResource; class IfcLampType; class IfcLibraryInformation; class IfcLibraryReference; class IfcLightDistributionData; class IfcLightFixtureType; class IfcLightIntensityDistribution; class IfcLightSource; class IfcLightSourceAmbient; class IfcLightSourceDirectional; class IfcLightSourceGoniometric; class IfcLightSourcePositional; class IfcLightSourceSpot; class IfcLine; class IfcLinearDimension; class IfcLocalPlacement; class IfcLocalTime; class IfcLoop; class IfcManifoldSolidBrep; class IfcMappedItem; class IfcMaterial; class IfcMaterialClassificationRelationship; class IfcMaterialDefinitionRepresentation; class IfcMaterialLayer; class IfcMaterialLayerSet; class IfcMaterialLayerSetUsage; class IfcMaterialList; class IfcMaterialProperties; class IfcMeasureWithUnit; class IfcMechanicalConcreteMaterialProperties; class IfcMechanicalFastener; class IfcMechanicalFastenerType; class IfcMechanicalMaterialProperties; class IfcMechanicalSteelMaterialProperties; class IfcMember; class IfcMemberType; class IfcMetric; class IfcMonetaryUnit; class IfcMotorConnectionType; class IfcMove; class IfcNamedUnit; class IfcObject; class IfcObjectDefinition; class IfcObjectPlacement; class IfcObjective; class IfcOccupant; class IfcOffsetCurve2D; class IfcOffsetCurve3D; class IfcOneDirectionRepeatFactor; class IfcOpenShell; class IfcOpeningElement; class IfcOpticalMaterialProperties; class IfcOrderAction; class IfcOrganization; class IfcOrganizationRelationship; class IfcOrientedEdge; class IfcOutletType; class IfcOwnerHistory; class IfcParameterizedProfileDef; class IfcPath; class IfcPerformanceHistory; class IfcPermeableCoveringProperties; class IfcPermit; class IfcPerson; class IfcPersonAndOrganization; class IfcPhysicalComplexQuantity; class IfcPhysicalQuantity; class IfcPhysicalSimpleQuantity; class IfcPile; class IfcPipeFittingType; class IfcPipeSegmentType; class IfcPixelTexture; class IfcPlacement; class IfcPlanarBox; class IfcPlanarExtent; class IfcPlane; class IfcPlate; class IfcPlateType; class IfcPoint; class IfcPointOnCurve; class IfcPointOnSurface; class IfcPolyLoop; class IfcPolygonalBoundedHalfSpace; class IfcPolyline; class IfcPort; class IfcPostalAddress; class IfcPreDefinedColour; class IfcPreDefinedCurveFont; class IfcPreDefinedDimensionSymbol; class IfcPreDefinedItem; class IfcPreDefinedPointMarkerSymbol; class IfcPreDefinedSymbol; class IfcPreDefinedTerminatorSymbol; class IfcPreDefinedTextFont; class IfcPresentationLayerAssignment; class IfcPresentationLayerWithStyle; class IfcPresentationStyle; class IfcPresentationStyleAssignment; class IfcProcedure; class IfcProcess; class IfcProduct; class IfcProductDefinitionShape; class IfcProductRepresentation; class IfcProductsOfCombustionProperties; class IfcProfileDef; class IfcProfileProperties; class IfcProject; class IfcProjectOrder; class IfcProjectOrderRecord; class IfcProjectionCurve; class IfcProjectionElement; class IfcProperty; class IfcPropertyBoundedValue; class IfcPropertyConstraintRelationship; class IfcPropertyDefinition; class IfcPropertyDependencyRelationship; class IfcPropertyEnumeratedValue; class IfcPropertyEnumeration; class IfcPropertyListValue; class IfcPropertyReferenceValue; class IfcPropertySet; class IfcPropertySetDefinition; class IfcPropertySingleValue; class IfcPropertyTableValue; class IfcProtectiveDeviceType; class IfcProxy; class IfcPumpType; class IfcQuantityArea; class IfcQuantityCount; class IfcQuantityLength; class IfcQuantityTime; class IfcQuantityVolume; class IfcQuantityWeight; class IfcRadiusDimension; class IfcRailing; class IfcRailingType; class IfcRamp; class IfcRampFlight; class IfcRampFlightType; class IfcRationalBezierCurve; class IfcRectangleHollowProfileDef; class IfcRectangleProfileDef; class IfcRectangularPyramid; class IfcRectangularTrimmedSurface; class IfcReferencesValueDocument; class IfcRegularTimeSeries; class IfcReinforcementBarProperties; class IfcReinforcementDefinitionProperties; class IfcReinforcingBar; class IfcReinforcingElement; class IfcReinforcingMesh; class IfcRelAggregates; class IfcRelAssigns; class IfcRelAssignsTasks; class IfcRelAssignsToActor; class IfcRelAssignsToControl; class IfcRelAssignsToGroup; class IfcRelAssignsToProcess; class IfcRelAssignsToProduct; class IfcRelAssignsToProjectOrder; class IfcRelAssignsToResource; class IfcRelAssociates; class IfcRelAssociatesAppliedValue; class IfcRelAssociatesApproval; class IfcRelAssociatesClassification; class IfcRelAssociatesConstraint; class IfcRelAssociatesDocument; class IfcRelAssociatesLibrary; class IfcRelAssociatesMaterial; class IfcRelAssociatesProfileProperties; class IfcRelConnects; class IfcRelConnectsElements; class IfcRelConnectsPathElements; class IfcRelConnectsPortToElement; class IfcRelConnectsPorts; class IfcRelConnectsStructuralActivity; class IfcRelConnectsStructuralElement; class IfcRelConnectsStructuralMember; class IfcRelConnectsWithEccentricity; class IfcRelConnectsWithRealizingElements; class IfcRelContainedInSpatialStructure; class IfcRelCoversBldgElements; class IfcRelCoversSpaces; class IfcRelDecomposes; class IfcRelDefines; class IfcRelDefinesByProperties; class IfcRelDefinesByType; class IfcRelFillsElement; class IfcRelFlowControlElements; class IfcRelInteractionRequirements; class IfcRelNests; class IfcRelOccupiesSpaces; class IfcRelOverridesProperties; class IfcRelProjectsElement; class IfcRelReferencedInSpatialStructure; class IfcRelSchedulesCostItems; class IfcRelSequence; class IfcRelServicesBuildings; class IfcRelSpaceBoundary; class IfcRelVoidsElement; class IfcRelationship; class IfcRelaxation; class IfcRepresentation; class IfcRepresentationContext; class IfcRepresentationItem; class IfcRepresentationMap; class IfcResource; class IfcRevolvedAreaSolid; class IfcRibPlateProfileProperties; class IfcRightCircularCone; class IfcRightCircularCylinder; class IfcRoof; class IfcRoot; class IfcRoundedEdgeFeature; class IfcRoundedRectangleProfileDef; class IfcSIUnit; class IfcSanitaryTerminalType; class IfcScheduleTimeControl; class IfcSectionProperties; class IfcSectionReinforcementProperties; class IfcSectionedSpine; class IfcSensorType; class IfcServiceLife; class IfcServiceLifeFactor; class IfcShapeAspect; class IfcShapeModel; class IfcShapeRepresentation; class IfcShellBasedSurfaceModel; class IfcSimpleProperty; class IfcSite; class IfcSlab; class IfcSlabType; class IfcSlippageConnectionCondition; class IfcSolidModel; class IfcSoundProperties; class IfcSoundValue; class IfcSpace; class IfcSpaceHeaterType; class IfcSpaceProgram; class IfcSpaceThermalLoadProperties; class IfcSpaceType; class IfcSpatialStructureElement; class IfcSpatialStructureElementType; class IfcSphere; class IfcStackTerminalType; class IfcStair; class IfcStairFlight; class IfcStairFlightType; class IfcStructuralAction; class IfcStructuralActivity; class IfcStructuralAnalysisModel; class IfcStructuralConnection; class IfcStructuralConnectionCondition; class IfcStructuralCurveConnection; class IfcStructuralCurveMember; class IfcStructuralCurveMemberVarying; class IfcStructuralItem; class IfcStructuralLinearAction; class IfcStructuralLinearActionVarying; class IfcStructuralLoad; class IfcStructuralLoadGroup; class IfcStructuralLoadLinearForce; class IfcStructuralLoadPlanarForce; class IfcStructuralLoadSingleDisplacement; class IfcStructuralLoadSingleDisplacementDistortion; class IfcStructuralLoadSingleForce; class IfcStructuralLoadSingleForceWarping; class IfcStructuralLoadStatic; class IfcStructuralLoadTemperature; class IfcStructuralMember; class IfcStructuralPlanarAction; class IfcStructuralPlanarActionVarying; class IfcStructuralPointAction; class IfcStructuralPointConnection; class IfcStructuralPointReaction; class IfcStructuralProfileProperties; class IfcStructuralReaction; class IfcStructuralResultGroup; class IfcStructuralSteelProfileProperties; class IfcStructuralSurfaceConnection; class IfcStructuralSurfaceMember; class IfcStructuralSurfaceMemberVarying; class IfcStructuredDimensionCallout; class IfcStyleModel; class IfcStyledItem; class IfcStyledRepresentation; class IfcSubContractResource; class IfcSubedge; class IfcSurface; class IfcSurfaceCurveSweptAreaSolid; class IfcSurfaceOfLinearExtrusion; class IfcSurfaceOfRevolution; class IfcSurfaceStyle; class IfcSurfaceStyleLighting; class IfcSurfaceStyleRefraction; class IfcSurfaceStyleRendering; class IfcSurfaceStyleShading; class IfcSurfaceStyleWithTextures; class IfcSurfaceTexture; class IfcSweptAreaSolid; class IfcSweptDiskSolid; class IfcSweptSurface; class IfcSwitchingDeviceType; class IfcSymbolStyle; class IfcSystem; class IfcSystemFurnitureElementType; class IfcTShapeProfileDef; class IfcTable; class IfcTableRow; class IfcTankType; class IfcTask; class IfcTelecomAddress; class IfcTendon; class IfcTendonAnchor; class IfcTerminatorSymbol; class IfcTextLiteral; class IfcTextLiteralWithExtent; class IfcTextStyle; class IfcTextStyleFontModel; class IfcTextStyleForDefinedFont; class IfcTextStyleTextModel; class IfcTextStyleWithBoxCharacteristics; class IfcTextureCoordinate; class IfcTextureCoordinateGenerator; class IfcTextureMap; class IfcTextureVertex; class IfcThermalMaterialProperties; class IfcTimeSeries; class IfcTimeSeriesReferenceRelationship; class IfcTimeSeriesSchedule; class IfcTimeSeriesValue; class IfcTopologicalRepresentationItem; class IfcTopologyRepresentation; class IfcTransformerType; class IfcTransportElement; class IfcTransportElementType; class IfcTrapeziumProfileDef; class IfcTrimmedCurve; class IfcTubeBundleType; class IfcTwoDirectionRepeatFactor; class IfcTypeObject; class IfcTypeProduct; class IfcUShapeProfileDef; class IfcUnitAssignment; class IfcUnitaryEquipmentType; class IfcValveType; class IfcVector; class IfcVertex; class IfcVertexBasedTextureMap; class IfcVertexLoop; class IfcVertexPoint; class IfcVibrationIsolatorType; class IfcVirtualElement; class IfcVirtualGridIntersection; class IfcWall; class IfcWallStandardCase; class IfcWallType; class IfcWasteTerminalType; class IfcWaterProperties; class IfcWindow; class IfcWindowLiningProperties; class IfcWindowPanelProperties; class IfcWindowStyle; class IfcWorkControl; class IfcWorkPlan; class IfcWorkSchedule; class IfcZShapeProfileDef; class IfcZone; class IfcAbsorbedDoseMeasure; class IfcAccelerationMeasure; class IfcAmountOfSubstanceMeasure; class IfcAngularVelocityMeasure; class IfcAreaMeasure; class IfcBoolean; class IfcBoxAlignment; class IfcComplexNumber; class IfcCompoundPlaneAngleMeasure; class IfcContextDependentMeasure; class IfcCountMeasure; class IfcCurvatureMeasure; class IfcDayInMonthNumber; class IfcDaylightSavingHour; class IfcDescriptiveMeasure; class IfcDimensionCount; class IfcDoseEquivalentMeasure; class IfcDynamicViscosityMeasure; class IfcElectricCapacitanceMeasure; class IfcElectricChargeMeasure; class IfcElectricConductanceMeasure; class IfcElectricCurrentMeasure; class IfcElectricResistanceMeasure; class IfcElectricVoltageMeasure; class IfcEnergyMeasure; class IfcFontStyle; class IfcFontVariant; class IfcFontWeight; class IfcForceMeasure; class IfcFrequencyMeasure; class IfcGloballyUniqueId; class IfcHeatFluxDensityMeasure; class IfcHeatingValueMeasure; class IfcHourInDay; class IfcIdentifier; class IfcIlluminanceMeasure; class IfcInductanceMeasure; class IfcInteger; class IfcIntegerCountRateMeasure; class IfcIonConcentrationMeasure; class IfcIsothermalMoistureCapacityMeasure; class IfcKinematicViscosityMeasure; class IfcLabel; class IfcLengthMeasure; class IfcLinearForceMeasure; class IfcLinearMomentMeasure; class IfcLinearStiffnessMeasure; class IfcLinearVelocityMeasure; class IfcLogical; class IfcLuminousFluxMeasure; class IfcLuminousIntensityDistributionMeasure; class IfcLuminousIntensityMeasure; class IfcMagneticFluxDensityMeasure; class IfcMagneticFluxMeasure; class IfcMassDensityMeasure; class IfcMassFlowRateMeasure; class IfcMassMeasure; class IfcMassPerLengthMeasure; class IfcMinuteInHour; class IfcModulusOfElasticityMeasure; class IfcModulusOfLinearSubgradeReactionMeasure; class IfcModulusOfRotationalSubgradeReactionMeasure; class IfcModulusOfSubgradeReactionMeasure; class IfcMoistureDiffusivityMeasure; class IfcMolecularWeightMeasure; class IfcMomentOfInertiaMeasure; class IfcMonetaryMeasure; class IfcMonthInYearNumber; class IfcNormalisedRatioMeasure; class IfcNumericMeasure; class IfcPHMeasure; class IfcParameterValue; class IfcPlanarForceMeasure; class IfcPlaneAngleMeasure; class IfcPositiveLengthMeasure; class IfcPositivePlaneAngleMeasure; class IfcPositiveRatioMeasure; class IfcPowerMeasure; class IfcPresentableText; class IfcPressureMeasure; class IfcRadioActivityMeasure; class IfcRatioMeasure; class IfcReal; class IfcRotationalFrequencyMeasure; class IfcRotationalMassMeasure; class IfcRotationalStiffnessMeasure; class IfcSecondInMinute; class IfcSectionModulusMeasure; class IfcSectionalAreaIntegralMeasure; class IfcShearModulusMeasure; class IfcSolidAngleMeasure; class IfcSoundPowerMeasure; class IfcSoundPressureMeasure; class IfcSpecificHeatCapacityMeasure; class IfcSpecularExponent; class IfcSpecularRoughness; class IfcTemperatureGradientMeasure; class IfcText; class IfcTextAlignment; class IfcTextDecoration; class IfcTextFontName; class IfcTextTransformation; class IfcThermalAdmittanceMeasure; class IfcThermalConductivityMeasure; class IfcThermalExpansionCoefficientMeasure; class IfcThermalResistanceMeasure; class IfcThermalTransmittanceMeasure; class IfcThermodynamicTemperatureMeasure; class IfcTimeMeasure; class IfcTimeStamp; class IfcTorqueMeasure; class IfcVaporPermeabilityMeasure; class IfcVolumeMeasure; class IfcVolumetricFlowRateMeasure; class IfcWarpingConstantMeasure; class IfcWarpingMomentMeasure; class IfcYearNumber; diff --git a/src/ifcparse/Ifc4-latebound.cpp b/src/ifcparse/Ifc4-latebound.cpp index e0552dc962..80b4b9cb1f 100644 --- a/src/ifcparse/Ifc4-latebound.cpp +++ b/src/ifcparse/Ifc4-latebound.cpp @@ -24,6 +24,8 @@ * * ********************************************************************************/ +#ifdef USE_IFC4 + #include #include "../ifcparse/Ifc4.h" @@ -4943,3 +4945,5 @@ void Type::PopulateDerivedFields(IfcWrite::IfcWritableEntity* e) { } } } + +#endif diff --git a/src/ifcparse/Ifc4.h b/src/ifcparse/Ifc4.h index 3b15d9265e..f8b916c142 100644 --- a/src/ifcparse/Ifc4.h +++ b/src/ifcparse/Ifc4.h @@ -41,6 +41,8 @@ namespace Ifc4 { +const char* const Identifier = "IFC4"; + // Forward definitions class IfcActionRequest; class IfcActor; class IfcActorRole; class IfcActuator; class IfcActuatorType; class IfcAddress; class IfcAdvancedBrep; class IfcAdvancedBrepWithVoids; class IfcAdvancedFace; class IfcAirTerminal; class IfcAirTerminalBox; class IfcAirTerminalBoxType; class IfcAirTerminalType; class IfcAirToAirHeatRecovery; class IfcAirToAirHeatRecoveryType; class IfcAlarm; class IfcAlarmType; class IfcAnnotation; class IfcAnnotationFillArea; class IfcApplication; class IfcAppliedValue; class IfcApproval; class IfcApprovalRelationship; class IfcArbitraryClosedProfileDef; class IfcArbitraryOpenProfileDef; class IfcArbitraryProfileDefWithVoids; class IfcAsset; class IfcAsymmetricIShapeProfileDef; class IfcAudioVisualAppliance; class IfcAudioVisualApplianceType; class IfcAxis1Placement; class IfcAxis2Placement2D; class IfcAxis2Placement3D; class IfcBSplineCurve; class IfcBSplineCurveWithKnots; class IfcBSplineSurface; class IfcBSplineSurfaceWithKnots; class IfcBeam; class IfcBeamStandardCase; class IfcBeamType; class IfcBlobTexture; class IfcBlock; class IfcBoiler; class IfcBoilerType; class IfcBooleanClippingResult; class IfcBooleanResult; class IfcBoundaryCondition; class IfcBoundaryCurve; class IfcBoundaryEdgeCondition; class IfcBoundaryFaceCondition; class IfcBoundaryNodeCondition; class IfcBoundaryNodeConditionWarping; class IfcBoundedCurve; class IfcBoundedSurface; class IfcBoundingBox; class IfcBoxedHalfSpace; class IfcBuilding; class IfcBuildingElement; class IfcBuildingElementPart; class IfcBuildingElementPartType; class IfcBuildingElementProxy; class IfcBuildingElementProxyType; class IfcBuildingElementType; class IfcBuildingStorey; class IfcBuildingSystem; class IfcBurner; class IfcBurnerType; class IfcCShapeProfileDef; class IfcCableCarrierFitting; class IfcCableCarrierFittingType; class IfcCableCarrierSegment; class IfcCableCarrierSegmentType; class IfcCableFitting; class IfcCableFittingType; class IfcCableSegment; class IfcCableSegmentType; class IfcCartesianPoint; class IfcCartesianPointList; class IfcCartesianPointList3D; class IfcCartesianTransformationOperator; class IfcCartesianTransformationOperator2D; class IfcCartesianTransformationOperator2DnonUniform; class IfcCartesianTransformationOperator3D; class IfcCartesianTransformationOperator3DnonUniform; class IfcCenterLineProfileDef; class IfcChiller; class IfcChillerType; class IfcChimney; class IfcChimneyType; class IfcCircle; class IfcCircleHollowProfileDef; class IfcCircleProfileDef; class IfcCivilElement; class IfcCivilElementType; class IfcClassification; class IfcClassificationReference; class IfcClosedShell; class IfcCoil; class IfcCoilType; class IfcColourRgb; class IfcColourRgbList; class IfcColourSpecification; class IfcColumn; class IfcColumnStandardCase; class IfcColumnType; class IfcCommunicationsAppliance; class IfcCommunicationsApplianceType; class IfcComplexProperty; class IfcComplexPropertyTemplate; class IfcCompositeCurve; class IfcCompositeCurveOnSurface; class IfcCompositeCurveSegment; class IfcCompositeProfileDef; class IfcCompressor; class IfcCompressorType; class IfcCondenser; class IfcCondenserType; class IfcConic; class IfcConnectedFaceSet; class IfcConnectionCurveGeometry; class IfcConnectionGeometry; class IfcConnectionPointEccentricity; class IfcConnectionPointGeometry; class IfcConnectionSurfaceGeometry; class IfcConnectionVolumeGeometry; class IfcConstraint; class IfcConstructionEquipmentResource; class IfcConstructionEquipmentResourceType; class IfcConstructionMaterialResource; class IfcConstructionMaterialResourceType; class IfcConstructionProductResource; class IfcConstructionProductResourceType; class IfcConstructionResource; class IfcConstructionResourceType; class IfcContext; class IfcContextDependentUnit; class IfcControl; class IfcController; class IfcControllerType; class IfcConversionBasedUnit; class IfcConversionBasedUnitWithOffset; class IfcCooledBeam; class IfcCooledBeamType; class IfcCoolingTower; class IfcCoolingTowerType; class IfcCoordinateOperation; class IfcCoordinateReferenceSystem; class IfcCostItem; class IfcCostSchedule; class IfcCostValue; class IfcCovering; class IfcCoveringType; class IfcCrewResource; class IfcCrewResourceType; class IfcCsgPrimitive3D; class IfcCsgSolid; class IfcCurrencyRelationship; class IfcCurtainWall; class IfcCurtainWallType; class IfcCurve; class IfcCurveBoundedPlane; class IfcCurveBoundedSurface; class IfcCurveStyle; class IfcCurveStyleFont; class IfcCurveStyleFontAndScaling; class IfcCurveStyleFontPattern; class IfcCylindricalSurface; class IfcDamper; class IfcDamperType; class IfcDerivedProfileDef; class IfcDerivedUnit; class IfcDerivedUnitElement; class IfcDimensionalExponents; class IfcDirection; class IfcDiscreteAccessory; class IfcDiscreteAccessoryType; class IfcDistributionChamberElement; class IfcDistributionChamberElementType; class IfcDistributionCircuit; class IfcDistributionControlElement; class IfcDistributionControlElementType; class IfcDistributionElement; class IfcDistributionElementType; class IfcDistributionFlowElement; class IfcDistributionFlowElementType; class IfcDistributionPort; class IfcDistributionSystem; class IfcDocumentInformation; class IfcDocumentInformationRelationship; class IfcDocumentReference; class IfcDoor; class IfcDoorLiningProperties; class IfcDoorPanelProperties; class IfcDoorStandardCase; class IfcDoorStyle; class IfcDoorType; class IfcDraughtingPreDefinedColour; class IfcDraughtingPreDefinedCurveFont; class IfcDuctFitting; class IfcDuctFittingType; class IfcDuctSegment; class IfcDuctSegmentType; class IfcDuctSilencer; class IfcDuctSilencerType; class IfcEdge; class IfcEdgeCurve; class IfcEdgeLoop; class IfcElectricAppliance; class IfcElectricApplianceType; class IfcElectricDistributionBoard; class IfcElectricDistributionBoardType; class IfcElectricFlowStorageDevice; class IfcElectricFlowStorageDeviceType; class IfcElectricGenerator; class IfcElectricGeneratorType; class IfcElectricMotor; class IfcElectricMotorType; class IfcElectricTimeControl; class IfcElectricTimeControlType; class IfcElement; class IfcElementAssembly; class IfcElementAssemblyType; class IfcElementComponent; class IfcElementComponentType; class IfcElementQuantity; class IfcElementType; class IfcElementarySurface; class IfcEllipse; class IfcEllipseProfileDef; class IfcEnergyConversionDevice; class IfcEnergyConversionDeviceType; class IfcEngine; class IfcEngineType; class IfcEvaporativeCooler; class IfcEvaporativeCoolerType; class IfcEvaporator; class IfcEvaporatorType; class IfcEvent; class IfcEventTime; class IfcEventType; class IfcExtendedProperties; class IfcExternalInformation; class IfcExternalReference; class IfcExternalReferenceRelationship; class IfcExternalSpatialElement; class IfcExternalSpatialStructureElement; class IfcExternallyDefinedHatchStyle; class IfcExternallyDefinedSurfaceStyle; class IfcExternallyDefinedTextFont; class IfcExtrudedAreaSolid; class IfcExtrudedAreaSolidTapered; class IfcFace; class IfcFaceBasedSurfaceModel; class IfcFaceBound; class IfcFaceOuterBound; class IfcFaceSurface; class IfcFacetedBrep; class IfcFacetedBrepWithVoids; class IfcFailureConnectionCondition; class IfcFan; class IfcFanType; class IfcFastener; class IfcFastenerType; class IfcFeatureElement; class IfcFeatureElementAddition; class IfcFeatureElementSubtraction; class IfcFillAreaStyle; class IfcFillAreaStyleHatching; class IfcFillAreaStyleTiles; class IfcFilter; class IfcFilterType; class IfcFireSuppressionTerminal; class IfcFireSuppressionTerminalType; class IfcFixedReferenceSweptAreaSolid; class IfcFlowController; class IfcFlowControllerType; class IfcFlowFitting; class IfcFlowFittingType; class IfcFlowInstrument; class IfcFlowInstrumentType; class IfcFlowMeter; class IfcFlowMeterType; class IfcFlowMovingDevice; class IfcFlowMovingDeviceType; class IfcFlowSegment; class IfcFlowSegmentType; class IfcFlowStorageDevice; class IfcFlowStorageDeviceType; class IfcFlowTerminal; class IfcFlowTerminalType; class IfcFlowTreatmentDevice; class IfcFlowTreatmentDeviceType; class IfcFooting; class IfcFootingType; class IfcFurnishingElement; class IfcFurnishingElementType; class IfcFurniture; class IfcFurnitureType; class IfcGeographicElement; class IfcGeographicElementType; class IfcGeometricCurveSet; class IfcGeometricRepresentationContext; class IfcGeometricRepresentationItem; class IfcGeometricRepresentationSubContext; class IfcGeometricSet; class IfcGrid; class IfcGridAxis; class IfcGridPlacement; class IfcGroup; class IfcHalfSpaceSolid; class IfcHeatExchanger; class IfcHeatExchangerType; class IfcHumidifier; class IfcHumidifierType; class IfcIShapeProfileDef; class IfcImageTexture; class IfcIndexedColourMap; class IfcIndexedTextureMap; class IfcIndexedTriangleTextureMap; class IfcInterceptor; class IfcInterceptorType; class IfcInventory; class IfcIrregularTimeSeries; class IfcIrregularTimeSeriesValue; class IfcJunctionBox; class IfcJunctionBoxType; class IfcLShapeProfileDef; class IfcLaborResource; class IfcLaborResourceType; class IfcLagTime; class IfcLamp; class IfcLampType; class IfcLibraryInformation; class IfcLibraryReference; class IfcLightDistributionData; class IfcLightFixture; class IfcLightFixtureType; class IfcLightIntensityDistribution; class IfcLightSource; class IfcLightSourceAmbient; class IfcLightSourceDirectional; class IfcLightSourceGoniometric; class IfcLightSourcePositional; class IfcLightSourceSpot; class IfcLine; class IfcLocalPlacement; class IfcLoop; class IfcManifoldSolidBrep; class IfcMapConversion; class IfcMappedItem; class IfcMaterial; class IfcMaterialClassificationRelationship; class IfcMaterialConstituent; class IfcMaterialConstituentSet; class IfcMaterialDefinition; class IfcMaterialDefinitionRepresentation; class IfcMaterialLayer; class IfcMaterialLayerSet; class IfcMaterialLayerSetUsage; class IfcMaterialLayerWithOffsets; class IfcMaterialList; class IfcMaterialProfile; class IfcMaterialProfileSet; class IfcMaterialProfileSetUsage; class IfcMaterialProfileSetUsageTapering; class IfcMaterialProfileWithOffsets; class IfcMaterialProperties; class IfcMaterialRelationship; class IfcMaterialUsageDefinition; class IfcMeasureWithUnit; class IfcMechanicalFastener; class IfcMechanicalFastenerType; class IfcMedicalDevice; class IfcMedicalDeviceType; class IfcMember; class IfcMemberStandardCase; class IfcMemberType; class IfcMetric; class IfcMirroredProfileDef; class IfcMonetaryUnit; class IfcMotorConnection; class IfcMotorConnectionType; class IfcNamedUnit; class IfcObject; class IfcObjectDefinition; class IfcObjectPlacement; class IfcObjective; class IfcOccupant; class IfcOffsetCurve2D; class IfcOffsetCurve3D; class IfcOpenShell; class IfcOpeningElement; class IfcOpeningStandardCase; class IfcOrganization; class IfcOrganizationRelationship; class IfcOrientedEdge; class IfcOuterBoundaryCurve; class IfcOutlet; class IfcOutletType; class IfcOwnerHistory; class IfcParameterizedProfileDef; class IfcPath; class IfcPcurve; class IfcPerformanceHistory; class IfcPermeableCoveringProperties; class IfcPermit; class IfcPerson; class IfcPersonAndOrganization; class IfcPhysicalComplexQuantity; class IfcPhysicalQuantity; class IfcPhysicalSimpleQuantity; class IfcPile; class IfcPileType; class IfcPipeFitting; class IfcPipeFittingType; class IfcPipeSegment; class IfcPipeSegmentType; class IfcPixelTexture; class IfcPlacement; class IfcPlanarBox; class IfcPlanarExtent; class IfcPlane; class IfcPlate; class IfcPlateStandardCase; class IfcPlateType; class IfcPoint; class IfcPointOnCurve; class IfcPointOnSurface; class IfcPolyLoop; class IfcPolygonalBoundedHalfSpace; class IfcPolyline; class IfcPort; class IfcPostalAddress; class IfcPreDefinedColour; class IfcPreDefinedCurveFont; class IfcPreDefinedItem; class IfcPreDefinedProperties; class IfcPreDefinedPropertySet; class IfcPreDefinedTextFont; class IfcPresentationItem; class IfcPresentationLayerAssignment; class IfcPresentationLayerWithStyle; class IfcPresentationStyle; class IfcPresentationStyleAssignment; class IfcProcedure; class IfcProcedureType; class IfcProcess; class IfcProduct; class IfcProductDefinitionShape; class IfcProductRepresentation; class IfcProfileDef; class IfcProfileProperties; class IfcProject; class IfcProjectLibrary; class IfcProjectOrder; class IfcProjectedCRS; class IfcProjectionElement; class IfcProperty; class IfcPropertyAbstraction; class IfcPropertyBoundedValue; class IfcPropertyDefinition; class IfcPropertyDependencyRelationship; class IfcPropertyEnumeratedValue; class IfcPropertyEnumeration; class IfcPropertyListValue; class IfcPropertyReferenceValue; class IfcPropertySet; class IfcPropertySetDefinition; class IfcPropertySetTemplate; class IfcPropertySingleValue; class IfcPropertyTableValue; class IfcPropertyTemplate; class IfcPropertyTemplateDefinition; class IfcProtectiveDevice; class IfcProtectiveDeviceTrippingUnit; class IfcProtectiveDeviceTrippingUnitType; class IfcProtectiveDeviceType; class IfcProxy; class IfcPump; class IfcPumpType; class IfcQuantityArea; class IfcQuantityCount; class IfcQuantityLength; class IfcQuantitySet; class IfcQuantityTime; class IfcQuantityVolume; class IfcQuantityWeight; class IfcRailing; class IfcRailingType; class IfcRamp; class IfcRampFlight; class IfcRampFlightType; class IfcRampType; class IfcRationalBSplineCurveWithKnots; class IfcRationalBSplineSurfaceWithKnots; class IfcRectangleHollowProfileDef; class IfcRectangleProfileDef; class IfcRectangularPyramid; class IfcRectangularTrimmedSurface; class IfcRecurrencePattern; class IfcReference; class IfcRegularTimeSeries; class IfcReinforcementBarProperties; class IfcReinforcementDefinitionProperties; class IfcReinforcingBar; class IfcReinforcingBarType; class IfcReinforcingElement; class IfcReinforcingElementType; class IfcReinforcingMesh; class IfcReinforcingMeshType; class IfcRelAggregates; class IfcRelAssigns; class IfcRelAssignsToActor; class IfcRelAssignsToControl; class IfcRelAssignsToGroup; class IfcRelAssignsToGroupByFactor; class IfcRelAssignsToProcess; class IfcRelAssignsToProduct; class IfcRelAssignsToResource; class IfcRelAssociates; class IfcRelAssociatesApproval; class IfcRelAssociatesClassification; class IfcRelAssociatesConstraint; class IfcRelAssociatesDocument; class IfcRelAssociatesLibrary; class IfcRelAssociatesMaterial; class IfcRelConnects; class IfcRelConnectsElements; class IfcRelConnectsPathElements; class IfcRelConnectsPortToElement; class IfcRelConnectsPorts; class IfcRelConnectsStructuralActivity; class IfcRelConnectsStructuralMember; class IfcRelConnectsWithEccentricity; class IfcRelConnectsWithRealizingElements; class IfcRelContainedInSpatialStructure; class IfcRelCoversBldgElements; class IfcRelCoversSpaces; class IfcRelDeclares; class IfcRelDecomposes; class IfcRelDefines; class IfcRelDefinesByObject; class IfcRelDefinesByProperties; class IfcRelDefinesByTemplate; class IfcRelDefinesByType; class IfcRelFillsElement; class IfcRelFlowControlElements; class IfcRelInterferesElements; class IfcRelNests; class IfcRelProjectsElement; class IfcRelReferencedInSpatialStructure; class IfcRelSequence; class IfcRelServicesBuildings; class IfcRelSpaceBoundary; class IfcRelSpaceBoundary1stLevel; class IfcRelSpaceBoundary2ndLevel; class IfcRelVoidsElement; class IfcRelationship; class IfcReparametrisedCompositeCurveSegment; class IfcRepresentation; class IfcRepresentationContext; class IfcRepresentationItem; class IfcRepresentationMap; class IfcResource; class IfcResourceApprovalRelationship; class IfcResourceConstraintRelationship; class IfcResourceLevelRelationship; class IfcResourceTime; class IfcRevolvedAreaSolid; class IfcRevolvedAreaSolidTapered; class IfcRightCircularCone; class IfcRightCircularCylinder; class IfcRoof; class IfcRoofType; class IfcRoot; class IfcRoundedRectangleProfileDef; class IfcSIUnit; class IfcSanitaryTerminal; class IfcSanitaryTerminalType; class IfcSchedulingTime; class IfcSectionProperties; class IfcSectionReinforcementProperties; class IfcSectionedSpine; class IfcSensor; class IfcSensorType; class IfcShadingDevice; class IfcShadingDeviceType; class IfcShapeAspect; class IfcShapeModel; class IfcShapeRepresentation; class IfcShellBasedSurfaceModel; class IfcSimpleProperty; class IfcSimplePropertyTemplate; class IfcSite; class IfcSlab; class IfcSlabElementedCase; class IfcSlabStandardCase; class IfcSlabType; class IfcSlippageConnectionCondition; class IfcSolarDevice; class IfcSolarDeviceType; class IfcSolidModel; class IfcSpace; class IfcSpaceHeater; class IfcSpaceHeaterType; class IfcSpaceType; class IfcSpatialElement; class IfcSpatialElementType; class IfcSpatialStructureElement; class IfcSpatialStructureElementType; class IfcSpatialZone; class IfcSpatialZoneType; class IfcSphere; class IfcStackTerminal; class IfcStackTerminalType; class IfcStair; class IfcStairFlight; class IfcStairFlightType; class IfcStairType; class IfcStructuralAction; class IfcStructuralActivity; class IfcStructuralAnalysisModel; class IfcStructuralConnection; class IfcStructuralConnectionCondition; class IfcStructuralCurveAction; class IfcStructuralCurveConnection; class IfcStructuralCurveMember; class IfcStructuralCurveMemberVarying; class IfcStructuralCurveReaction; class IfcStructuralItem; class IfcStructuralLinearAction; class IfcStructuralLoad; class IfcStructuralLoadCase; class IfcStructuralLoadConfiguration; class IfcStructuralLoadGroup; class IfcStructuralLoadLinearForce; class IfcStructuralLoadOrResult; class IfcStructuralLoadPlanarForce; class IfcStructuralLoadSingleDisplacement; class IfcStructuralLoadSingleDisplacementDistortion; class IfcStructuralLoadSingleForce; class IfcStructuralLoadSingleForceWarping; class IfcStructuralLoadStatic; class IfcStructuralLoadTemperature; class IfcStructuralMember; class IfcStructuralPlanarAction; class IfcStructuralPointAction; class IfcStructuralPointConnection; class IfcStructuralPointReaction; class IfcStructuralReaction; class IfcStructuralResultGroup; class IfcStructuralSurfaceAction; class IfcStructuralSurfaceConnection; class IfcStructuralSurfaceMember; class IfcStructuralSurfaceMemberVarying; class IfcStructuralSurfaceReaction; class IfcStyleModel; class IfcStyledItem; class IfcStyledRepresentation; class IfcSubContractResource; class IfcSubContractResourceType; class IfcSubedge; class IfcSurface; class IfcSurfaceCurveSweptAreaSolid; class IfcSurfaceFeature; class IfcSurfaceOfLinearExtrusion; class IfcSurfaceOfRevolution; class IfcSurfaceReinforcementArea; class IfcSurfaceStyle; class IfcSurfaceStyleLighting; class IfcSurfaceStyleRefraction; class IfcSurfaceStyleRendering; class IfcSurfaceStyleShading; class IfcSurfaceStyleWithTextures; class IfcSurfaceTexture; class IfcSweptAreaSolid; class IfcSweptDiskSolid; class IfcSweptDiskSolidPolygonal; class IfcSweptSurface; class IfcSwitchingDevice; class IfcSwitchingDeviceType; class IfcSystem; class IfcSystemFurnitureElement; class IfcSystemFurnitureElementType; class IfcTShapeProfileDef; class IfcTable; class IfcTableColumn; class IfcTableRow; class IfcTank; class IfcTankType; class IfcTask; class IfcTaskTime; class IfcTaskTimeRecurring; class IfcTaskType; class IfcTelecomAddress; class IfcTendon; class IfcTendonAnchor; class IfcTendonAnchorType; class IfcTendonType; class IfcTessellatedFaceSet; class IfcTessellatedItem; class IfcTextLiteral; class IfcTextLiteralWithExtent; class IfcTextStyle; class IfcTextStyleFontModel; class IfcTextStyleForDefinedFont; class IfcTextStyleTextModel; class IfcTextureCoordinate; class IfcTextureCoordinateGenerator; class IfcTextureMap; class IfcTextureVertex; class IfcTextureVertexList; class IfcTimePeriod; class IfcTimeSeries; class IfcTimeSeriesValue; class IfcTopologicalRepresentationItem; class IfcTopologyRepresentation; class IfcTransformer; class IfcTransformerType; class IfcTransportElement; class IfcTransportElementType; class IfcTrapeziumProfileDef; class IfcTriangulatedFaceSet; class IfcTrimmedCurve; class IfcTubeBundle; class IfcTubeBundleType; class IfcTypeObject; class IfcTypeProcess; class IfcTypeProduct; class IfcTypeResource; class IfcUShapeProfileDef; class IfcUnitAssignment; class IfcUnitaryControlElement; class IfcUnitaryControlElementType; class IfcUnitaryEquipment; class IfcUnitaryEquipmentType; class IfcValve; class IfcValveType; class IfcVector; class IfcVertex; class IfcVertexLoop; class IfcVertexPoint; class IfcVibrationIsolator; class IfcVibrationIsolatorType; class IfcVirtualElement; class IfcVirtualGridIntersection; class IfcVoidingFeature; class IfcWall; class IfcWallElementedCase; class IfcWallStandardCase; class IfcWallType; class IfcWasteTerminal; class IfcWasteTerminalType; class IfcWindow; class IfcWindowLiningProperties; class IfcWindowPanelProperties; class IfcWindowStandardCase; class IfcWindowStyle; class IfcWindowType; class IfcWorkCalendar; class IfcWorkControl; class IfcWorkPlan; class IfcWorkSchedule; class IfcWorkTime; class IfcZShapeProfileDef; class IfcZone; class IfcAbsorbedDoseMeasure; class IfcAccelerationMeasure; class IfcAmountOfSubstanceMeasure; class IfcAngularVelocityMeasure; class IfcAreaDensityMeasure; class IfcAreaMeasure; class IfcBoolean; class IfcBoxAlignment; class IfcCardinalPointReference; class IfcComplexNumber; class IfcCompoundPlaneAngleMeasure; class IfcContextDependentMeasure; class IfcCountMeasure; class IfcCurvatureMeasure; class IfcDate; class IfcDateTime; class IfcDayInMonthNumber; class IfcDayInWeekNumber; class IfcDescriptiveMeasure; class IfcDimensionCount; class IfcDoseEquivalentMeasure; class IfcDuration; class IfcDynamicViscosityMeasure; class IfcElectricCapacitanceMeasure; class IfcElectricChargeMeasure; class IfcElectricConductanceMeasure; class IfcElectricCurrentMeasure; class IfcElectricResistanceMeasure; class IfcElectricVoltageMeasure; class IfcEnergyMeasure; class IfcFontStyle; class IfcFontVariant; class IfcFontWeight; class IfcForceMeasure; class IfcFrequencyMeasure; class IfcGloballyUniqueId; class IfcHeatFluxDensityMeasure; class IfcHeatingValueMeasure; class IfcIdentifier; class IfcIlluminanceMeasure; class IfcInductanceMeasure; class IfcInteger; class IfcIntegerCountRateMeasure; class IfcIonConcentrationMeasure; class IfcIsothermalMoistureCapacityMeasure; class IfcKinematicViscosityMeasure; class IfcLabel; class IfcLanguageId; class IfcLengthMeasure; class IfcLinearForceMeasure; class IfcLinearMomentMeasure; class IfcLinearStiffnessMeasure; class IfcLinearVelocityMeasure; class IfcLogical; class IfcLuminousFluxMeasure; class IfcLuminousIntensityDistributionMeasure; class IfcLuminousIntensityMeasure; class IfcMagneticFluxDensityMeasure; class IfcMagneticFluxMeasure; class IfcMassDensityMeasure; class IfcMassFlowRateMeasure; class IfcMassMeasure; class IfcMassPerLengthMeasure; class IfcModulusOfElasticityMeasure; class IfcModulusOfLinearSubgradeReactionMeasure; class IfcModulusOfRotationalSubgradeReactionMeasure; class IfcModulusOfSubgradeReactionMeasure; class IfcMoistureDiffusivityMeasure; class IfcMolecularWeightMeasure; class IfcMomentOfInertiaMeasure; class IfcMonetaryMeasure; class IfcMonthInYearNumber; class IfcNonNegativeLengthMeasure; class IfcNormalisedRatioMeasure; class IfcNumericMeasure; class IfcPHMeasure; class IfcParameterValue; class IfcPlanarForceMeasure; class IfcPlaneAngleMeasure; class IfcPositiveLengthMeasure; class IfcPositivePlaneAngleMeasure; class IfcPositiveRatioMeasure; class IfcPowerMeasure; class IfcPresentableText; class IfcPressureMeasure; class IfcPropertySetDefinitionSet; class IfcRadioActivityMeasure; class IfcRatioMeasure; class IfcReal; class IfcRotationalFrequencyMeasure; class IfcRotationalMassMeasure; class IfcRotationalStiffnessMeasure; class IfcSectionModulusMeasure; class IfcSectionalAreaIntegralMeasure; class IfcShearModulusMeasure; class IfcSolidAngleMeasure; class IfcSoundPowerLevelMeasure; class IfcSoundPowerMeasure; class IfcSoundPressureLevelMeasure; class IfcSoundPressureMeasure; class IfcSpecificHeatCapacityMeasure; class IfcSpecularExponent; class IfcSpecularRoughness; class IfcTemperatureGradientMeasure; class IfcTemperatureRateOfChangeMeasure; class IfcText; class IfcTextAlignment; class IfcTextDecoration; class IfcTextFontName; class IfcTextTransformation; class IfcThermalAdmittanceMeasure; class IfcThermalConductivityMeasure; class IfcThermalExpansionCoefficientMeasure; class IfcThermalResistanceMeasure; class IfcThermalTransmittanceMeasure; class IfcThermodynamicTemperatureMeasure; class IfcTime; class IfcTimeMeasure; class IfcTimeStamp; class IfcTorqueMeasure; class IfcURIReference; class IfcVaporPermeabilityMeasure; class IfcVolumeMeasure; class IfcVolumetricFlowRateMeasure; class IfcWarpingConstantMeasure; class IfcWarpingMomentMeasure; diff --git a/src/ifcparse/IfcFile.h b/src/ifcparse/IfcFile.h index c5b92c925e..f93c4af924 100644 --- a/src/ifcparse/IfcFile.h +++ b/src/ifcparse/IfcFile.h @@ -23,6 +23,7 @@ #include #include "../ifcparse/IfcParse.h" +#include "../ifcparse/IfcSpfHeader.h" namespace IfcParse { @@ -48,6 +49,8 @@ private: unsigned int lastId; unsigned int MaxId; + IfcSpfHeader _header; + std::string _filename; std::string _timestamp; std::string _author; @@ -56,7 +59,7 @@ private: void initTimestamp(); public: - IfcParse::Tokens* tokens; + IfcParse::IfcSpfLexer* tokens; IfcParse::IfcSpfStream* stream; IfcFile(bool create_latebound_entities = false); @@ -116,6 +119,8 @@ public: std::string authorEmail() const; std::string authorOrganisation() const; + const IfcSpfHeader& header() const { return _header; } + bool create_latebound_entities() const { return _create_latebound_entities; } }; diff --git a/src/ifcparse/IfcParse.cpp b/src/ifcparse/IfcParse.cpp index c1091480ed..cf3c83a934 100644 --- a/src/ifcparse/IfcParse.cpp +++ b/src/ifcparse/IfcParse.cpp @@ -210,17 +210,17 @@ void IfcSpfStream::Inc() { if ( current == '\n' || current == '\r' ) IfcSpfStream::Inc(); } -Tokens::Tokens(IfcParse::IfcSpfStream *s, IfcParse::IfcFile* f) { +IfcSpfLexer::IfcSpfLexer(IfcParse::IfcSpfStream *s, IfcParse::IfcFile* f) { file = f; stream = s; decoder = new IfcCharacterDecoder(s); } -Tokens::~Tokens() { +IfcSpfLexer::~IfcSpfLexer() { delete decoder; } -unsigned int Tokens::skipWhitespace() { +unsigned int IfcSpfLexer::skipWhitespace() { unsigned int n = 0; while ( !stream->eof ) { char c = stream->Peek(); @@ -233,7 +233,7 @@ unsigned int Tokens::skipWhitespace() { return n; } -unsigned int Tokens::skipComment() { +unsigned int IfcSpfLexer::skipComment() { char c = stream->Peek(); if (c != '/') return 0; stream->Inc(); @@ -257,7 +257,7 @@ unsigned int Tokens::skipComment() { // // Returns the offset of the current Token and moves cursor to next // -Token Tokens::Next() { +Token IfcSpfLexer::Next() { if ( stream->eof ) return TokenPtr(); @@ -298,7 +298,7 @@ Token Tokens::Next() { // Reads a std::string from the file at specified offset // Omits whitespace and comments // -std::string Tokens::TokenString(unsigned int offset) { +std::string IfcSpfLexer::TokenString(unsigned int offset) { const bool was_eof = stream->eof; unsigned int old_offset = stream->Tell(); stream->Seek(offset); @@ -323,9 +323,9 @@ std::string Tokens::TokenString(unsigned int offset) { // Functions for creating Tokens from an arbitary file offset. // The first 4 bits are reserved for Tokens of type ()=,;$* // -Token IfcParse::TokenPtr(Tokens* tokens, unsigned int offset) { return Token(tokens,offset); } -Token IfcParse::TokenPtr(char c) { return Token((Tokens*)0,(unsigned) c); } -Token IfcParse::TokenPtr() { return Token((Tokens*)0,0); } +Token IfcParse::TokenPtr(IfcSpfLexer* tokens, unsigned int offset) { return Token(tokens,offset); } +Token IfcParse::TokenPtr(char c) { return Token((IfcSpfLexer*)0,(unsigned) c); } +Token IfcParse::TokenPtr() { return Token((IfcSpfLexer*)0,0); } // // Functions to convert Tokens to binary data @@ -345,8 +345,9 @@ bool TokenFunc::isString(const Token& t) { bool TokenFunc::isEnumeration(const Token& t) { return ! isOperator(t) && startsWith(t, '.'); } -bool TokenFunc::isDatatype(const Token& t) { - return ! isOperator(t) && startsWith(t, 'I'); +bool TokenFunc::isKeyword(const Token& t) { + // bool is a subtype of enumeration, no need to test for that + return !isOperator(t) && !isIdentifier(t) && !isString(t) && !isEnumeration(t) && !isInt(t) && !isFloat(t); } bool TokenFunc::isInt(const Token& t) { if (isOperator(t)) return false; @@ -419,7 +420,7 @@ EntityArgument::EntityArgument(const Token& t) { // Reads the arguments from a list of token // Aditionally, stores the ids (i.e. #[\d]+) in a vector // -ArgumentList::ArgumentList(Tokens* t, std::vector& ids) { +ArgumentList::ArgumentList(IfcSpfLexer* t, std::vector& ids) { IfcParse::IfcFile* file = t->file; Token next = t->Next(); @@ -429,7 +430,7 @@ ArgumentList::ArgumentList(Tokens* t, std::vector& ids) { else if ( TokenFunc::isOperator(next,'(') ) Push( new ArgumentList(t,ids) ); else { if ( TokenFunc::isIdentifier(next) ) ids.push_back(TokenFunc::asInt(next)); - if ( TokenFunc::isDatatype(next) ) { + if ( TokenFunc::isKeyword(next) ) { t->Next(); try { Push ( new EntityArgument(next) ); @@ -619,7 +620,7 @@ EntityArgument::~EntityArgument() { delete entity; } Entity::Entity(unsigned int i, IfcFile* f) : _id(i), args(0) { file = f; Token datatype = f->tokens->Next(); - if ( ! TokenFunc::isDatatype(datatype)) throw IfcException("Unexpected token while parsing entity"); + if ( ! TokenFunc::isKeyword(datatype)) throw IfcException("Unexpected token while parsing entity"); _type = IfcSchema::Type::FromString(TokenFunc::asString(datatype)); offset = datatype.second; } @@ -661,7 +662,7 @@ void Entity::Load(std::vector& ids, bool seek) const { if ( seek ) { file->tokens->stream->Seek(offset); Token datatype = file->tokens->Next(); - if ( ! TokenFunc::isDatatype(datatype)) throw IfcException("Unexpected token while parsing entity"); + if ( ! TokenFunc::isKeyword(datatype)) throw IfcException("Unexpected token while parsing entity"); _type = IfcSchema::Type::FromString(TokenFunc::asString(datatype)); } Token open = file->tokens->Next(); @@ -760,13 +761,27 @@ bool IfcFile::Init(std::istream& f, int len) { bool IfcFile::Init(void* data, int len) { return IfcFile::Init(new IfcSpfStream(data,len)); } -bool IfcFile::Init(IfcParse::IfcSpfStream* f) { - IfcSchema::InitStringMap(); - stream = f; - if ( ! stream->valid ) return false; - tokens = new Tokens (stream,this); +bool IfcFile::Init(IfcParse::IfcSpfStream* s) { + stream = s; + if (!stream->valid) { + return false; + } + + tokens = new IfcSpfLexer(stream, this); + _header.lexer(tokens); + _header.tryRead(); + + std::vector schemas; + try { + schemas = _header.file_schema().schema_identifiers(); + } catch (...) {} + if (schemas.size() != 1 || schemas[0] != IfcSchema::Identifier) { + Logger::Message(Logger::LOG_WARNING, std::string("File schema encountered that is different from expected value of '") + IfcSchema::Identifier + "'"); + } + Token token = TokenPtr(); Token previous = TokenPtr(); + unsigned int currentId = 0; lastId = 0; int x = 0; diff --git a/src/ifcparse/IfcParse.h b/src/ifcparse/IfcParse.h index 09e6701c42..c97bd65eb3 100644 --- a/src/ifcparse/IfcParse.h +++ b/src/ifcparse/IfcParse.h @@ -53,9 +53,9 @@ namespace IfcParse { class Entity; class IfcFile; - class Tokens; + class IfcSpfLexer; - typedef std::pair Token; + typedef std::pair Token; /// Provides functions to convert Tokens to binary data /// Tokens are merely offsets to where they can be read in the file @@ -74,7 +74,7 @@ namespace IfcParse { /// Returns whether the token can be interpreted as an enumerated value static bool isEnumeration(const Token& t); /// Returns whether the token can be interpreted as a datatype name - static bool isDatatype(const Token& t); + static bool isKeyword(const Token& t); /// Returns whether the token can be interpreted as an integer static bool isInt(const Token& t); /// Returns whether the token can be interpreted as a boolean @@ -97,12 +97,12 @@ namespace IfcParse { // Functions for creating Tokens from an arbitary file offset // The first 4 bits are reserved for Tokens of type ()=,;$* // - Token TokenPtr(Tokens* tokens, unsigned int offset); + Token TokenPtr(IfcSpfLexer* tokens, unsigned int offset); Token TokenPtr(char c); Token TokenPtr(); /// A stream of tokens to be read from a IfcSpfStream. - class Tokens { + class IfcSpfLexer { private: IfcCharacterDecoder* decoder; unsigned int skipWhitespace(); @@ -110,9 +110,9 @@ namespace IfcParse { public: IfcSpfStream* stream; IfcFile* file; - Tokens(IfcSpfStream* s, IfcFile* f); + IfcSpfLexer(IfcSpfStream* s, IfcFile* f); Token Next(); - ~Tokens(); + ~IfcSpfLexer(); std::string TokenString(unsigned int offset); }; @@ -124,7 +124,7 @@ namespace IfcParse { std::vector list; void Push(Argument* l); public: - ArgumentList(Tokens* t, std::vector& ids); + ArgumentList(IfcSpfLexer* t, std::vector& ids); ~ArgumentList(); IfcUtil::ArgumentType type() const; diff --git a/src/ifcparse/IfcSpfHeader.cpp b/src/ifcparse/IfcSpfHeader.cpp new file mode 100644 index 0000000000..c75d7cc108 --- /dev/null +++ b/src/ifcparse/IfcSpfHeader.cpp @@ -0,0 +1,108 @@ +/******************************************************************************** + * * + * This file is part of IfcOpenShell. * + * * + * IfcOpenShell is free software: you can redistribute it and/or modify * + * it under the terms of the Lesser GNU General Public License as published by * + * the Free Software Foundation, either version 3.0 of the License, or * + * (at your option) any later version. * + * * + * IfcOpenShell is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * Lesser GNU General Public License for more details. * + * * + * You should have received a copy of the Lesser GNU General Public License * + * along with this program. If not, see . * + * * + ********************************************************************************/ + +#include "../ifcparse/IfcParse.h" + +#include "IfcSpfHeader.h" + +static const char * const ISO_10303_21 = "ISO-10303-21"; +static const char * const HEADER = "HEADER"; +static const char * const FILE_DESCRIPTION = "FILE_DESCRIPTION"; +static const char * const FILE_NAME = "FILE_NAME"; +static const char * const FILE_SCHEMA = "FILE_SCHEMA"; +static const char * const FILE_POPULATION = "FILE_POPULATION"; +static const char * const SECTION_LANGUAGE = "SECTION_LANGUAGE"; +static const char * const SECTION_CONTEXT = "SECTION_CONTEXT"; +static const char * const ENDSEC = "ENDSEC"; +static const char * const DATA = "DATA"; + +using namespace IfcParse; + +void IfcSpfHeader::readSemicolon() { + if (!TokenFunc::isOperator(_lexer->Next(), ';')) { + throw IfcException(std::string("Expected ;")); + } +} + +void IfcSpfHeader::readParen() { + if (!TokenFunc::isOperator(_lexer->Next(), '(')) { + throw IfcException(std::string("Expected (")); + } +} + +void IfcSpfHeader::readTerminal(const std::string& term, Trail trail) { + if (TokenFunc::asString(_lexer->Next()) != term) { + throw IfcException(std::string("Expected " + term)); + } + if (trail == TRAILING_SEMICOLON) { + readSemicolon(); + } else if (trail == TRAILING_PAREN) { + readParen(); + } +} + +void IfcSpfHeader::read() { + readTerminal(ISO_10303_21, TRAILING_SEMICOLON); + readTerminal(HEADER, TRAILING_SEMICOLON); + + readTerminal(FILE_DESCRIPTION, TRAILING_PAREN); + _file_description = new FileDescription(_lexer); + readSemicolon(); + + readTerminal(FILE_NAME, TRAILING_PAREN); + _file_name = new FileName(_lexer); + readSemicolon(); + + readTerminal(FILE_SCHEMA, TRAILING_PAREN); + _file_schema = new FileSchema(_lexer); + readSemicolon(); +} + +bool IfcSpfHeader::tryRead() { + try { + read(); + return true; + } catch(const IfcException&) { + return false; + } +} + +const FileDescription& IfcSpfHeader::file_description() { + if (_file_description) { + return *_file_description; + } else { + throw IfcException("File description not read"); + } +} + +const FileName& IfcSpfHeader::file_name() { + if (_file_name) { + return *_file_name; + } else { + throw IfcException("File name not read"); + } +} + +const FileSchema& IfcSpfHeader::file_schema() { + if (_file_schema) { + return *_file_schema; + } else { + throw IfcException("File schema not read"); + } +} diff --git a/src/ifcparse/IfcSpfHeader.h b/src/ifcparse/IfcSpfHeader.h new file mode 100644 index 0000000000..101f262fb2 --- /dev/null +++ b/src/ifcparse/IfcSpfHeader.h @@ -0,0 +1,96 @@ +/******************************************************************************** + * * + * This file is part of IfcOpenShell. * + * * + * IfcOpenShell is free software: you can redistribute it and/or modify * + * it under the terms of the Lesser GNU General Public License as published by * + * the Free Software Foundation, either version 3.0 of the License, or * + * (at your option) any later version. * + * * + * IfcOpenShell is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * Lesser GNU General Public License for more details. * + * * + * You should have received a copy of the Lesser GNU General Public License * + * along with this program. If not, see . * + * * + ********************************************************************************/ + +#ifndef IFCSPFHEADER_H +#define IFCSPFHEADER_H + +#include "../ifcparse/IfcSpfStream.h" + +namespace IfcParse { + +class HeaderEntity { +private: + ArgumentList* list; +protected: + HeaderEntity(IfcSpfLexer* lexer) { + std::vector ids; + list = new ArgumentList(lexer, ids); + }; + Argument* getArgument(unsigned int i) const { + return (*list)[i]; + } +}; + +class FileDescription : private HeaderEntity { +public: + FileDescription(IfcSpfLexer* lexer) : HeaderEntity(lexer) {} + std::vector description() const { return *getArgument(0); } + std::string implementation_level() const { return *getArgument(1); } +}; + +class FileName : private HeaderEntity { +public: + FileName(IfcSpfLexer* lexer) : HeaderEntity(lexer) {} + std::string name() const { return *getArgument(0); } + std::string time_stamp() const { return *getArgument(1); } + std::vector author() const { return *getArgument(2); } + std::vector organization() const { return *getArgument(3); } + std::string preprocessor_version() const { return *getArgument(4); } + std::string originating_system() const { return *getArgument(5); } + std::string authorization()const { return *getArgument(6); } +}; + +class FileSchema : private HeaderEntity { +public: + FileSchema(IfcSpfLexer* lexer) : HeaderEntity(lexer) {} + std::vector schema_identifiers() const { return *getArgument(0); } +}; + +class IfcSpfHeader { +private: + IfcSpfLexer* _lexer; + FileDescription* _file_description; + FileName* _file_name; + FileSchema* _file_schema; + void readParen(); + void readSemicolon();\ + enum Trail { + TRAILING_SEMICOLON, + TRAILING_PAREN, + NONE + }; + void readTerminal(const std::string& term, Trail trail); +public: + IfcSpfHeader() : _lexer(0), _file_description(0), _file_name(0), _file_schema(0) {} + explicit IfcSpfHeader(IfcSpfLexer* lexer) : _lexer(lexer) {} + + IfcSpfLexer* lexer() { return _lexer; } + void lexer(IfcSpfLexer* l) { _lexer = l; } + + void read(); + bool tryRead(); + + const FileDescription& file_description(); + const FileName& file_name(); + const FileSchema& file_schema(); +}; + +} + +#endif \ No newline at end of file diff --git a/src/ifcwrap/IfcParseWrapper.i b/src/ifcwrap/IfcParseWrapper.i index e177abfadd..f874a48a2a 100644 --- a/src/ifcwrap/IfcParseWrapper.i +++ b/src/ifcwrap/IfcParseWrapper.i @@ -28,6 +28,14 @@ %ignore IfcParse::IfcFile::AddEntity; %ignore operator<<; +%ignore IfcParse::FileDescription::FileDescription; +%ignore IfcParse::FileName::FileName; +%ignore IfcParse::FileSchema::FileSchema; +%ignore IfcParse::IfcFile::tokens; +%ignore IfcParse::IfcSpfHeader::IfcSpfHeader(IfcSpfLexer*); +%ignore IfcParse::IfcSpfHeader::lexer; +%ignore IfcParse::IfcSpfHeader::stream; + %rename("by_type") EntitiesByType; %rename("__len__") getArgumentCount; %rename("get_argument_type") getArgumentType; @@ -156,6 +164,11 @@ std::ofstream f(fn.c_str()); f << (*$self); } + %pythoncode %{ + if _newclass: + # Hide the getters with read-only property implementations + header = property(header) + %} } %extend IfcParse::IfcLateBoundEntity { @@ -164,6 +177,48 @@ %} } +%extend IfcParse::IfcSpfHeader { + %pythoncode %{ + if _newclass: + # Hide the getters with read-only property implementations + file_description = property(file_description) + file_name = property(file_name) + file_schema = property(file_schema) + %} +}; + +%extend IfcParse::FileDescription { + %pythoncode %{ + if _newclass: + # Hide the getters with read-only property implementations + description = property(description) + implementation_level = property(implementation_level) + %} +}; + +%extend IfcParse::FileName { + %pythoncode %{ + if _newclass: + # Hide the getters with read-only property implementations + name = property(name) + time_stamp = property(time_stamp) + author = property(author) + organization = property(organization) + preprocessor_version = property(preprocessor_version) + originating_system = property(originating_system) + authorization = property(authorization) + %} +}; + +%extend IfcParse::FileSchema { + %pythoncode %{ + if _newclass: + # Hide the getters with read-only property implementations + schema_identifiers = property(schema_identifiers) + %} +}; + +%include "../ifcparse/IfcSpfHeader.h" %include "../ifcparse/IfcFile.h" %include "../ifcparse/IfcLateBoundEntity.h" diff --git a/win/IfcParse.vcproj b/win/IfcParse.vcproj index c651cab393..3f81585a7a 100644 --- a/win/IfcParse.vcproj +++ b/win/IfcParse.vcproj @@ -213,6 +213,10 @@ RelativePath="..\src\ifcparse\IfcWrite.cpp" > + + @@ -283,6 +287,10 @@ RelativePath="..\src\ifcparse\IfcParse.h" > + +