]> OCCT Git - occt-copy.git/commitdiff
0025064: TCollection modification for Salome porting
authorskv <skv@opencascade.com>
Wed, 9 Jul 2014 10:53:35 +0000 (14:53 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 17 Jul 2014 09:23:27 +0000 (13:23 +0400)
src/TCollection/TCollection_IndexedMap.cdl
src/TCollection/TCollection_IndexedMap.gxx
src/TCollection/TCollection_List.cdl
src/TCollection/TCollection_Map.cdl
src/TCollection/TCollection_Map.gxx

index 262d644c04069d6ab4d6f2557b4d7f9bbb651e6b..3144204f0d5c32027d113560f1ef099ee9c5b693 100644 (file)
@@ -84,14 +84,9 @@ is
        -- -   the function RemoveLast to remove the last entry from the map.
 
     Create(Other : IndexedMap from TCollection)
-    returns IndexedMap from TCollection
+    returns IndexedMap from TCollection;
        ---Purpose: As  copying  Map  is an expensive  operation it is
-       -- incorrect  to  do  it implicitly. This constructor
-       -- will raise an  error if the Map  is not  empty. To
-       -- copy the content of a  Map use the  Assign  method (operator =).
-    raises DomainError from Standard
-    is private;
-    
+       -- not recommended to  do  it implicitly.
     
     Assign(me : in out; Other : IndexedMap from TCollection) 
     returns IndexedMap from TCollection
index e20aa6445df85870c0da49a0fb0d388ca55ebec1..5e4ecdca49c325d717e0a3b2fb072714b368f989 100644 (file)
@@ -41,8 +41,12 @@ TCollection_IndexedMap::TCollection_IndexedMap
   (const TCollection_IndexedMap& Other) :
   TCollection_BasicMap(Other.NbBuckets(),Standard_False)
 {
-  if (!Other.IsEmpty())
-    Standard_DomainError::Raise("TCollection:Copy of IndexedMap");
+  if  (!Other.IsEmpty()) { 
+    ReSize(Other.Extent());
+    for (Standard_Integer i = 1; i <= Other.Extent(); i++) {
+      Add(Other(i));
+    }
+  }
 }
 
 //=======================================================================
index cfaffaf04115dc856c6c38bdf56c0731397770c1..1370528c739f09a2128ce5b8ae225e560f5457e2 100644 (file)
@@ -178,11 +178,9 @@ is
        -- To copy a list, you must explicitly call the assignment operator (operator=).
 
     Create(Other : List from TCollection) 
-     returns List from TCollection
-     is private;
+     returns List from TCollection;
        ---Purpose: Creation by copy of existing list.
-       --  Warning: This constructor prints a warning message.
-       -- We recommand to use the operator =.
+       -- We recommend to use the operator =.
                
     Assign(me : in out; Other : List from TCollection)
        ---Purpose: Replace <me> by a copy of <Other>.
index 0aeae7b5a84d72a8c958072d38419731cfabcab3..78548d57f68734c04ab98acbed2afd1de779cede 100644 (file)
@@ -55,9 +55,6 @@ inherits BasicMap from TCollection
        -- -   TCollection_MapHasher class describes the
        --   functions required for a Hasher object.
   
-raises
-    DomainError from Standard
-    
  
     class StdMapNode from TCollection 
     inherits MapNode from TCollection
@@ -128,13 +125,9 @@ is
        -- -   and a map iterator to explore the map.
     
 
-    Create(Other : Map from TCollection) returns Map from TCollection
+    Create(Other : Map from TCollection) returns Map from TCollection;
        ---Purpose: As  copying  Map  is an expensive  operation it is
-       -- incorrect  to  do  it implicitly. This constructor
-       -- will raise an  error if the Map  is not  empty. To
-       -- copy the content of a  Map use the  Assign  method (operator =).
-    raises DomainError from Standard
-    is private;
+       -- not recommended to  do  it implicitly.
     
     Assign(me : in out; Other : Map from TCollection) 
     returns Map from TCollection
index ba9a066d12ebd35c87ef83663a75b253d774d30d..3dc6991bdb8698c895e465725b746adbf96333bc 100644 (file)
@@ -36,8 +36,12 @@ TCollection_Map::TCollection_Map(const Standard_Integer NbBuckets) :
 TCollection_Map::TCollection_Map(const TCollection_Map& Other) :
        TCollection_BasicMap(Other.NbBuckets(),Standard_True)
 {
-  if (Other.Extent() != 0)
-    Standard_DomainError::Raise("TCollection:Copy of Map");
+  if  (!Other.IsEmpty()) { 
+    ReSize(Other.Extent()); 
+    for (TCollection_MapIterator It(Other); It.More(); It.Next()) {
+      Add(It.Key());
+    }
+  }
 }
 
 //=======================================================================