Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / GeomAPI / GeomAPI_DataMapOfShapeShape.cpp
index 166922710c2e4d7ea9c1366fba1c664c9307e36d..3ee6778eedf2fded996ceed1d0d207c5fd8634b2 100644 (file)
@@ -1,16 +1,28 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        GeomAPI_DataMapOfShapeShape.cpp
-// Created:     28 Oct 2014
-// Author:      Sergey Zaritchny
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library 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 GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
 
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_DataMapOfShapeShape.h>
 #include <TopTools_DataMapOfShapeShape.hxx>
 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
 #include <TopoDS_Shape.hxx>
-using namespace std;
-
 
 GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape()
 : GeomAPI_Interface(new TopTools_DataMapOfShapeShape){}
@@ -25,11 +37,13 @@ int GeomAPI_DataMapOfShapeShape::size()
   return implPtr<TopTools_DataMapOfShapeShape>()->Extent();
 }
 
-bool GeomAPI_DataMapOfShapeShape::bind (std::shared_ptr<GeomAPI_Shape> theKey, std::shared_ptr<GeomAPI_Shape> theItem)
+bool GeomAPI_DataMapOfShapeShape::bind(std::shared_ptr<GeomAPI_Shape> theKey,
+                                       std::shared_ptr<GeomAPI_Shape> theItem)
 {
   bool flag(false);
-  if(implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(), theItem->impl<TopoDS_Shape>()))
-  flag = true;
+  if (implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(),
+                                                    theItem->impl<TopoDS_Shape>()))
+    flag = true;
   return flag;
 }
 
@@ -42,9 +56,12 @@ void GeomAPI_DataMapOfShapeShape::merge(const GeomAPI_DataMapOfShapeShape& theDa
   }
 }
 
-void GeomAPI_DataMapOfShapeShape::merge(const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theDataMap)
+void GeomAPI_DataMapOfShapeShape::
+  merge(const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theDataMap)
 {
-  merge(*theDataMap.get());
+  if(theDataMap.get()) {
+    merge(*theDataMap.get());
+  }
 }
 
 bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey)
@@ -55,12 +72,14 @@ bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey
   return flag;
 }
 
-const std::shared_ptr<GeomAPI_Shape> GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
+const std::shared_ptr<GeomAPI_Shape>
+  GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
 {
-  std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());  
-  aShape->setImpl(new TopoDS_Shape(impl<TopTools_DataMapOfShapeShape>().Find(theKey->impl<TopoDS_Shape>())));
+  std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+  aShape->setImpl(
+    new TopoDS_Shape(impl<TopTools_DataMapOfShapeShape>().Find(theKey->impl<TopoDS_Shape>())));
   return aShape;
-}  
+}
 
 bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
 {