Browse Source

remove unique_ptr ina local function / method.

Kim Kulling 6 years ago
parent
commit
a8fda89079
1 changed files with 12 additions and 14 deletions
  1. 12 14
      code/Importer/IFC/IFCLoader.cpp

+ 12 - 14
code/Importer/IFC/IFCLoader.cpp

@@ -659,8 +659,8 @@ void ProcessMetadata(uint64_t relDefinesByPropertiesID, ConversionData& conv, Me
 }
 
 // ------------------------------------------------------------------------------------------------
-aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el, ConversionData& conv, std::vector<TempOpening>* collect_openings = NULL)
-{
+aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el, ConversionData& conv,
+        std::vector<TempOpening>* collect_openings = nullptr ) {
     const STEP::DB::RefMap& refs = conv.db.GetRefs();
 
     // skip over space and annotation nodes - usually, these have no meaning in Assimp's context
@@ -675,12 +675,12 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el
     if(conv.settings.skipAnnotations) {
         if(el.ToPtr<Schema_2x3::IfcAnnotation>()) {
             IFCImporter::LogDebug("skipping IfcAnnotation entity due to importer settings");
-            return NULL;
+            return nullptr;
         }
     }
 
     // add an output node for this spatial structure
-    std::unique_ptr<aiNode> nd(new aiNode());
+    aiNode *nd(new aiNode );
     nd->mName.Set(el.GetClassName()+"_"+(el.Name?el.Name.Get():"Unnamed")+"_"+el.GlobalId);
     nd->mParent = parent;
 
@@ -693,8 +693,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el
         if (children.first==children.second) {
             // handles single property set
             ProcessMetadata((*children.first).second, conv, properties);
-        }
-        else {
+        } else {
             // handles multiple property sets (currently all property sets are merged,
             // which may not be the best solution in the long run)
             for (STEP::DB::RefMap::const_iterator it=children.first; it!=children.second; ++it) {
@@ -751,7 +750,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el
                         continue;
                     }
 
-                    aiNode* const ndnew = ProcessSpatialStructure(nd.get(),pro,conv,NULL);
+                    aiNode* const ndnew = ProcessSpatialStructure(nd,pro,conv,nullptr);
                     if(ndnew) {
                         subnodes.push_back( ndnew );
                     }
@@ -765,7 +764,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el
                     // move opening elements to a separate node since they are semantically different than elements that are just 'contained'
                     std::unique_ptr<aiNode> nd_aggr(new aiNode());
                     nd_aggr->mName.Set("$RelVoidsElement");
-                    nd_aggr->mParent = nd.get();
+                    nd_aggr->mParent = nd;
 
                     nd_aggr->mTransformation = nd->mTransformation;
 
@@ -810,7 +809,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el
                 // move aggregate elements to a separate node since they are semantically different than elements that are just 'contained'
                 std::unique_ptr<aiNode> nd_aggr(new aiNode());
                 nd_aggr->mName.Set("$RelAggregates");
-                nd_aggr->mParent = nd.get();
+                nd_aggr->mParent = nd;
 
                 nd_aggr->mTransformation = nd->mTransformation;
 
@@ -835,8 +834,8 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el
         }
 
         if (!skipGeometry) {
-          ProcessProductRepresentation(el,nd.get(),subnodes,conv);
-          conv.apply_openings = conv.collect_openings = NULL;
+          ProcessProductRepresentation(el, nd, subnodes, conv);
+          conv.apply_openings = conv.collect_openings = nullptr;
         }
 
         if (subnodes.size()) {
@@ -846,8 +845,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el
                 nd2->mParent = nd.get();
             }
         }
-    }
-    catch(...) {
+    } catch(...) {
         // it hurts, but I don't want to pull boost::ptr_vector into -noboost only for these few spots here
         std::for_each(subnodes.begin(),subnodes.end(),delete_fun<aiNode>());
         throw;
@@ -855,7 +853,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const Schema_2x3::IfcProduct& el
 
     ai_assert(conv.already_processed.find(el.GetID()) != conv.already_processed.end());
     conv.already_processed.erase(conv.already_processed.find(el.GetID()));
-    return nd.release();
+    return nd;
 }
 
 // ------------------------------------------------------------------------------------------------