Salome HOME
Replace void* with shared_ptr<void> in GeomAPI_Interface
[modules/shaper.git] / src / GeomAPI / GeomAPI_DataMapOfShapeShape.cpp
index c20e9fd89161620b560adca7347eb54eecfa5259..2d0ce7924c36f348ae8c0641b14f30e5eda0c717 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 // File:        GeomAPI_DataMapOfShapeShape.cpp
 // Created:     28 Oct 2014
 // Author:      Sergey Zaritchny
@@ -12,13 +14,16 @@ using namespace std;
 GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape()
        :GeomAPI_Interface((void *)new TopTools_DataMapOfShapeShape){}
 
-/// Clear 
 void GeomAPI_DataMapOfShapeShape::clear()
 {
   implPtr<TopTools_DataMapOfShapeShape>()->Clear();
 }
 
-/// Adds the Key <K> to  the Map <me>  with  the  Item. Returns True  if the Key  was not already in the map
+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 flag(false);
@@ -27,7 +32,6 @@ bool GeomAPI_DataMapOfShapeShape::bind (std::shared_ptr<GeomAPI_Shape> theKey, s
   return flag;
 }
 
-/// Returns true if theKey is stored  in the map.
 bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey)
 {
   bool flag(false);
@@ -36,7 +40,6 @@ bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey
   return flag;
 }
 
-/// Returns  the Item stored  with the Key in the Map. To be checked before with isBound()
 const std::shared_ptr<GeomAPI_Shape> GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
 {
   std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());  
@@ -44,7 +47,6 @@ const std::shared_ptr<GeomAPI_Shape> GeomAPI_DataMapOfShapeShape::find(std::shar
   return aShape;
 }  
   
-/// Removes the Key from the  map. Returns true if the Key was in the Map
 bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
 {
   bool flag(false);
@@ -55,8 +57,8 @@ bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
 
  GeomAPI_DataMapOfShapeShape::~GeomAPI_DataMapOfShapeShape()
  {
-  if (myImpl) {
-       implPtr<TopTools_DataMapOfShapeShape>()->Clear();
+  if (!empty()) {
+    implPtr<TopTools_DataMapOfShapeShape>()->Clear();
     //delete myImpl;
   }
- }
\ No newline at end of file
+ }