-// File: NCollection_DataMap.hxx
-// Created: Thu Apr 24 15:02:53 2002
-// Author: Alexander KARTOMIN (akm)
-// <akm@opencascade.com>
+// Created on: 2002-04-24
+// Created by: Alexander KARTOMIN (akm)
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
#ifndef NCollection_DataMap_HeaderFile
#define NCollection_DataMap_HeaderFile
Standard_TypeMismatch::Raise ("NCollection_DataMap::Assign impossible");
}
+ //! Exchange the content of two maps without re-allocations.
+ //! Notice that allocators will be swapped as well!
+ void Exchange (NCollection_DataMap& theOther)
+ {
+ this->exchangeAllocators (theOther);
+ this->exchangeMapsData (theOther);
+ }
+
//! = another map
NCollection_DataMap& operator= (const NCollection_DataMap& theOther)
{
return p->Value(); // This for compiler
}
+ //! Find value for key with copying.
+ //! @return true if key was found
+ Standard_Boolean Find (const TheKeyType& theKey,
+ TheItemType& theValue) const
+ {
+ if (IsEmpty())
+ {
+ return Standard_False;
+ }
+
+ for (DataMapNode* aNodeIter = (DataMapNode* )myData1[Hasher::HashCode (theKey, NbBuckets())];
+ aNodeIter != NULL;
+ aNodeIter = (DataMapNode* )aNodeIter->Next())
+ {
+ if (Hasher::IsEqual (aNodeIter->Key(), theKey))
+ {
+ theValue = aNodeIter->Value();
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+ }
+
//! operator ()
const TheItemType& operator() (const TheKeyType& theKey) const
{ return Find(theKey); }