From 1e2dd3eefc34f3c31c5b323b99a903d43118e8ef Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Tue, 31 May 2011 14:23:43 +0000 Subject: [PATCH] - IFC: use smart pointers to keep STEP-SELECT entities in the converted output data structures. This allows us to free the original parameter tuples early as ownership of their members can be transferred. This cuts down memory overhead to 8x (assuming a typical x64 builds) and reduces loading time on average by ~5% as measured on my system. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1019 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/IFCLoader.cpp | 44 ++- code/IFCReaderGen.cpp | 476 ++++++++++++++-------------- code/IFCReaderGen.h | 2 +- code/STEPFile.h | 48 ++- code/STEPFileReader.cpp | 10 +- scripts/IFCImporter/CppGenerator.py | 4 +- 6 files changed, 294 insertions(+), 290 deletions(-) diff --git a/code/IFCLoader.cpp b/code/IFCLoader.cpp index 5b29339d9..fe98511e9 100644 --- a/code/IFCLoader.cpp +++ b/code/IFCLoader.cpp @@ -327,7 +327,7 @@ void ProcessSpatialStructures(ConversionData& conv); aiNode* ProcessSpatialStructure(aiNode* parent, const IFC::IfcProduct& el ,ConversionData& conv); void ProcessProductRepresentation(const IFC::IfcProduct& el, aiNode* nd, ConversionData& conv); void MakeTreeRelative(ConversionData& conv); -void ConvertUnit(const EXPRESS::DataType* dt,ConversionData& conv); +void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv); void ProcessSweptAreaSolid(const IFC::IfcSweptAreaSolid& swept, TempMesh& meshout, ConversionData& conv); } // anon @@ -560,7 +560,7 @@ void ConvertUnit(const IFC::IfcNamedUnit& unit,ConversionData& conv) if(convu->UnitType == "PLANEANGLEUNIT") { try { conv.angle_scale = convu->ConversionFactor->ValueComponent->To(); - ConvertUnit(convu->ConversionFactor->UnitComponent,conv); + ConvertUnit(*convu->ConversionFactor->UnitComponent,conv); IFCImporter::LogDebug("got units used for angles"); } catch(std::bad_cast&) { @@ -571,10 +571,10 @@ void ConvertUnit(const IFC::IfcNamedUnit& unit,ConversionData& conv) } // ------------------------------------------------------------------------------------------------ -void ConvertUnit(const EXPRESS::DataType* dt,ConversionData& conv) +void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv) { try { - const EXPRESS::ENTITY& e = dt->To(); + const EXPRESS::ENTITY& e = dt.To(); const IFC::IfcNamedUnit& unit = e.ResolveSelect(conv.db); if(unit.UnitType != "LENGTHUNIT" && unit.UnitType != "PLANEANGLEUNIT") { @@ -594,7 +594,7 @@ void SetUnits(ConversionData& conv) { // see if we can determine the coordinate space used to express. for(size_t i = 0; i < conv.proj.UnitsInContext->Units.size(); ++i ) { - ConvertUnit(conv.proj.UnitsInContext->Units[i],conv); + ConvertUnit(*conv.proj.UnitsInContext->Units[i],conv); } } @@ -608,9 +608,9 @@ void ConvertColor(aiColor4D& out, const IFC::IfcColourRgb& in) } // ------------------------------------------------------------------------------------------------ -void ConvertColor(aiColor4D& out, const IFC::IfcColourOrFactor* in,ConversionData& conv,const aiColor4D* base) +void ConvertColor(aiColor4D& out, const IFC::IfcColourOrFactor& in,ConversionData& conv,const aiColor4D* base) { - if (const EXPRESS::REAL* const r = in->ToPtr()) { + if (const EXPRESS::REAL* const r = in.ToPtr()) { out.r = out.g = out.b = *r; if(base) { out.r *= base->r; @@ -620,7 +620,7 @@ void ConvertColor(aiColor4D& out, const IFC::IfcColourOrFactor* in,ConversionDat } else out.a = 1.0; } - else if (const IFC::IfcColourRgb* const rgb = in->ResolveSelectPtr(conv.db)) { + else if (const IFC::IfcColourRgb* const rgb = in.ResolveSelectPtr(conv.db)) { ConvertColor(out,*rgb); } else { @@ -2108,7 +2108,7 @@ void FillMaterial(MaterialHelper* mat,const IFC::IfcSurfaceStyle* surf,Conversio mat->AddProperty(&name,AI_MATKEY_NAME); // now see which kinds of surface information are present - BOOST_FOREACH(const IFC::IfcSurfaceStyleElementSelect* sel2, surf->Styles) { + BOOST_FOREACH(boost::shared_ptr< const IFC::IfcSurfaceStyleElementSelect > sel2, surf->Styles) { if (const IFC::IfcSurfaceStyleShading* shade = sel2->ResolveSelectPtr(conv.db)) { aiColor4D col_base,col; @@ -2123,22 +2123,22 @@ void FillMaterial(MaterialHelper* mat,const IFC::IfcSurfaceStyle* surf,Conversio } if (ren->DiffuseColour) { - ConvertColor(col, ren->DiffuseColour.Get(),conv,&col_base); + ConvertColor(col, *ren->DiffuseColour.Get(),conv,&col_base); mat->AddProperty(&col,1, AI_MATKEY_COLOR_DIFFUSE); } if (ren->SpecularColour) { - ConvertColor(col, ren->SpecularColour.Get(),conv,&col_base); + ConvertColor(col, *ren->SpecularColour.Get(),conv,&col_base); mat->AddProperty(&col,1, AI_MATKEY_COLOR_SPECULAR); } if (ren->TransmissionColour) { - ConvertColor(col, ren->TransmissionColour.Get(),conv,&col_base); + ConvertColor(col, *ren->TransmissionColour.Get(),conv,&col_base); mat->AddProperty(&col,1, AI_MATKEY_COLOR_TRANSPARENT); } if (ren->ReflectionColour) { - ConvertColor(col, ren->ReflectionColour.Get(),conv,&col_base); + ConvertColor(col, *ren->ReflectionColour.Get(),conv,&col_base); mat->AddProperty(&col,1, AI_MATKEY_COLOR_REFLECTIVE); } @@ -2185,7 +2185,7 @@ unsigned int ProcessMaterials(const IFC::IfcRepresentationItem& item, Conversion for(;range.first != range.second; ++range.first) { if(const IFC::IfcStyledItem* const styled = conv.db.GetObject((*range.first).second)->ToPtr()) { BOOST_FOREACH(const IFC::IfcPresentationStyleAssignment& as, styled->Styles) { - BOOST_FOREACH(const IFC::IfcPresentationStyleSelect* sel, as.Styles) { + BOOST_FOREACH(boost::shared_ptr sel, as.Styles) { if (const IFC::IfcSurfaceStyle* const surf = sel->ResolveSelectPtr(conv.db)) { const std::string side = static_cast(surf->Side); @@ -2237,7 +2237,7 @@ bool ProcessGeometricItem(const IFC::IfcGeometricRepresentationItem& geo, std::v { TempMesh meshtmp; if(const IFC::IfcShellBasedSurfaceModel* shellmod = geo.ToPtr()) { - BOOST_FOREACH(const IFC::IfcShell* shell,shellmod->SbsmBoundary) { + BOOST_FOREACH(boost::shared_ptr shell,shellmod->SbsmBoundary) { try { const EXPRESS::ENTITY& e = shell->To(); const IFC::IfcConnectedFaceSet& fs = conv.db.MustGetObject(e).To(); @@ -2589,6 +2589,9 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IFC::IfcProduct& el, Conve // ------------------------------------------------------------------------------------------------ void ProcessSpatialStructures(ConversionData& conv) { + // XXX add support for multiple sites (i.e. IfcSpatialStructureElements with composition == COMPLEX) + + // process all products in the file. it is reasonable to assume that a // file that is relevant for us contains at least a site or a building. const STEP::DB::ObjectMapByType& map = conv.db.GetObjectsByType(); @@ -2634,6 +2637,17 @@ void ProcessSpatialStructures(ConversionData& conv) } } + + IFCImporter::LogWarn("failed to determine primary site element, taking the first IfcSite"); + BOOST_FOREACH(const STEP::LazyObject* lz, *range) { + const IFC::IfcSpatialStructureElement* const prod = lz->ToPtr(); + if(!prod) { + continue; + } + + conv.out->mRootNode = ProcessSpatialStructure(NULL,*prod,conv,NULL); + return; + } IFCImporter::ThrowException("failed to determine primary site element"); } diff --git a/code/IFCReaderGen.cpp b/code/IFCReaderGen.cpp index 2d5245e56..14f0ef898 100644 --- a/code/IFCReaderGen.cpp +++ b/code/IFCReaderGen.cpp @@ -1057,29 +1057,29 @@ template <> size_t GenericFill(const DB& db, const LIST& params, IfcRoo { size_t base = 0; if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcRoot"); } do { // convert the 'GlobalId' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->GlobalId, *arg, db ); break; } + try { GenericConvert( in->GlobalId, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcRoot to be a `IfcGloballyUniqueId`")); } } while(0); do { // convert the 'OwnerHistory' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - try { GenericConvert( in->OwnerHistory, *arg, db ); break; } + try { GenericConvert( in->OwnerHistory, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcRoot to be a `IfcOwnerHistory`")); } } while(0); do { // convert the 'Name' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Name, *arg, db ); break; } + try { GenericConvert( in->Name, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcRoot to be a `IfcLabel`")); } } while(0); do { // convert the 'Description' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[3]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Description, *arg, db ); break; } + try { GenericConvert( in->Description, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcRoot to be a `IfcText`")); } } while(0); return base; @@ -1130,10 +1130,10 @@ template <> size_t GenericFill(const DB& db, const LIST& params, IfcO { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to IfcObject"); } do { // convert the 'ObjectType' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->ObjectType, *arg, db ); break; } + try { GenericConvert( in->ObjectType, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcObject to be a `IfcLabel`")); } } while(0); return base; @@ -1143,17 +1143,17 @@ template <> size_t GenericFill(const DB& db, const LIST& params, Ifc { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 7) { throw STEP::TypeError("expected 7 arguments to IfcProduct"); } do { // convert the 'ObjectPlacement' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->ObjectPlacement, *arg, db ); break; } + try { GenericConvert( in->ObjectPlacement, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcProduct to be a `IfcObjectPlacement`")); } } while(0); do { // convert the 'Representation' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Representation, *arg, db ); break; } + try { GenericConvert( in->Representation, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 6 to IfcProduct to be a `IfcProductRepresentation`")); } } while(0); return base; @@ -1196,10 +1196,10 @@ template <> size_t GenericFill(const DB& db, const LIST& params, Ifc { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 8) { throw STEP::TypeError("expected 8 arguments to IfcElement"); } do { // convert the 'Tag' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Tag, *arg, db ); break; } + try { GenericConvert( in->Tag, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 7 to IfcElement to be a `IfcIdentifier`")); } } while(0); return base; @@ -1312,15 +1312,15 @@ template <> size_t GenericFill(const DB& db, const LIST& para { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcHalfSpaceSolid"); } do { // convert the 'BaseSurface' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->BaseSurface, *arg, db ); break; } + try { GenericConvert( in->BaseSurface, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcHalfSpaceSolid to be a `IfcSurface`")); } } while(0); do { // convert the 'AgreementFlag' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - try { GenericConvert( in->AgreementFlag, *arg, db ); break; } + try { GenericConvert( in->AgreementFlag, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcHalfSpaceSolid to be a `BOOLEAN`")); } } while(0); return base; @@ -1330,13 +1330,13 @@ template <> size_t GenericFill(const DB& db, const { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcPolygonalBoundedHalfSpace"); } do { // convert the 'Position' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Position, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Position, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcPolygonalBoundedHalfSpace to be a `IfcAxis2Placement3D`")); } } while(0); do { // convert the 'PolygonalBoundary' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->PolygonalBoundary, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->PolygonalBoundary, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcPolygonalBoundedHalfSpace to be a `IfcBoundedCurve`")); } } while(0); return base; @@ -1367,29 +1367,29 @@ template <> size_t GenericFill(const DB& db, const LIST& para { size_t base = 0; if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcRepresentation"); } do { // convert the 'ContextOfItems' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->ContextOfItems, *arg, db ); break; } + try { GenericConvert( in->ContextOfItems, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcRepresentation to be a `IfcRepresentationContext`")); } } while(0); do { // convert the 'RepresentationIdentifier' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->RepresentationIdentifier, *arg, db ); break; } + try { GenericConvert( in->RepresentationIdentifier, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcRepresentation to be a `IfcLabel`")); } } while(0); do { // convert the 'RepresentationType' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->RepresentationType, *arg, db ); break; } + try { GenericConvert( in->RepresentationType, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcRepresentation to be a `IfcLabel`")); } } while(0); do { // convert the 'Items' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[3]=true; break; } - try { GenericConvert( in->Items, *arg, db ); break; } + try { GenericConvert( in->Items, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcRepresentation to be a `SET [1:?] OF IfcRepresentationItem`")); } } while(0); return base; @@ -1413,21 +1413,21 @@ template <> size_t GenericFill(const DB& db, const LIST& param { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcBooleanResult"); } do { // convert the 'Operator' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Operator, *arg, db ); break; } + try { GenericConvert( in->Operator, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcBooleanResult to be a `IfcBooleanOperator`")); } } while(0); do { // convert the 'FirstOperand' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - try { GenericConvert( in->FirstOperand, *arg, db ); break; } + try { GenericConvert( in->FirstOperand, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcBooleanResult to be a `IfcBooleanOperand`")); } } while(0); do { // convert the 'SecondOperand' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; } - try { GenericConvert( in->SecondOperand, *arg, db ); break; } + try { GenericConvert( in->SecondOperand, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcBooleanResult to be a `IfcBooleanOperand`")); } } while(0); return base; @@ -1511,9 +1511,9 @@ template <> size_t GenericFill(const DB& db, const LIST& params, I { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcPlacement"); } do { // convert the 'Location' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Location, *arg, db ); break; } + try { GenericConvert( in->Location, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcPlacement to be a `IfcCartesianPoint`")); } } while(0); return base; @@ -1523,16 +1523,16 @@ template <> size_t GenericFill(const DB& db, const LIST& params, { size_t base = 0; if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcProfileDef"); } do { // convert the 'ProfileType' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->ProfileType, *arg, db ); break; } + try { GenericConvert( in->ProfileType, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcProfileDef to be a `IfcProfileTypeEnum`")); } } while(0); do { // convert the 'ProfileName' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->ProfileName, *arg, db ); break; } + try { GenericConvert( in->ProfileName, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcProfileDef to be a `IfcLabel`")); } } while(0); return base; @@ -1542,9 +1542,9 @@ template <> size_t GenericFill(const DB& db, const { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcArbitraryClosedProfileDef"); } do { // convert the 'OuterCurve' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->OuterCurve, *arg, db ); break; } + try { GenericConvert( in->OuterCurve, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcArbitraryClosedProfileDef to be a `IfcCurve`")); } } while(0); return base; @@ -1574,9 +1574,9 @@ template <> size_t GenericFill(const DB& db, const LIST& p { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcElementarySurface"); } do { // convert the 'Position' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Position, *arg, db ); break; } + try { GenericConvert( in->Position, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcElementarySurface to be a `IfcAxis2Placement3D`")); } } while(0); return base; @@ -1660,9 +1660,9 @@ template <> size_t GenericFill(const DB& db, const LIST& pa { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcConnectedFaceSet"); } do { // convert the 'CfsFaces' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->CfsFaces, *arg, db ); break; } + try { GenericConvert( in->CfsFaces, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcConnectedFaceSet to be a `SET [1:?] OF IfcFace`")); } } while(0); return base; @@ -1714,15 +1714,15 @@ template <> size_t GenericFill(const DB& db, const LIST& params, I { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcFaceBound"); } do { // convert the 'Bound' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Bound, *arg, db ); break; } + try { GenericConvert( in->Bound, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcFaceBound to be a `IfcLoop`")); } } while(0); do { // convert the 'Orientation' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - try { GenericConvert( in->Orientation, *arg, db ); break; } + try { GenericConvert( in->Orientation, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcFaceBound to be a `BOOLEAN`")); } } while(0); return base; @@ -1746,19 +1746,19 @@ template <> size_t GenericFill(const DB& db, const LIST& params, I { size_t base = 0; if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcNamedUnit"); } do { // convert the 'Dimensions' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - if (dynamic_cast(&*arg)) { + if (dynamic_cast(&*arg)) { // (hack) allow this - I found some Ifc files which violate the spec here break; } - try { GenericConvert( in->Dimensions, *arg, db ); break; } + try { GenericConvert( in->Dimensions, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcNamedUnit to be a `IfcDimensionalExponents`")); } } while(0); do { // convert the 'UnitType' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - try { GenericConvert( in->UnitType, *arg, db ); break; } + try { GenericConvert( in->UnitType, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcNamedUnit to be a `IfcUnitEnum`")); } } while(0); return base; @@ -1768,13 +1768,13 @@ template <> size_t GenericFill(const DB& db, const LIST& { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcConversionBasedUnit"); } do { // convert the 'Name' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Name, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Name, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcConversionBasedUnit to be a `IfcLabel`")); } } while(0); do { // convert the 'ConversionFactor' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->ConversionFactor, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->ConversionFactor, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcConversionBasedUnit to be a `IfcMeasureWithUnit`")); } } while(0); return base; @@ -1791,8 +1791,8 @@ template <> size_t GenericFill(const DB& db, con { size_t base = 0; if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcPresentationStyleAssignment"); } do { // convert the 'Styles' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Styles, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Styles, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcPresentationStyleAssignment to be a `SET [1:?] OF IfcPresentationStyleSelect`")); } } while(0); return base; @@ -1918,9 +1918,9 @@ template <> size_t GenericFill(const DB& db, const LIST& p { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcManifoldSolidBrep"); } do { // convert the 'Outer' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Outer, *arg, db ); break; } + try { GenericConvert( in->Outer, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcManifoldSolidBrep to be a `IfcClosedShell`")); } } while(0); return base; @@ -1986,23 +1986,23 @@ template <> size_t GenericFill(const DB& db, const LIST& params, { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcStyledItem"); } do { // convert the 'Item' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Item, *arg, db ); break; } + try { GenericConvert( in->Item, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcStyledItem to be a `IfcRepresentationItem`")); } } while(0); do { // convert the 'Styles' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - try { GenericConvert( in->Styles, *arg, db ); break; } + try { GenericConvert( in->Styles, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcStyledItem to be a `SET [1:?] OF IfcPresentationStyleAssignment`")); } } while(0); do { // convert the 'Name' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Name, *arg, db ); break; } + try { GenericConvert( in->Name, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcStyledItem to be a `IfcLabel`")); } } while(0); return base; @@ -2039,9 +2039,9 @@ template <> size_t GenericFill(const DB& db, const LIST& para { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcAxis1Placement"); } do { // convert the 'Axis' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Axis, *arg, db ); break; } + try { GenericConvert( in->Axis, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcAxis1Placement to be a `IfcDirection`")); } } while(0); return base; @@ -2058,16 +2058,16 @@ template <> size_t GenericFill(const DB& db, const L { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 9) { throw STEP::TypeError("expected 9 arguments to IfcSpatialStructureElement"); } do { // convert the 'LongName' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->LongName, *arg, db ); break; } + try { GenericConvert( in->LongName, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 7 to IfcSpatialStructureElement to be a `IfcLabel`")); } } while(0); do { // convert the 'CompositionType' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - try { GenericConvert( in->CompositionType, *arg, db ); break; } + try { GenericConvert( in->CompositionType, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 8 to IfcSpatialStructureElement to be a `IfcElementCompositionEnum`")); } } while(0); return base; @@ -2077,14 +2077,14 @@ template <> size_t GenericFill(const DB& db, const LIST& params, IfcSp { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 11) { throw STEP::TypeError("expected 11 arguments to IfcSpace"); } do { // convert the 'InteriorOrExteriorSpace' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->InteriorOrExteriorSpace, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->InteriorOrExteriorSpace, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 9 to IfcSpace to be a `IfcInternalOrExternalEnum`")); } } while(0); do { // convert the 'ElevationWithFlooring' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->ElevationWithFlooring, *arg, db ); break; } + try { GenericConvert( in->ElevationWithFlooring, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 10 to IfcSpace to be a `IfcLengthMeasure`")); } } while(0); return base; @@ -2164,10 +2164,10 @@ template <> size_t GenericFill(const DB& db, const LIST& p { size_t base = 0; if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcPresentationStyle"); } do { // convert the 'Name' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Name, *arg, db ); break; } + try { GenericConvert( in->Name, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcPresentationStyle to be a `IfcLabel`")); } } while(0); return base; @@ -2212,9 +2212,9 @@ template <> size_t GenericFill(const DB& db, const L { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcParameterizedProfileDef"); } do { // convert the 'Position' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Position, *arg, db ); break; } + try { GenericConvert( in->Position, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcParameterizedProfileDef to be a `IfcAxis2Placement2D`")); } } while(0); return base; @@ -2287,15 +2287,15 @@ template <> size_t GenericFill(const DB& db, const LIST& para { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcSweptAreaSolid"); } do { // convert the 'SweptArea' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->SweptArea, *arg, db ); break; } + try { GenericConvert( in->SweptArea, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcSweptAreaSolid to be a `IfcProfileDef`")); } } while(0); do { // convert the 'Position' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - try { GenericConvert( in->Position, *arg, db ); break; } + try { GenericConvert( in->Position, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcSweptAreaSolid to be a `IfcAxis2Placement3D`")); } } while(0); return base; @@ -2305,13 +2305,13 @@ template <> size_t GenericFill(const DB& db, const LIST& p { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcExtrudedAreaSolid"); } do { // convert the 'ExtrudedDirection' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->ExtrudedDirection, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->ExtrudedDirection, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcExtrudedAreaSolid to be a `IfcDirection`")); } } while(0); do { // convert the 'Depth' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Depth, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Depth, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcExtrudedAreaSolid to be a `IfcPositiveLengthMeasure`")); } } while(0); return base; @@ -2363,15 +2363,15 @@ template <> size_t GenericFill(const DB& db, const LIST& { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to IfcRectangleProfileDef"); } do { // convert the 'XDim' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->XDim, *arg, db ); break; } + try { GenericConvert( in->XDim, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcRectangleProfileDef to be a `IfcPositiveLengthMeasure`")); } } while(0); do { // convert the 'YDim' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - try { GenericConvert( in->YDim, *arg, db ); break; } + try { GenericConvert( in->YDim, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcRectangleProfileDef to be a `IfcPositiveLengthMeasure`")); } } while(0); return base; @@ -2388,14 +2388,14 @@ template <> size_t GenericFill(const DB& db, const LIST& para { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcLocalPlacement"); } do { // convert the 'PlacementRelTo' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->PlacementRelTo, *arg, db ); break; } + try { GenericConvert( in->PlacementRelTo, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcLocalPlacement to be a `IfcObjectPlacement`")); } } while(0); do { // convert the 'RelativePlacement' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->RelativePlacement, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->RelativePlacement, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcLocalPlacement to be a `IfcAxis2Placement`")); } } while(0); return base; @@ -2419,9 +2419,9 @@ template <> size_t GenericFill(const DB& db, const LIST& params, IfcFac { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcFace"); } do { // convert the 'Bounds' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Bounds, *arg, db ); break; } + try { GenericConvert( in->Bounds, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcFace to be a `SET [1:?] OF IfcFaceBound`")); } } while(0); return base; @@ -2466,9 +2466,9 @@ template <> size_t GenericFill(const DB& db, const LIST& pa { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcCircleProfileDef"); } do { // convert the 'Radius' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Radius, *arg, db ); break; } + try { GenericConvert( in->Radius, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcCircleProfileDef to be a `IfcPositiveLengthMeasure`")); } } while(0); return base; @@ -2506,30 +2506,30 @@ template <> size_t GenericFill(const DB& db, { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcCartesianTransformationOperator"); } do { // convert the 'Axis1' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Axis1, *arg, db ); break; } + try { GenericConvert( in->Axis1, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcCartesianTransformationOperator to be a `IfcDirection`")); } } while(0); do { // convert the 'Axis2' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Axis2, *arg, db ); break; } + try { GenericConvert( in->Axis2, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcCartesianTransformationOperator to be a `IfcDirection`")); } } while(0); do { // convert the 'LocalOrigin' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; } - try { GenericConvert( in->LocalOrigin, *arg, db ); break; } + try { GenericConvert( in->LocalOrigin, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcCartesianTransformationOperator to be a `IfcCartesianPoint`")); } } while(0); do { // convert the 'Scale' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[3]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Scale, *arg, db ); break; } + try { GenericConvert( in->Scale, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcCartesianTransformationOperator to be a `REAL`")); } } while(0); return base; @@ -2553,14 +2553,14 @@ template <> size_t GenericFill(const DB& db, const LIST& params, IfcS { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcSIUnit"); } do { // convert the 'Prefix' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Prefix, *arg, db ); break; } + try { GenericConvert( in->Prefix, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcSIUnit to be a `IfcSIPrefix`")); } } while(0); do { // convert the 'Name' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Name, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Name, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcSIUnit to be a `IfcSIUnitName`")); } } while(0); return base; @@ -2570,13 +2570,13 @@ template <> size_t GenericFill(const DB& db, const LIST& par { size_t base = 0; if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcMeasureWithUnit"); } do { // convert the 'ValueComponent' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->ValueComponent, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->ValueComponent, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcMeasureWithUnit to be a `IfcValue`")); } } while(0); do { // convert the 'UnitComponent' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->UnitComponent, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->UnitComponent, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcMeasureWithUnit to be a `IfcUnit`")); } } while(0); return base; @@ -2649,13 +2649,13 @@ template <> size_t GenericFill(const DB& db, const LIST& par { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 6) { throw STEP::TypeError("expected 6 arguments to IfcRelVoidsElement"); } do { // convert the 'RelatingBuildingElement' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->RelatingBuildingElement, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->RelatingBuildingElement, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcRelVoidsElement to be a `IfcElement`")); } } while(0); do { // convert the 'RelatedOpeningElement' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->RelatedOpeningElement, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->RelatedOpeningElement, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcRelVoidsElement to be a `IfcFeatureElementSubtraction`")); } } while(0); return base; @@ -2693,9 +2693,9 @@ template <> size_t GenericFill(const DB& db, const LIST& pa { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcAxis2Placement2D"); } do { // convert the 'RefDirection' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->RefDirection, *arg, db ); break; } + try { GenericConvert( in->RefDirection, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcAxis2Placement2D to be a `IfcDirection`")); } } while(0); return base; @@ -2733,8 +2733,8 @@ template <> size_t GenericFill(const DB& db, const { size_t base = 0; if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcSurfaceStyleWithTextures"); } do { // convert the 'Textures' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Textures, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Textures, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcSurfaceStyleWithTextures to be a `LIST [1:?] OF IfcSurfaceTexture`")); } } while(0); return base; @@ -2828,10 +2828,10 @@ template <> size_t GenericFill(const DB& d { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to IfcCartesianTransformationOperator3D"); } do { // convert the 'Axis3' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Axis3, *arg, db ); break; } + try { GenericConvert( in->Axis3, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcCartesianTransformationOperator3D to be a `IfcDirection`")); } } while(0); return base; @@ -2841,15 +2841,15 @@ template <> size_t GenericFill(c { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 7) { throw STEP::TypeError("expected 7 arguments to IfcCartesianTransformationOperator3DnonUniform"); } do { // convert the 'Scale2' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Scale2, *arg, db ); break; } + try { GenericConvert( in->Scale2, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcCartesianTransformationOperator3DnonUniform to be a `REAL`")); } } while(0); do { // convert the 'Scale3' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Scale3, *arg, db ); break; } + try { GenericConvert( in->Scale3, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 6 to IfcCartesianTransformationOperator3DnonUniform to be a `REAL`")); } } while(0); return base; @@ -2880,17 +2880,17 @@ template <> size_t GenericFill(const DB& db, const LIS { size_t base = 0; if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcRepresentationContext"); } do { // convert the 'ContextIdentifier' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->ContextIdentifier, *arg, db ); break; } + try { GenericConvert( in->ContextIdentifier, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcRepresentationContext to be a `IfcLabel`")); } } while(0); do { // convert the 'ContextType' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->ContextType, *arg, db ); break; } + try { GenericConvert( in->ContextType, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcRepresentationContext to be a `IfcLabel`")); } } while(0); return base; @@ -2900,29 +2900,29 @@ template <> size_t GenericFill(const DB& db, { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 6) { throw STEP::TypeError("expected 6 arguments to IfcGeometricRepresentationContext"); } do { // convert the 'CoordinateSpaceDimension' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->CoordinateSpaceDimension, *arg, db ); break; } + try { GenericConvert( in->CoordinateSpaceDimension, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcGeometricRepresentationContext to be a `IfcDimensionCount`")); } } while(0); do { // convert the 'Precision' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Precision, *arg, db ); break; } + try { GenericConvert( in->Precision, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcGeometricRepresentationContext to be a `REAL`")); } } while(0); do { // convert the 'WorldCoordinateSystem' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; } - try { GenericConvert( in->WorldCoordinateSystem, *arg, db ); break; } + try { GenericConvert( in->WorldCoordinateSystem, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcGeometricRepresentationContext to be a `IfcAxis2Placement`")); } } while(0); do { // convert the 'TrueNorth' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[3]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->TrueNorth, *arg, db ); break; } + try { GenericConvert( in->TrueNorth, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcGeometricRepresentationContext to be a `IfcDirection`")); } } while(0); return base; @@ -3029,9 +3029,9 @@ template <> size_t GenericFill(const DB& db, const LIST& { size_t base = 0; if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcSurfaceStyleShading"); } do { // convert the 'SurfaceColour' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->SurfaceColour, *arg, db ); break; } + try { GenericConvert( in->SurfaceColour, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcSurfaceStyleShading to be a `IfcColourRgb`")); } } while(0); return base; @@ -3041,50 +3041,50 @@ template <> size_t GenericFill(const DB& db, const LIS { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 9) { throw STEP::TypeError("expected 9 arguments to IfcSurfaceStyleRendering"); } do { // convert the 'Transparency' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Transparency, *arg, db ); break; } + try { GenericConvert( in->Transparency, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcSurfaceStyleRendering to be a `IfcNormalisedRatioMeasure`")); } } while(0); do { // convert the 'DiffuseColour' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->DiffuseColour, *arg, db ); break; } + try { GenericConvert( in->DiffuseColour, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcSurfaceStyleRendering to be a `IfcColourOrFactor`")); } } while(0); do { // convert the 'TransmissionColour' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->TransmissionColour, *arg, db ); break; } + try { GenericConvert( in->TransmissionColour, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcSurfaceStyleRendering to be a `IfcColourOrFactor`")); } } while(0); do { // convert the 'DiffuseTransmissionColour' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->DiffuseTransmissionColour, *arg, db ); break; } + try { GenericConvert( in->DiffuseTransmissionColour, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcSurfaceStyleRendering to be a `IfcColourOrFactor`")); } } while(0); do { // convert the 'ReflectionColour' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->ReflectionColour, *arg, db ); break; } + try { GenericConvert( in->ReflectionColour, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcSurfaceStyleRendering to be a `IfcColourOrFactor`")); } } while(0); do { // convert the 'SpecularColour' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->SpecularColour, *arg, db ); break; } + try { GenericConvert( in->SpecularColour, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 6 to IfcSurfaceStyleRendering to be a `IfcColourOrFactor`")); } } while(0); do { // convert the 'SpecularHighlight' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->SpecularHighlight, *arg, db ); break; } + try { GenericConvert( in->SpecularHighlight, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 7 to IfcSurfaceStyleRendering to be a `IfcSpecularHighlightSelect`")); } } while(0); do { // convert the 'ReflectanceMethod' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->ReflectanceMethod, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->ReflectanceMethod, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 8 to IfcSurfaceStyleRendering to be a `IfcReflectanceMethodEnum`")); } } while(0); return base; @@ -3094,8 +3094,8 @@ template <> size_t GenericFill(const DB& db, const LI { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 5) { throw STEP::TypeError("expected 5 arguments to IfcCircleHollowProfileDef"); } do { // convert the 'WallThickness' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->WallThickness, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->WallThickness, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcCircleHollowProfileDef to be a `IfcPositiveLengthMeasure`")); } } while(0); return base; @@ -3126,23 +3126,23 @@ template <> size_t GenericFill(const DB& db, const LIS { size_t base = 0; if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcProductRepresentation"); } do { // convert the 'Name' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Name, *arg, db ); break; } + try { GenericConvert( in->Name, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcProductRepresentation to be a `IfcLabel`")); } } while(0); do { // convert the 'Description' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Description, *arg, db ); break; } + try { GenericConvert( in->Description, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcProductRepresentation to be a `IfcText`")); } } while(0); do { // convert the 'Representations' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[2]=true; break; } - try { GenericConvert( in->Representations, *arg, db ); break; } + try { GenericConvert( in->Representations, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcProductRepresentation to be a `LIST [1:?] OF IfcRepresentation`")); } } while(0); return base; @@ -3242,13 +3242,13 @@ template <> size_t GenericFill(const DB& db, const LIST& params { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcSurfaceStyle"); } do { // convert the 'Side' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Side, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Side, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcSurfaceStyle to be a `IfcSurfaceSide`")); } } while(0); do { // convert the 'Styles' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Styles, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Styles, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcSurfaceStyle to be a `SET [1:5] OF IfcSurfaceStyleElementSelect`")); } } while(0); return base; @@ -3293,8 +3293,8 @@ template <> size_t GenericFill(const DB& db, const LIST& params, If { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcPolyLoop"); } do { // convert the 'Polygon' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Polygon, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Polygon, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcPolyLoop to be a `LIST [3:?] OF IfcCartesianPoint`")); } } while(0); return base; @@ -3388,15 +3388,15 @@ template <> size_t GenericFill(const DB& db, const LIST& param { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 6) { throw STEP::TypeError("expected 6 arguments to IfcRelDecomposes"); } do { // convert the 'RelatingObject' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->RelatingObject, *arg, db ); break; } + try { GenericConvert( in->RelatingObject, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcRelDecomposes to be a `IfcObjectDefinition`")); } } while(0); do { // convert the 'RelatedObjects' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[1]=true; break; } - try { GenericConvert( in->RelatedObjects, *arg, db ); break; } + try { GenericConvert( in->RelatedObjects, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcRelDecomposes to be a `SET [1:?] OF IfcObjectDefinition`")); } } while(0); return base; @@ -3441,15 +3441,15 @@ template <> size_t GenericFill(const DB& db, const LIST& pa { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcAxis2Placement3D"); } do { // convert the 'Axis' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Axis, *arg, db ); break; } + try { GenericConvert( in->Axis, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcAxis2Placement3D to be a `IfcDirection`")); } } while(0); do { // convert the 'RefDirection' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->RefDirection, *arg, db ); break; } + try { GenericConvert( in->RefDirection, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcAxis2Placement3D to be a `IfcDirection`")); } } while(0); return base; @@ -3640,8 +3640,8 @@ template <> size_t GenericFill(const DB& db, const LIST& para { size_t base = 0; if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcUnitAssignment"); } do { // convert the 'Units' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Units, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Units, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcUnitAssignment to be a `SET [1:?] OF IfcUnit`")); } } while(0); return base; @@ -3658,8 +3658,8 @@ template <> size_t GenericFill(const DB& db, const LI { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcShellBasedSurfaceModel"); } do { // convert the 'SbsmBoundary' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->SbsmBoundary, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->SbsmBoundary, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcShellBasedSurfaceModel to be a `SET [1:?] OF IfcShell`")); } } while(0); return base; @@ -3697,13 +3697,13 @@ template <> size_t GenericFill(const DB& db, { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 6) { throw STEP::TypeError("expected 6 arguments to IfcRelContainedInSpatialStructure"); } do { // convert the 'RelatedElements' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->RelatedElements, *arg, db ); break; } - catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcRelContainedInSpatialStructure to be a `SET [0:?] OF IfcProduct`")); } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->RelatedElements, arg, db ); break; } + catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 4 to IfcRelContainedInSpatialStructure to be a `SET [1:?] OF IfcProduct`")); } } while(0); do { // convert the 'RelatingStructure' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->RelatingStructure, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->RelatingStructure, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcRelContainedInSpatialStructure to be a `IfcSpatialStructureElement`")); } } while(0); return base; @@ -3720,25 +3720,25 @@ template <> size_t GenericFill(const DB& db, const LIST& params, Ifc { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 9) { throw STEP::TypeError("expected 9 arguments to IfcProject"); } do { // convert the 'LongName' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->LongName, *arg, db ); break; } + try { GenericConvert( in->LongName, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 5 to IfcProject to be a `IfcLabel`")); } } while(0); do { // convert the 'Phase' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Phase, *arg, db ); break; } + try { GenericConvert( in->Phase, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 6 to IfcProject to be a `IfcLabel`")); } } while(0); do { // convert the 'RepresentationContexts' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->RepresentationContexts, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->RepresentationContexts, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 7 to IfcProject to be a `SET [1:?] OF IfcRepresentationContext`")); } } while(0); do { // convert the 'UnitsInContext' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->UnitsInContext, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->UnitsInContext, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 8 to IfcProject to be a `IfcUnitAssignment`")); } } while(0); return base; @@ -3748,8 +3748,8 @@ template <> size_t GenericFill(const DB& db, const LIST& para { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcCartesianPoint"); } do { // convert the 'Coordinates' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Coordinates, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Coordinates, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcCartesianPoint to be a `LIST [1:3] OF IfcLengthMeasure`")); } } while(0); return base; @@ -3821,10 +3821,10 @@ template <> size_t GenericFill(const DB& db, const LIST& { size_t base = 0; if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcColourSpecification"); } do { // convert the 'Name' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->Name, *arg, db ); break; } + try { GenericConvert( in->Name, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcColourSpecification to be a `IfcLabel`")); } } while(0); return base; @@ -3834,18 +3834,18 @@ template <> size_t GenericFill(const DB& db, const LIST& params, I { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcColourRgb"); } do { // convert the 'Red' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Red, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Red, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcColourRgb to be a `IfcNormalisedRatioMeasure`")); } } while(0); do { // convert the 'Green' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Green, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Green, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcColourRgb to be a `IfcNormalisedRatioMeasure`")); } } while(0); do { // convert the 'Blue' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Blue, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Blue, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcColourRgb to be a `IfcNormalisedRatioMeasure`")); } } while(0); return base; @@ -4177,13 +4177,13 @@ template <> size_t GenericFill(const DB& db, const LIST& params, { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcMappedItem"); } do { // convert the 'MappingSource' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->MappingSource, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->MappingSource, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcMappedItem to be a `IfcRepresentationMap`")); } } while(0); do { // convert the 'MappingTarget' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->MappingTarget, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->MappingTarget, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcMappedItem to be a `IfcCartesianTransformationOperator`")); } } while(0); return base; @@ -4193,8 +4193,8 @@ template <> size_t GenericFill(const DB& db, const LIST& params, I { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcDirection"); } do { // convert the 'DirectionRatios' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->DirectionRatios, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->DirectionRatios, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcDirection to be a `LIST [2:3] OF REAL`")); } } while(0); return base; @@ -4239,9 +4239,9 @@ template <> size_t GenericFill(const DB& db, const L { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 3) { throw STEP::TypeError("expected 3 arguments to IfcArbitraryOpenProfileDef"); } do { // convert the 'Curve' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) { in->ObjectHelper::aux_is_derived[0]=true; break; } - try { GenericConvert( in->Curve, *arg, db ); break; } + try { GenericConvert( in->Curve, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcArbitraryOpenProfileDef to be a `IfcBoundedCurve`")); } } while(0); return base; @@ -4293,13 +4293,13 @@ template <> size_t GenericFill(const DB& db, const LIST& p { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 4) { throw STEP::TypeError("expected 4 arguments to IfcRevolvedAreaSolid"); } do { // convert the 'Axis' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Axis, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Axis, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 2 to IfcRevolvedAreaSolid to be a `IfcAxis1Placement`")); } } while(0); do { // convert the 'Angle' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Angle, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Angle, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 3 to IfcRevolvedAreaSolid to be a `IfcPlaneAngleMeasure`")); } } while(0); return base; @@ -4309,15 +4309,15 @@ template <> size_t GenericFill(const DB& db, const LIST& params, IfcDoo { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 10) { throw STEP::TypeError("expected 10 arguments to IfcDoor"); } do { // convert the 'OverallHeight' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->OverallHeight, *arg, db ); break; } + try { GenericConvert( in->OverallHeight, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 8 to IfcDoor to be a `IfcPositiveLengthMeasure`")); } } while(0); do { // convert the 'OverallWidth' argument - const DataType* arg = params[base++]; + boost::shared_ptr arg = params[base++]; if (dynamic_cast(&*arg)) break; - try { GenericConvert( in->OverallWidth, *arg, db ); break; } + try { GenericConvert( in->OverallWidth, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 9 to IfcDoor to be a `IfcPositiveLengthMeasure`")); } } while(0); return base; @@ -4480,8 +4480,8 @@ template <> size_t GenericFill(const DB& db, const LIST& params, If { size_t base = GenericFill(db,params,static_cast(in)); if (params.GetSize() < 1) { throw STEP::TypeError("expected 1 arguments to IfcPolyline"); } do { // convert the 'Points' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->Points, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->Points, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcPolyline to be a `LIST [2:?] OF IfcCartesianPoint`")); } } while(0); return base; @@ -4568,13 +4568,13 @@ template <> size_t GenericFill(const DB& db, const LIST& p { size_t base = 0; if (params.GetSize() < 2) { throw STEP::TypeError("expected 2 arguments to IfcRepresentationMap"); } do { // convert the 'MappingOrigin' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->MappingOrigin, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->MappingOrigin, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 0 to IfcRepresentationMap to be a `IfcAxis2Placement`")); } } while(0); do { // convert the 'MappedRepresentation' argument - const DataType* arg = params[base++]; - try { GenericConvert( in->MappedRepresentation, *arg, db ); break; } + boost::shared_ptr arg = params[base++]; + try { GenericConvert( in->MappedRepresentation, arg, db ); break; } catch (const TypeError& t) { throw TypeError(t.what() + std::string(" - expected argument 1 to IfcRepresentationMap to be a `IfcRepresentation`")); } } while(0); return base; diff --git a/code/IFCReaderGen.h b/code/IFCReaderGen.h index 3101adf4c..d2f979e46 100644 --- a/code/IFCReaderGen.h +++ b/code/IFCReaderGen.h @@ -3113,7 +3113,7 @@ namespace IFC { // C++ wrapper for IfcRelContainedInSpatialStructure struct IfcRelContainedInSpatialStructure : IfcRelConnects, ObjectHelper { IfcRelContainedInSpatialStructure() : Object("IfcRelContainedInSpatialStructure") {} - ListOf< Lazy< IfcProduct >, 0, 0 > RelatedElements; + ListOf< Lazy< IfcProduct >, 1, 0 > RelatedElements; Lazy< IfcSpatialStructureElement > RelatingStructure; }; diff --git a/code/STEPFile.h b/code/STEPFile.h index b3be88f86..93b99d6e2 100644 --- a/code/STEPFile.h +++ b/code/STEPFile.h @@ -159,7 +159,7 @@ namespace STEP { { public: - typedef const DataType* Out; + typedef boost::shared_ptr Out; public: @@ -326,18 +326,10 @@ namespace STEP { // ------------------------------------------------------------------------------- class LIST : public DataType { - public: - - ~LIST() { - BOOST_FOREACH(const DataType* dt, members) { - delete dt; - } - } - public: // access a particular list index, throw std::range_error for wrong indices - const DataType* operator[] (size_t index) const { + boost::shared_ptr operator[] (size_t index) const { return members[index]; } @@ -354,8 +346,7 @@ namespace STEP { private: - // no smart pointer type to avoid any overhead - typedef std::vector< const DataType* > MemberList; + typedef std::vector< boost::shared_ptr > MemberList; MemberList members; }; @@ -735,14 +726,14 @@ namespace STEP { typedef EXPRESS::ENTITY Type; }; - template <> struct PickBaseType; + template <> struct PickBaseType< boost::shared_ptr< const EXPRESS::DataType > >; // ------------------------------------------------------------------------------ template struct InternGenericConvert { - void operator()(T& out, const EXPRESS::DataType& in, const STEP::DB& db) { + void operator()(T& out, boost::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& db) { try{ - out = dynamic_cast< const typename PickBaseType::Type& > ( in ); + out = dynamic_cast< const typename PickBaseType::Type& > ( *in ); } catch(std::bad_cast&) { throw TypeError("type error reading literal field"); @@ -751,15 +742,15 @@ namespace STEP { }; template <> - struct InternGenericConvert { - void operator()(const EXPRESS::DataType*& out, const EXPRESS::DataType& in, const STEP::DB& db) { - out = ∈ + struct InternGenericConvert< boost::shared_ptr< const EXPRESS::DataType > > { + void operator()(boost::shared_ptr< const EXPRESS::DataType >& out, boost::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& db) { + out = in; } }; template struct InternGenericConvert< Maybe > { - void operator()(Maybe& out, const EXPRESS::DataType& in, const STEP::DB& db) { + void operator()(Maybe& out, boost::shared_ptr< const EXPRESS::DataType >& in, const STEP::DB& db) { GenericConvert((T&)out,in,db); out.flag_valid(); } @@ -767,20 +758,19 @@ namespace STEP { template struct InternGenericConvertList { - void operator()(ListOf& out, const EXPRESS::DataType& inp_base, const STEP::DB& db) { + void operator()(ListOf& out, boost::shared_ptr< const EXPRESS::DataType >& inp_base, const STEP::DB& db) { - const EXPRESS::LIST* inp = dynamic_cast(&inp_base); + const EXPRESS::LIST* inp = dynamic_cast(inp_base.get()); if (!inp) { throw TypeError("type error reading aggregate"); } - // XXX is this really how the EXPRESS notation ([?:3],[1:3]) .. works? - // too many is warning, too few is critical error because the user won't validate this + // XXX is this really how the EXPRESS notation ([?:3],[1:3]) is intended? if (max_cnt && inp->GetSize() > max_cnt) { DefaultLogger::get()->warn("too many aggregate elements"); } else if (inp->GetSize() < min_cnt) { - throw TypeError("too few aggregate elements"); + DefaultLogger::get()->warn("too few aggregate elements"); } out.reserve(inp->GetSize()); @@ -788,7 +778,7 @@ namespace STEP { out.push_back( typename ListOf::OutScalar() ); try{ - GenericConvert(out.back(),*(*inp)[i], db); + GenericConvert(out.back(),(*inp)[i], db); } catch(const TypeError& t) { throw TypeError(t.what() +std::string(" of aggregate")); @@ -799,8 +789,8 @@ namespace STEP { template struct InternGenericConvert< Lazy > { - void operator()(Lazy& out, const EXPRESS::DataType& in_base, const STEP::DB& db) { - const EXPRESS::ENTITY* in = dynamic_cast(&in_base); + void operator()(Lazy& out, boost::shared_ptr< const EXPRESS::DataType >& in_base, const STEP::DB& db) { + const EXPRESS::ENTITY* in = dynamic_cast(in_base.get()); if (!in) { throw TypeError("type error reading entity"); } @@ -809,12 +799,12 @@ namespace STEP { }; template - inline void GenericConvert(T1& a, const EXPRESS::DataType& b, const STEP::DB& db) { + inline void GenericConvert(T1& a, boost::shared_ptr< const EXPRESS::DataType >& b, const STEP::DB& db) { return InternGenericConvert()(a,b,db); } template - inline void GenericConvert(ListOf& a, const EXPRESS::DataType& b, const STEP::DB& db) { + inline void GenericConvert(ListOf& a, boost::shared_ptr< const EXPRESS::DataType >& b, const STEP::DB& db) { return InternGenericConvertList()(a,b,db); } diff --git a/code/STEPFileReader.cpp b/code/STEPFileReader.cpp index 91c7b8333..4b7d2f3b7 100644 --- a/code/STEPFileReader.cpp +++ b/code/STEPFileReader.cpp @@ -136,7 +136,7 @@ STEP::DB* STEP::ReadFileHeader(boost::shared_ptr stream) // two nested lists. const EXPRESS::LIST* list = dynamic_cast(schema.get()); if (list && list->GetSize()) { - list = dynamic_cast( (*list)[0] ); + list = dynamic_cast( (*list)[0].get() ); if (!list) { throw STEP::SyntaxError("expected FILE_SCHEMA to be a list",line); } @@ -146,7 +146,7 @@ STEP::DB* STEP::ReadFileHeader(boost::shared_ptr stream) DefaultLogger::get()->warn(AddLineNumber("multiple schemas currently not supported",line)); } const EXPRESS::STRING* string; - if (!list->GetSize() || !(string=dynamic_cast( (*list)[0] ))) { + if (!list->GetSize() || !(string=dynamic_cast( (*list)[0].get() ))) { throw STEP::SyntaxError("expected FILE_SCHEMA to contain a single string literal",line); } head.fileSchema = *string; @@ -390,7 +390,7 @@ const EXPRESS::LIST* EXPRESS::LIST::Parse(const char*& inout,uint64_t line, cons break; } - members.push_back( EXPRESS::DataType::Parse(cur,line,schema)); + members.push_back( boost::shared_ptr (EXPRESS::DataType::Parse(cur,line,schema))); SkipSpaces(cur,&cur); if (*cur != ',') { @@ -479,7 +479,7 @@ void STEP::LazyObject::LazyInit() const // store the original id in the object instance obj->SetID(id); - //delete conv_args; - //conv_args = NULL; + delete conv_args; + conv_args = NULL; } diff --git a/scripts/IFCImporter/CppGenerator.py b/scripts/IFCImporter/CppGenerator.py index 4bb2dce10..cfbab8d8c 100644 --- a/scripts/IFCImporter/CppGenerator.py +++ b/scripts/IFCImporter/CppGenerator.py @@ -79,7 +79,7 @@ template_converter_prologue_a = '\tsize_t base = GenericFill(db,params,static_ca template_converter_prologue_b = '\tsize_t base = 0;\n' template_converter_check_argcnt = '\tif (params.GetSize() < {max_arg}) {{ throw STEP::TypeError("expected {max_arg} arguments to {name}"); }}' template_converter_code_per_field = r""" do {{ // convert the '{fieldname}' argument - const DataType* arg = params[base++];{handle_unset}{convert} + boost::shared_ptr arg = params[base++];{handle_unset}{convert} }} while(0); """ template_allow_optional = r""" @@ -87,7 +87,7 @@ template_allow_optional = r""" template_allow_derived = r""" if (dynamic_cast(&*arg)) {{ in->ObjectHelper::aux_is_derived[{argnum}]=true; break; }}""" template_convert_single = r""" - try {{ GenericConvert( in->{name}, *arg, db ); break; }} + try {{ GenericConvert( in->{name}, arg, db ); break; }} catch (const TypeError& t) {{ throw TypeError(t.what() + std::string(" - expected argument {argnum} to {classname} to be a `{full_type}`")); }}""" template_converter_ommitted = '// this data structure is not used yet, so there is no code generated to fill its members\n'