Removed remnants of generic templates in TCollection package.
TCollection_HAsciiString=<myString.mylength,d> <myString.mystring,s>
TCollection_ExtendedString=<mylength,d> <mystring,su>
TCollection_HExtendedString=<myString.mylength,d> <myString.mystring,su>
-TCollection_BaseSequence=size=<Size,d> curr=<CurrentIndex,d>
-TCollection_BasicMap=size=<mySize,d>
-NCollection_BaseSequence=size=<mySize,d> curr=<myCurrentIndex,d>
-NCollection_BaseList=length=<myLength,d>
-NCollection_BaseMap=size=<mySize,d> buckets=<myNbBuckets>
-NCollection_BaseVector=length=<myLength,d>
TDF_Label=<myLabelNode,x> tag=<myLabelNode->myTag>
TDF_LabelNode=tag=<myTag,d>
TDocStd_Document=format=<myStorageFormat.mystring,su> count=<count,d> <,t>
<Type Name="TCollection_HExtendedString">
<DisplayString>{myString.mylength}: {(wchar_t *)myString.mystring,su}</DisplayString>
</Type>
- <Type Name="TCollection_BaseSequence">
- <DisplayString>TCollection_Sequence [{Size}], curr={CurrentIndex}</DisplayString>
- </Type>
- <Type Name="TCollection_BasicMap">
- <AlternativeType Name="NCollection_BaseMap"/>
- <DisplayString>TCollection_Map [{mySize}]</DisplayString>
- </Type>
<Type Name="TColStd_PackedMapOfInteger">
<DisplayString>TColStd_PackedMapOfInteger [{myExtent}]</DisplayString>
</Type>
**TopTools** package contains tools for exploiting the *TopoDS* data structure. It is an instantiation of the tools from *TCollection* package with the Shape classes of *TopoDS*.
-* *TopTools_Array1OfShape, HArray1OfShape* -- instantiation of the *TCollection_Array1* and *TCollection_HArray1* with *TopoDS_Shape*.
-* *TopTools_SequenceOfShape* -- instantiation of the *TCollection_Sequence* with *TopoDS_Shape*.
-* *TopTools_MapOfShape* - instantiation of the *TCollection_Map*. Allows the construction of sets of shapes.
-* *TopTools_IndexedMapOfShape* - instantiation of the *TCollection_IndexedMap*. Allows the construction of tables of shapes and other data structures.
+* *TopTools_Array1OfShape, HArray1OfShape* -- instantiation of the *NCollection_Array1* with *TopoDS_Shape*.
+* *TopTools_SequenceOfShape* -- instantiation of the *NCollection_Sequence* with *TopoDS_Shape*.
+* *TopTools_MapOfShape* - instantiation of the *NCollection_Map*. Allows the construction of sets of shapes.
+* *TopTools_IndexedMapOfShape* - instantiation of the *NCollection_IndexedMap*. Allows the construction of tables of shapes and other data structures.
With a *TopTools_Map*, a set of references to Shapes can be kept without duplication.
The following example counts the size of a data structure as a number of *TShapes*.
<< "Standard_Size" << "Standard_Time" << "Standard_Utf8Char" << "Standard_Utf8UChar"
<< "Standard_ExtCharacter" << "Standard_Utf16Char" << "Standard_Utf32Char" << "Standard_WideChar"
<< "Standard_CString" << "Standard_ExtString" << "NCollection_Vector" << "TCollection_AsciiString"
- << "TCollection_BaseSequence"<< "TCollection_BasicMap" << "TCollection_BasicMapIterator"
<< "TCollection_ExtendedString" << "TCollection_HAsciiString" << "TCollection_HExtendedString"
- << "TCollection_MapNode" << "TCollection_MapNodePtr" << "TCollection_SeqNode"
- << "TCollection_SeqNodePtr" << "TCollection_Side" << "Standard_False" << "Standard_True"
+ << "Standard_False" << "Standard_True"
<< "TCollection" << "NCollection" << "gp_Trsf" << "Handle" << "Aspect_TOL_DASH"
<< "Aspect_TOM_O_STAR" << "Aspect_TOL_SOLID" << "Aspect_TOM_O_STAR" << "AIS_InteractiveObject"
<< "AIS_ListOfInteractive" << "Aspect_GDM_Lines" << "Aspect_GDM_Points" << "Aspect_TOM_POINT"
TCollection.cxx
TCollection.hxx
-TCollection_Array1.gxx
-TCollection_Array1.lxx
-TCollection_Array2.gxx
-TCollection_Array2.lxx
TCollection_AsciiString.cxx
TCollection_AsciiString.hxx
TCollection_AsciiString.lxx
-TCollection_BaseSequence.cxx
-TCollection_BaseSequence.hxx
-TCollection_BaseSequence.lxx
-TCollection_BasicMap.cxx
-TCollection_BasicMap.hxx
-TCollection_BasicMap.lxx
-TCollection_BasicMapIterator.cxx
-TCollection_BasicMapIterator.hxx
-TCollection_BasicMapIterator.lxx
-TCollection_DataMap.gxx
-TCollection_DataMapIterator.gxx
-TCollection_DataMapNode.gxx
-TCollection_DataMapNode.lxx
-TCollection_DoubleMap.gxx
-TCollection_DoubleMapIterator.gxx
-TCollection_DoubleMapNode.gxx
-TCollection_DoubleMapNode.lxx
TCollection_ExtendedString.cxx
TCollection_ExtendedString.hxx
-TCollection_HArray1.gxx
-TCollection_HArray1.lxx
-TCollection_HArray2.gxx
-TCollection_HArray2.lxx
TCollection_HAsciiString.cxx
TCollection_HAsciiString.hxx
TCollection_HAsciiString.lxx
TCollection_HExtendedString.cxx
TCollection_HExtendedString.hxx
-TCollection_HSequence.gxx
-TCollection_HSequence.lxx
-TCollection_IndexedDataMap.gxx
-TCollection_IndexedDataMapNode.gxx
-TCollection_IndexedDataMapNode.lxx
-TCollection_IndexedMap.gxx
-TCollection_IndexedMapNode.gxx
-TCollection_IndexedMapNode.lxx
-TCollection_List.gxx
-TCollection_List.lxx
-TCollection_ListIterator.gxx
-TCollection_ListIterator.lxx
-TCollection_ListNode.gxx
-TCollection_ListNode.lxx
-TCollection_Map.gxx
-TCollection_MapHasher.gxx
-TCollection_MapIterator.gxx
-TCollection_MapNode.cxx
-TCollection_MapNode.hxx
-TCollection_MapNode.lxx
-TCollection_MapNodePtr.hxx
-TCollection_SeqNode.cxx
-TCollection_SeqNode.hxx
-TCollection_SeqNode.lxx
-TCollection_SeqNodePtr.hxx
-TCollection_Sequence.gxx
-TCollection_Sequence.lxx
-TCollection_SequenceNode.gxx
-TCollection_SequenceNode.lxx
-TCollection_Side.hxx
-TCollection_StdMapNode.gxx
-TCollection_StdMapNode.lxx
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-
#include <Standard_Integer.hxx>
-class TCollection_AsciiString;
-class TCollection_ExtendedString;
-class TCollection_HAsciiString;
-class TCollection_HExtendedString;
-class TCollection_Array1;
-class TCollection_HArray1;
-class TCollection_Array2;
-class TCollection_HArray2;
-class TCollection_List;
-class TCollection_ListNode;
-class TCollection_ListIterator;
-class TCollection_BaseSequence;
-class TCollection_SeqNode;
-class TCollection_Sequence;
-class TCollection_SequenceNode;
-class TCollection_HSequence;
-class TCollection_MapHasher;
-class TCollection_BasicMap;
-class TCollection_MapNode;
-class TCollection_BasicMapIterator;
-class TCollection_Map;
-class TCollection_MapIterator;
-class TCollection_StdMapNode;
-class TCollection_DataMap;
-class TCollection_DataMapIterator;
-class TCollection_DataMapNode;
-class TCollection_DoubleMap;
-class TCollection_DoubleMapIterator;
-class TCollection_DoubleMapNode;
-class TCollection_IndexedMap;
-class TCollection_IndexedMapNode;
-class TCollection_IndexedDataMap;
-class TCollection_IndexedDataMapNode;
-
//! The package <TCollection> provides the services for the
//! transient basic data structures.
DEFINE_STANDARD_ALLOC
-
//! Returns a prime number greater than <I> suitable
//! to dimension a Map. When <I> becomes great there
//! is a limit on the result (today the limit is
//! there will be more collisions in the map.
Standard_EXPORT static Standard_Integer NextPrimeForMap (const Standard_Integer I);
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class TCollection_AsciiString;
-friend class TCollection_ExtendedString;
-friend class TCollection_HAsciiString;
-friend class TCollection_HExtendedString;
-friend class TCollection_Array1;
-friend class TCollection_HArray1;
-friend class TCollection_Array2;
-friend class TCollection_HArray2;
-friend class TCollection_List;
-friend class TCollection_ListNode;
-friend class TCollection_ListIterator;
-friend class TCollection_BaseSequence;
-friend class TCollection_SeqNode;
-friend class TCollection_Sequence;
-friend class TCollection_SequenceNode;
-friend class TCollection_HSequence;
-friend class TCollection_MapHasher;
-friend class TCollection_BasicMap;
-friend class TCollection_MapNode;
-friend class TCollection_BasicMapIterator;
-friend class TCollection_Map;
-friend class TCollection_MapIterator;
-friend class TCollection_StdMapNode;
-friend class TCollection_DataMap;
-friend class TCollection_DataMapIterator;
-friend class TCollection_DataMapNode;
-friend class TCollection_DoubleMap;
-friend class TCollection_DoubleMapIterator;
-friend class TCollection_DoubleMapNode;
-friend class TCollection_IndexedMap;
-friend class TCollection_IndexedMapNode;
-friend class TCollection_IndexedDataMap;
-friend class TCollection_IndexedDataMapNode;
-
};
-
-
-
-
-
-
#endif // _TCollection_HeaderFile
+++ /dev/null
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_DimensionMismatch.hxx>
-
-
-//=======================================================================
-//function : Init
-//purpose :
-//=======================================================================
-
-void TCollection_Array1::Init (const Array1Item& V) {
- Array1Item* p = &ChangeValue(myLowerBound);
- const Standard_Integer n = Length();
- for(Standard_Integer i = 0; i < n; i++) {
- p[i] = V;
- }
-}
-
-//=======================================================================
-//function : Assign
-//purpose :
-//=======================================================================
-
-const TCollection_Array1& TCollection_Array1::Assign
- (const TCollection_Array1& Right)
-{
- if (&Right != this) {
- Standard_Integer max = Length() ;
- Standard_DimensionMismatch_Raise_if(max != Right.Length(),
- "DimensionMismatch in Array1::Operator=");
-
- Array1Item* p = &ChangeValue(myLowerBound);
- const Array1Item* q = &Right.Value(Right.Lower());
- for (Standard_Integer i=0; i<max; i++){
- *p++ = *q++;
- }
- }
- return *this;
-}
-
-
-
-
-
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard.hxx>
-#include <Standard_OutOfRange.hxx>
-#include <Standard_RangeError.hxx>
-
-#include Array1Item_hxx
-
-
-//=======================================================================
-//function : TCollection_Array1
-//purpose :
-//=======================================================================
-
-inline TCollection_Array1::TCollection_Array1 (const Standard_Integer Low,
- const Standard_Integer Up) :
- myLowerBound(Low),
- myUpperBound(Up),
- isAllocated(Standard_True)
-{
- Standard_RangeError_Raise_if(Up < Low,"TCollection_Array1::Create");
-
- Array1Item* p = new Array1Item[Up-Low+1];
-
- myStart = (void*)(p - myLowerBound);
-}
-
-//=======================================================================
-//function : TCollection_Array1
-//purpose : C Array constructor
-//=======================================================================
-
-inline TCollection_Array1::TCollection_Array1(const Array1Item& AnItem,
- const Standard_Integer Low,
- const Standard_Integer Up) :
- myLowerBound(Low),
- myUpperBound(Up),
- isAllocated(Standard_False)
-{
- Standard_RangeError_Raise_if(Up < Low,"Array1::CArray");
- myStart = (void*)( &AnItem - Low );
-}
-
-//=======================================================================
-//function : Destroy
-//purpose :
-//=======================================================================
-
-inline void TCollection_Array1::Destroy()
-{
- if (isAllocated) {
- delete [] &ChangeValue(myLowerBound);
- }
-}
-
-//=======================================================================
-//function : Length
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_Array1::Length () const
-{
- return myUpperBound - myLowerBound + 1 ;
-}
-
-
-//=======================================================================
-//function : Lower
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_Array1::Lower () const
-{
- return myLowerBound ;
-}
-
-
-//=======================================================================
-//function : Upper
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_Array1::Upper () const
-{
- return myUpperBound ;
-}
-
-
-//=======================================================================
-//function : IsAllocated
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TCollection_Array1::IsAllocated () const
-{
- return isAllocated;
-}
-
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-
-inline const Array1Item& TCollection_Array1::Value
-(const Standard_Integer Index) const
-{
- Standard_OutOfRange_Raise_if((Index < myLowerBound || Index > myUpperBound),NULL);
- return ((Array1Item *)myStart)[Index];
-}
-
-//=======================================================================
-//function : SetValue
-//purpose :
-//=======================================================================
-
-inline void TCollection_Array1::SetValue (const Standard_Integer Index,
- const Array1Item& Value)
-{
- Standard_OutOfRange_Raise_if((Index < myLowerBound || Index > myUpperBound),NULL);
-
- ((Array1Item *)myStart)[Index] = Value ;
-}
-
-
-//=======================================================================
-//function : ChangeValue
-//purpose :
-//=======================================================================
-
-inline Array1Item& TCollection_Array1::ChangeValue(const Standard_Integer Index)
-{
- Standard_OutOfRange_Raise_if((Index < myLowerBound || Index > myUpperBound),NULL);
-
- return ((Array1Item *)myStart)[Index];
-}
-
-
-
+++ /dev/null
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_DimensionMismatch.hxx>
-#include <Standard_RangeError.hxx>
-#include <Standard_OutOfMemory.hxx>
-#include <Standard.hxx>
-
-//=======================================================================
-//function : Allocate
-//purpose : Allocate memory for the array, set up indirection table
-//=======================================================================
-
-void TCollection_Array2::Allocate ()
-{
- Standard_Integer RowSize = myUpperColumn-myLowerColumn+1;
- Standard_Integer ColumnSize = myUpperRow-myLowerRow+1;
-
- if (myDeletable) {
- // allocation of the data in the array
-
- Standard_Integer Size = RowSize * ColumnSize;
-
-// Modified by Sergey KHROMOV - Mon Feb 10 11:46:14 2003 Begin
-// Standard_RangeError_Raise_if(( RowSize < 0 || ColumnSize < 0 ),
-// "TCollection_Array2::Create");
- Standard_RangeError_Raise_if(( RowSize <= 0 || ColumnSize <= 0 ),
- "TCollection_Array2::Create");
-// Modified by Sergey KHROMOV - Mon Feb 10 11:46:15 2003 End
- myData = new Array2Item [Size];
-
- if (!myData) throw Standard_OutOfMemory("Array2 : Allocation failed");
- }
-
- // allocation of the indirection table (pointers on rows)
- Array2Item* p = (Array2Item*) myData;
- Array2Item** q = (Array2Item**)Standard::Allocate(ColumnSize * sizeof(Array2Item*));
-
- for (Standard_Integer i = 0; i < ColumnSize; i++) {
- q[i] = p - myLowerColumn;
- p += RowSize;
- }
-
- myData = (void*) (q - myLowerRow);
-}
-
-//=======================================================================
-//function : TCollection_Array2
-//purpose :
-//=======================================================================
-
-TCollection_Array2::TCollection_Array2 (const Standard_Integer R1,
- const Standard_Integer R2,
- const Standard_Integer C1,
- const Standard_Integer C2) :
- myLowerRow(R1),
- myLowerColumn(C1),
- myUpperRow(R2),
- myUpperColumn(C2),
- myDeletable(Standard_True)
-{
- Allocate ();
-}
-
-//=======================================================================
-//function : TCollection_Array2
-//purpose : User allocated data
-//=======================================================================
-
-TCollection_Array2::TCollection_Array2 (const Array2Item& Item,
- const Standard_Integer R1,
- const Standard_Integer R2,
- const Standard_Integer C1,
- const Standard_Integer C2) :
- myLowerRow(R1),
- myLowerColumn(C1),
- myUpperRow(R2),
- myUpperColumn(C2),
- myDeletable(Standard_False),
- myData((void*)&Item)
-{
- Allocate ();
-}
-
-//=======================================================================
-//function : Init
-//purpose :
-//=======================================================================
-
-void TCollection_Array2::Init (const Array2Item& V)
-{
- Standard_Integer Size = RowLength() * ColLength();
- Array2Item* p = &(ChangeValue(myLowerRow,myLowerColumn));
- for (Standard_Integer I = 0; I < Size ; I++) p[I] = V;
-}
-
-//=======================================================================
-//function : Destroy
-//purpose :
-//=======================================================================
-
-void TCollection_Array2::Destroy ()
-{
- Array2Item** anItemPtr = ((Array2Item**)myData + myLowerRow);
-
- // delete the data
- //
- if (myDeletable)
- delete [] &ChangeValue(myLowerRow,myLowerColumn);
-
- // delete the indirection table
- Standard::Free (anItemPtr);
-}
-
-//=======================================================================
-//function : Assign
-//purpose :
-//=======================================================================
-
-const TCollection_Array2& TCollection_Array2::Assign
- (const TCollection_Array2& Right)
-{
- Standard_Integer MaxColumn = RowLength() ;
- Standard_Integer MaxRow = ColLength() ;
- Standard_Integer MaxSize = MaxColumn * MaxRow;
-
- Standard_DimensionMismatch_Raise_if(MaxRow != Right.ColLength() ||
- MaxColumn != Right.RowLength(),
- "Array2::Operator=");
-
- Array2Item* p = &ChangeValue(myLowerRow,myLowerColumn);
- const Array2Item* q = &Right.Value(Right.LowerRow(),Right.LowerCol());
- for (Standard_Integer i=0; i<MaxSize; i++) {
- p[i] = q[i];
- }
- return *this;
-}
-
-
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard.hxx>
-#include <Standard_OutOfRange.hxx>
-
-#include Array2Item_hxx
-
-//=======================================================================
-//function : ColLength
-//purpose :
-//=======================================================================
-inline Standard_Integer TCollection_Array2::ColLength () const
-{
- return myUpperRow - myLowerRow + 1 ;
-}
-
-//=======================================================================
-//function : LowerCol
-//purpose :
-//=======================================================================
-inline Standard_Integer TCollection_Array2::LowerCol () const
-{
- return myLowerColumn ;
-}
-
-//=======================================================================
-//function : LowerRow
-//purpose :
-//=======================================================================
-inline Standard_Integer TCollection_Array2::LowerRow () const
-{
- return myLowerRow;
-}
-
-//=======================================================================
-//function : RowLength
-//purpose :
-//=======================================================================
-inline Standard_Integer TCollection_Array2::RowLength () const
-{
- return myUpperColumn - myLowerColumn + 1 ;
-}
-
-//=======================================================================
-//function : UpperRow
-//purpose :
-//=======================================================================
-inline Standard_Integer TCollection_Array2::UpperRow () const
-{
- return myUpperRow ;
-}
-
-//=======================================================================
-//function : UpperCol
-//purpose :
-//=======================================================================
-inline Standard_Integer TCollection_Array2::UpperCol () const
-{
- return myUpperColumn ;
-}
-
-//=======================================================================
-//function : SetValue
-//purpose :
-//=======================================================================
-
-inline void TCollection_Array2::SetValue ( const Standard_Integer Row,
- const Standard_Integer Col,
- const Array2Item& Value )
-{
- Standard_OutOfRange_Raise_if((Row < myLowerRow || Row > myUpperRow ||
- Col < myLowerColumn || Col > myUpperColumn),
- NULL);
-
- ((Array2Item **)myData)[Row][Col] = Value ;
-}
-
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-inline const Array2Item& TCollection_Array2::Value(const Standard_Integer Row,
- const Standard_Integer Col) const
-{
- Standard_OutOfRange_Raise_if((Row < myLowerRow || Row > myUpperRow ||
- Col < myLowerColumn || Col > myUpperColumn),
- NULL);
-
- return ((Array2Item **)myData)[Row][Col];
-}
-
-//=======================================================================
-//function : ChangeValue
-//purpose :
-//=======================================================================
-
-inline Array2Item& TCollection_Array2::ChangeValue(const Standard_Integer Row,
- const Standard_Integer Col)
-{
- Standard_OutOfRange_Raise_if((Row < myLowerRow || Row > myUpperRow ||
- Col < myLowerColumn || Col > myUpperColumn),
- NULL);
-
- return ((Array2Item **)myData)[Row][Col];
-}
-
-
-
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Standard_DomainError.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_OutOfRange.hxx>
-#include <TCollection_BaseSequence.hxx>
-#include <TCollection_SeqNode.hxx>
-
-typedef void (*DelNode) (TCollection_SeqNode*);
-
-TCollection_BaseSequence::TCollection_BaseSequence() :
- FirstItem(NULL),
- LastItem(NULL),
- CurrentItem(NULL),
- CurrentIndex(0),
- Size(0)
-{
-}
-
-
-
-// ----------------------------------
-// Clear : Clear the Current Sequence
-// ----------------------------------
-void TCollection_BaseSequence::Clear(const Standard_Address delnode)
-{
- Size = 0;
- TCollection_SeqNode* p = (TCollection_SeqNode*) FirstItem;
- TCollection_SeqNode* q;
- while (p) {
- q = p;
- p = p->Next();
- ((DelNode)delnode) (q);
- }
- LastItem = FirstItem = CurrentItem = NULL;
- CurrentIndex = 0;
-}
-
-void TCollection_BaseSequence::PAppend(const Standard_Address newnode)
-{
- if (Size == 0) {
- FirstItem = LastItem = CurrentItem = newnode;
- CurrentIndex = Size = 1;
- }
- else {
- ((TCollection_SeqNode*)LastItem)->Next() = (TCollection_SeqNode*)newnode;
- LastItem = newnode;
- Size++;
- }
-}
-
-// ---------------------------------------------------
-// Append : Push a sequence at the end of the sequence
-// ---------------------------------------------------
-void TCollection_BaseSequence::PAppend(TCollection_BaseSequence& Other)
-{
- if (Other.Size == 0)
- return;
- if (Size == 0) {
- Size = Other.Size;
- FirstItem = Other.FirstItem;
- LastItem = Other.LastItem;
- CurrentItem = FirstItem;
- CurrentIndex = 1;
- }
- else {
- Size += Other.Size;
- ((TCollection_SeqNode*)LastItem)->Next() = (TCollection_SeqNode*)Other.FirstItem;
- if (Other.FirstItem) {
- ((TCollection_SeqNode*)Other.FirstItem)->Previous() = (TCollection_SeqNode*)LastItem;
- LastItem = Other.LastItem;
- }
- }
- Other.Nullify();
-}
-
-
-
-void TCollection_BaseSequence::PPrepend(const Standard_Address newnode)
-{
- if (Size == 0) {
- FirstItem = LastItem = CurrentItem = newnode;
- CurrentIndex = Size = 1;
- }
- else {
- ((TCollection_SeqNode*)FirstItem)->Previous() = (TCollection_SeqNode*) newnode;
- ((TCollection_SeqNode*)newnode)->Next() = (TCollection_SeqNode*)FirstItem;
- FirstItem = newnode;
- Size++;
- CurrentIndex++;
- }
-}
-
-void TCollection_BaseSequence::PPrepend(TCollection_BaseSequence& Other)
-{
- if (Other.Size == 0)
- return;
- if (Size == 0) {
- Size = Other.Size;
- FirstItem = Other.FirstItem;
- LastItem = Other.LastItem;
- CurrentIndex = 1;
- CurrentItem = FirstItem;
- }
- else {
- Size += Other.Size;
- if (Other.LastItem) ((TCollection_SeqNode*)Other.LastItem)->Next() = (TCollection_SeqNode*)FirstItem;
- ((TCollection_SeqNode*)FirstItem)->Previous() = (TCollection_SeqNode*)Other.LastItem;
- FirstItem = Other.FirstItem;
- CurrentIndex += Other.Size;
- }
- Other.Nullify();
-}
-
-// ---------------------------------------------------------
-// Reverse : Reverse the order of a given sequence
-// ---------------------------------------------------------
-void TCollection_BaseSequence::Reverse()
-{
- TCollection_SeqNode* p = (TCollection_SeqNode*) FirstItem;
- TCollection_SeqNode* tmp;
- while (p) {
- tmp = p->Next();
- p->Next() = p->Previous();
- p->Previous() = tmp;
- p = tmp;
- }
- tmp = (TCollection_SeqNode*)FirstItem;
- FirstItem = LastItem;
- LastItem = tmp;
- if (Size != 0) CurrentIndex = Size + 1 - CurrentIndex;
-}
-
-
-void TCollection_BaseSequence::PInsertAfter(const Standard_Integer Index, const Standard_Address N)
-{
- if (Index == 0)
- PPrepend(N);
- else {
- TCollection_SeqNode* p = (TCollection_SeqNode*) Find(Index);
- TCollection_SeqNode* newnode = (TCollection_SeqNode*) N;
- newnode->Next() = p->Next();
- newnode->Previous() = p;
- if (Index == Size) LastItem = newnode;
- else p->Next()->Previous() = newnode;
- p->Next() = newnode;
- Size++;
- if (Index < CurrentIndex) CurrentIndex++;
- }
-}
-
-// -------------------------------------------------------------------
-// InsertAfter : Insert a sequence after a given index in the sequence
-// -------------------------------------------------------------------
-
-void TCollection_BaseSequence::PInsertAfter(const Standard_Integer Index, TCollection_BaseSequence& Other)
-{
- if (Index < 0 || Index > Size) throw Standard_OutOfRange();
- if (Other.Size == 0) return;
- if (Index == 0)
- PPrepend( Other );
- else {
- TCollection_SeqNode* p = (TCollection_SeqNode*) Find(Index);
- ((TCollection_SeqNode*)Other.FirstItem)->Previous() = p;
- ((TCollection_SeqNode*)Other.LastItem)->Next() = p->Next();
- if (Index == Size) LastItem = Other.LastItem;
- else p->Next()->Previous() = (TCollection_SeqNode*)Other.LastItem;
- p->Next() = (TCollection_SeqNode*)Other.FirstItem;
- Size += Other.Size;
- if (Index < CurrentIndex) CurrentIndex += Other.Size;
- Other.Nullify();
- }
-}
-
-// ----------------------------------------
-// Exchange : Exchange two elements in the sequence
-// ----------------------------------------
-void TCollection_BaseSequence::Exchange(const Standard_Integer I, const Standard_Integer J)
-{
- Standard_OutOfRange_Raise_if ( I <= 0 || J <= 0 || I > Size || J > Size,"" ) ;
-
- // Assume I < J
- if (I == J) return;
- if (J < I) {
- Exchange(J,I);
- return;
- }
-
- TCollection_SeqNode* pi = (TCollection_SeqNode*) Find(I);
- TCollection_SeqNode* pj = (TCollection_SeqNode*) Find(J);
-
- // update the node before I
- if (pi->Previous())
- pi->Previous()->Next() = pj;
- else
- FirstItem = pj;
-
- // update the node after J
- if (pj->Next())
- pj->Next()->Previous() = pi;
- else
- LastItem = pi;
-
- if (pi->Next() == pj) { // I and J are consecutives, update them
- pj->Previous() = pi->Previous();
- pi->Previous() = pj;
- pi->Next() = pj->Next();
- pj->Next() = pi;
- }
- else { // I and J are not consecutive
- pi->Next()->Previous() = pj; // update the node after I
- pj->Previous()->Next() = pi; // update the node before J
- TCollection_SeqNode* tmp = pi->Next(); // update nodes I and J
- pi->Next() = pj->Next();
- pj->Next() = tmp;
- tmp = pi->Previous();
- pi->Previous() = pj->Previous();
- pj->Previous() = tmp;
- }
-
- if (CurrentIndex == I) CurrentItem = pj;
- else if (CurrentIndex == J) CurrentItem = pi;
-}
-
-void TCollection_BaseSequence::PSplit(const Standard_Integer Index, TCollection_BaseSequence& Sub)
-{
- Standard_OutOfRange_Raise_if( Index <= 0 || Index > Size,"" );
- Standard_DomainError_Raise_if(this == &Sub,"No Split on myself!!");
-
- TCollection_SeqNode* p = (TCollection_SeqNode*) Find(Index);
-
- Sub.LastItem = LastItem;
- Sub.Size = Size - Index + 1;
-
- LastItem = p->Previous();
- if (LastItem) {
- ((TCollection_SeqNode*)LastItem)->Next() = NULL;
- Size = Index - 1;
- if (CurrentIndex >= Index) {
- CurrentIndex = 1;
- CurrentItem = (TCollection_SeqNode*) FirstItem;
- }
- }
- else {
- FirstItem = CurrentItem = NULL;
- Size = CurrentIndex = 0;
- }
-
- Sub.FirstItem = Sub.CurrentItem = p;
- p->Previous() = NULL;
- Sub.CurrentIndex = 1;
-}
-
-void TCollection_BaseSequence::Remove(const Standard_Integer Index, const Standard_Address delnode)
-{
- Standard_OutOfRange_Raise_if(Index <= 0 || Index > Size,"" );
-
- TCollection_SeqNode* p = (TCollection_SeqNode*) Find(Index);
- if (p->Previous())
- p->Previous()->Next() = p->Next();
- else
- FirstItem = p->Next();
- if (p->Next())
- p->Next()->Previous() = p->Previous();
- else
- LastItem = p->Previous();
-
- Size--;
- if (CurrentIndex > Index) CurrentIndex--;
- else if (CurrentIndex == Index) {
- if (p->Next())
- CurrentItem = p->Next();
- else {
- CurrentItem = (TCollection_SeqNode*) LastItem;
- CurrentIndex = Size;
- }
- }
- ((DelNode)delnode) (p);
-}
-
-// ---------------------
-// Remove a set of items
-// ---------------------
-void TCollection_BaseSequence::Remove(const Standard_Integer From, const Standard_Integer To,
- const Standard_Address delnode)
-{
- Standard_OutOfRange_Raise_if (From <= 0 || From > Size || To <= 0 || To > Size || From > To,"" );
-
- TCollection_SeqNode* pfrom = (TCollection_SeqNode*) Find(From);
- TCollection_SeqNode* pto = (TCollection_SeqNode*) Find(To);
-
- if (pfrom->Previous())
- pfrom->Previous()->Next() = pto->Next();
- else
- FirstItem = pto->Next();
- if (pto->Next())
- pto->Next()->Previous() = pfrom->Previous();
- else
- LastItem = pfrom->Previous();
-
- Size -= To - From + 1;
- if (CurrentIndex > To)
- CurrentIndex -= To - From + 1;
- else if (CurrentIndex >= From) {
- if (pto->Next()) {
- CurrentItem = pto->Next();
- CurrentIndex = From; // AGV fix 24.05.01
- } else {
- CurrentItem = (TCollection_SeqNode*) LastItem;
- CurrentIndex = Size;
- }
- }
-
- Standard_Integer i;
- for (i = From; i <= To; i++) {
- pto = pfrom;
- pfrom = pfrom->Next();
- ((DelNode)delnode) (pto);
- }
-}
-
-Standard_Address TCollection_BaseSequence::Find(const Standard_Integer Index) const
-{
- Standard_Integer i;
- TCollection_SeqNode* p;
- if (Index <= CurrentIndex) {
- if (Index < CurrentIndex / 2) {
- p = (TCollection_SeqNode*) FirstItem;
- for (i = 1; i < Index; i++) p = p->Next();
- }
- else {
- p = (TCollection_SeqNode*) CurrentItem;
- for (i = CurrentIndex; i > Index; i--) p = p->Previous();
- }
- }
- else {
- if (Index < (CurrentIndex + Size) / 2) {
- p = (TCollection_SeqNode*) CurrentItem;
- for (i = CurrentIndex; i < Index; i++) p = p->Next();
- }
- else {
- p = (TCollection_SeqNode*) LastItem;
- for (i = Size; i > Index; i--) p = p->Previous();
- }
- }
- return p;
-}
-
-//=======================================================================
-//function : Nullify
-//purpose :
-//=======================================================================
-
-void TCollection_BaseSequence::Nullify()
-{
- FirstItem = LastItem = CurrentItem = NULL;
- CurrentIndex = Size = 0;
-}
+++ /dev/null
-// Created on: 1992-09-11
-// Created by: Mireille MERCIEN
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _TCollection_BaseSequence_HeaderFile
-#define _TCollection_BaseSequence_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Address.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
-class Standard_NoSuchObject;
-class Standard_OutOfRange;
-
-
-//! Definition of a base class for all instanciations
-//! of sequence.
-//!
-//! The methods : Clear, Remove accepts a pointer to a
-//! function to use to delete the nodes. This allow
-//! proper call of the destructor on the Items.
-//! Without adding a virtual function pointer to each
-//! node or each sequence.
-class TCollection_BaseSequence
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! returns True if the sequence <me> contains no elements.
- Standard_Boolean IsEmpty() const;
-
- //! Returns the number of element(s) in the
- //! sequence. Returns zero if the sequence is empty.
- Standard_Integer Length() const;
-
- //! Reverses the order of items on <me>.
- //! Example:
- //! before
- //! me = (A B C)
- //! after
- //! me = (C B A)
- Standard_EXPORT void Reverse();
-
- //! Swaps elements which are located at
- //! positions <I> and <J> in <me>.
- //! Raises an exception if I or J is out of bound.
- //! Example:
- //! before
- //! me = (A B C), I = 1, J = 3
- //! after
- //! me = (C B A)
- Standard_EXPORT void Exchange (const Standard_Integer I, const Standard_Integer J);
-
-
-
-
-protected:
-
-
- //! Creation of an empty sequence.
- Standard_EXPORT TCollection_BaseSequence();
-
- Standard_EXPORT void Clear (const Standard_Address DelNode);
-
- Standard_EXPORT void PAppend (const Standard_Address Node);
-
- //! Concatenates <S> at the end of <me>.
- //! <S> is cleared.
- //! Example:
- //! before
- //! me = (A B C)
- //! S = (D E F)
- //! after
- //! me = (A B C D E F)
- //! S = ()
- Standard_EXPORT void PAppend (TCollection_BaseSequence& S);
-
- Standard_EXPORT void PPrepend (const Standard_Address Node);
-
- //! Concatenates <S> at the beginning of <me>.
- //! <S> is cleared.
- //! Example:
- //! before
- //! me = (A B C) S = (D E F)
- //! after me = (D E F A B C)
- //! S = ()
- Standard_EXPORT void PPrepend (TCollection_BaseSequence& S);
-
- Standard_EXPORT void PInsertAfter (const Standard_Integer Index, const Standard_Address Node);
-
- //! Inserts the sequence <S> in <me> after the
- //! position <Index>. <S> is cleared.
- //! Raises an exception if the index is out of bound.
- //! Example:
- //! before
- //! me = (A B C), Index = 3, S = (D E F)
- //! after
- //! me = (A B C D E F)
- //! S = ()
- Standard_EXPORT void PInsertAfter (const Standard_Integer Index, TCollection_BaseSequence& S);
-
- //! Keeps in <me> the items 1 to <Index>-1 and
- //! puts in <Sub> the items <Index> to the end.
- //! Example:
- //! before
- //! me = (A B C D) ,Index = 3
- //! after
- //! me = (A B)
- //! Sub = (C D)
- Standard_EXPORT void PSplit (const Standard_Integer Index, TCollection_BaseSequence& Sub);
-
- Standard_EXPORT void Remove (const Standard_Integer Index, const Standard_Address DelNode);
-
- Standard_EXPORT void Remove (const Standard_Integer FromIndex, const Standard_Integer ToIndex, const Standard_Address DelNode);
-
- //! Returns the node at position <index>.
- Standard_EXPORT Standard_Address Find (const Standard_Integer Index) const;
-
-
- Standard_Address FirstItem;
- Standard_Address LastItem;
- Standard_Address CurrentItem;
- Standard_Integer CurrentIndex;
- Standard_Integer Size;
-
-
-private:
-
-
- //! Creation by copy of existing Sequence.
- //! Warning: This constructor prints a warning message.
- //! We recommand to use the operator =.
- Standard_EXPORT TCollection_BaseSequence(const TCollection_BaseSequence& Other);
-
- //! Clear all fields.
- Standard_EXPORT void Nullify();
-
-
-
-
-};
-
-
-#include <TCollection_BaseSequence.lxx>
-
-
-
-
-
-#endif // _TCollection_BaseSequence_HeaderFile
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline Standard_Boolean TCollection_BaseSequence::IsEmpty() const
-{
- return Size == 0;
-}
-
- inline Standard_Integer TCollection_BaseSequence::Length() const
-{
- return Size;
-
-}
-
+++ /dev/null
-// Created on: 1993-02-26
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Standard_Stream.hxx>
-#include <TCollection.hxx>
-#include <TCollection_BasicMap.hxx>
-#include <TCollection_BasicMapIterator.hxx>
-#include <TCollection_MapNode.hxx>
-
-//=======================================================================
-//function : TCollection_BasicMap
-//purpose :
-//=======================================================================
-TCollection_BasicMap::TCollection_BasicMap(const Standard_Integer NbBuckets,
- const Standard_Boolean single) :
- myData1(NULL),
- myData2(NULL),
- isDouble(!single),
- mySaturated(Standard_False),
- myNbBuckets(NbBuckets),
- mySize(0)
-{
-}
-
-
-//=======================================================================
-//function : BeginResize
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_BasicMap::BeginResize
- (const Standard_Integer NbBuckets,
- Standard_Integer& N,
- Standard_Address& data1,
- Standard_Address& data2) const
-{
- if (mySaturated) return Standard_False;
- N = TCollection::NextPrimeForMap(NbBuckets);
- if (N <= myNbBuckets) {
- if (IsEmpty())
- N = myNbBuckets;
- else
- return Standard_False;
- }
- data1 = Standard::Allocate((N+1)*sizeof(TCollection_MapNodePtr));
- memset(data1, 0, (N+1)*sizeof(TCollection_MapNodePtr));
- if (isDouble) {
- data2 = Standard::Allocate((N+1)*sizeof(TCollection_MapNodePtr));
- memset(data2, 0, (N+1)*sizeof(TCollection_MapNodePtr));
- }
- else
- data2 = NULL;
- return Standard_True;
-}
-
-
-//=======================================================================
-//function : EndResize
-//purpose :
-//=======================================================================
-
-void TCollection_BasicMap::EndResize(const Standard_Integer NbBuckets,
- const Standard_Integer N,
- const Standard_Address data1,
- const Standard_Address data2)
-{
- Standard::Free(myData1);
- Standard::Free(myData2);
- myNbBuckets = N;
- mySaturated = myNbBuckets <= NbBuckets;
- myData1 = data1;
- myData2 = data2;
-}
-
-
-//=======================================================================
-//function : Destroy
-//purpose :
-//=======================================================================
-
-void TCollection_BasicMap::Destroy()
-{
- mySize = 0;
- mySaturated = Standard_False;
- Standard::Free(myData1);
- Standard::Free(myData2);
- myData1 = myData2 = NULL;
-}
-
-
-//=======================================================================
-//function : Statistics
-//purpose :
-//=======================================================================
-
-void TCollection_BasicMap::Statistics(Standard_OStream& S) const
-{
- S <<"\nMap Statistics\n---------------\n\n";
- S <<"This Map has "<<myNbBuckets<<" Buckets and "<<mySize<<" Keys\n\n";
- if (mySaturated) S<<"The maximum number of Buckets is reached\n";
-
- if (mySize == 0) return;
-
- // compute statistics on 1
- Standard_Integer * sizes = new Standard_Integer [mySize+1];
- Standard_Integer i,l,nb;
- TCollection_MapNode* p;
- TCollection_MapNode** data;
-
- S << "\nStatistics for the first Key\n";
- for (i = 0; i <= mySize; i++) sizes[i] = 0;
- data = (TCollection_MapNode**) myData1;
- nb = 0;
- for (i = 0; i <= myNbBuckets; i++) {
- l = 0;
- p = data[i];
- if (p) nb++;
- while (p) {
- l++;
- p = p->Next();
- }
- sizes[l]++;
- }
-
- // display results
- l = 0;
- for (i = 0; i<= mySize; i++) {
- if (sizes[i] > 0) {
- l += sizes[i] * i;
- S << std::setw(5) << sizes[i] <<" buckets of size "<<i<<"\n";
- }
- }
-
- Standard_Real mean = ((Standard_Real) l) / ((Standard_Real) nb);
- S<<"\n\nMean of length : "<<mean<<"\n";
-
- delete [] sizes;
-}
+++ /dev/null
-// Created on: 1993-02-26
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _TCollection_BasicMap_HeaderFile
-#define _TCollection_BasicMap_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Address.hxx>
-#include <Standard_OStream.hxx>
-class TCollection_BasicMapIterator;
-
-
-//! Root class of all the maps, provides utilitites
-//! for managing the buckets.
-//! Maps are dynamically extended data structures where
-//! data is quickly accessed with a key.
-//! General properties of maps
-//! - Map items may be (complex) non-unitary data; they
-//! may be difficult to manage with an array. Moreover, the
-//! map allows a data structure to be indexed by complex data.
-//! - The size of a map is dynamically extended. So a map
-//! may be first dimensioned for a little number of items.
-//! Maps avoid the use of large and quasi-empty arrays.
-//! - The access to a map item is much faster than the one
-//! to a sequence, a list, a queue or a stack item.
-//! - The access time to a map item may be compared with
-//! the one to an array item. First of all, it depends on the
-//! size of the map. It also depends on the quality of a user
-//! redefinable function (the hashing function) to find
-//! quickly where the item is.
-//! - The exploration of a map may be of better performance
-//! than the exploration of an array because the size of the
-//! map is adapted to the number of inserted items.
-//! These properties explain why maps are commonly used as
-//! internal data structures for algorithms.
-//! Definitions
-//! - A map is a data structure for which data is addressed by keys.
-//! - Once inserted in the map, a map item is referenced as an entry of the map.
-//! - Each entry of the map is addressed by a key. Two
-//! different keys address two different entries of the map.
-//! - The position of an entry in the map is called a bucket.
-//! - A map is dimensioned by its number of buckets, i.e. the
-//! maximum number of entries in the map. The
-//! performance of a map is conditioned by the number of buckets.
-//! - The hashing function transforms a key into a bucket
-//! index. The number of values that can be computed by
-//! the hashing function is equal to the number of buckets of the map.
-//! - Both the hashing function and the equality test
-//! between two keys are provided by a hasher object.
-//! - A map may be explored by a map iterator. This
-//! exploration provides only inserted entries in the map
-//! (i.e. non empty buckets).
-//! Collections' generic maps
-//! The Collections component provides numerous generic derived maps.
-//! - These maps include automatic management of the
-//! number of buckets: they are automatically resized when
-//! the number of keys exceeds the number of buckets. If
-//! you have a fair idea of the number of items in your map,
-//! you can save on automatic resizing by specifying a
-//! number of buckets at the time of construction, or by using
-//! a resizing function. This may be considered for crucial optimization issues.
-//! - Keys, items and hashers are parameters of these generic derived maps.
-//! - TCollection_MapHasher class describes the
-//! functions required by any hasher which is to be used
-//! with a map instantiated from the Collections component.
-//! - An iterator class is automatically instantiated at the
-//! time of instantiation of a map provided by the
-//! Collections component if this map is to be explored
-//! with an iterator. Note that some provided generic maps
-//! are not to be explored with an iterator but with indexes (indexed maps).
-class TCollection_BasicMap
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Returns the number of buckets in <me>.
- Standard_Integer NbBuckets() const;
-
- //! Returns the number of keys already stored in <me>.
- Standard_Integer Extent() const;
-
- //! Returns True when the map contains no keys.
- //! This is exactly Extent() == 0.
- Standard_Boolean IsEmpty() const;
-
- //! Prints on <S> usefull statistics about the map
- //! <me>. It can be used to test the quality of the hashcoding.
- Standard_EXPORT void Statistics (Standard_OStream& S) const;
-
-
-friend class TCollection_BasicMapIterator;
-
-
-protected:
-
-
- //! Initialize the map. Single is True when the map
- //! uses only one table of buckets.
- //!
- //! One table : Map, DataMap
- //! Two tables : DoubleMap, IndexedMap, IndexedDataMap
- Standard_EXPORT TCollection_BasicMap(const Standard_Integer NbBuckets, const Standard_Boolean single);
-
- //! Tries to resize the Map with NbBuckets. Returns
- //! True if possible, NewBuckts is the new nuber of
- //! buckets. data1 and data2 are the new tables of
- //! buckets where the data must be copied.
- Standard_EXPORT Standard_Boolean BeginResize (const Standard_Integer NbBuckets, Standard_Integer& NewBuckets, Standard_Address& data1, Standard_Address& data2) const;
-
- //! If BeginResize was succesfull after copying the
- //! data to data1 and data2 this methods update the
- //! tables and destroys the old ones.
- Standard_EXPORT void EndResize (const Standard_Integer NbBuckets, const Standard_Integer NewBuckets, const Standard_Address data1, const Standard_Address data2);
-
- //! Returns True if resizing the map should be
- //! considered.
- Standard_Boolean Resizable() const;
-
- //! Decrement the extent of the map.
- void Increment();
-
- //! Decrement the extent of the map.
- void Decrement();
-
- //! Destroys the buckets.
- Standard_EXPORT void Destroy();
-
-
- Standard_Address myData1;
- Standard_Address myData2;
-
-
-private:
-
-
-
- Standard_Boolean isDouble;
- Standard_Boolean mySaturated;
- Standard_Integer myNbBuckets;
- Standard_Integer mySize;
-
-
-};
-
-
-#include <TCollection_BasicMap.lxx>
-
-
-
-
-
-#endif // _TCollection_BasicMap_HeaderFile
+++ /dev/null
-// Created on: 1993-02-26
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : NbBuckets
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_BasicMap::NbBuckets() const
-{
- return myNbBuckets;
-}
-
-//=======================================================================
-//function : Extent
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_BasicMap::Extent() const
-{
- return mySize;
-}
-
-//=======================================================================
-//function : IsEmpty
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TCollection_BasicMap::IsEmpty() const
-{
- return mySize == 0;
-}
-
-//=======================================================================
-//function : Resizable
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TCollection_BasicMap::Resizable()const
-{
- return IsEmpty() || (!mySaturated && (mySize > myNbBuckets));
-}
-
-//=======================================================================
-//function : Increment
-//purpose :
-//=======================================================================
-
-inline void TCollection_BasicMap::Increment()
-{
- mySize++;
-}
-
-
-//=======================================================================
-//function : Decrement
-//purpose :
-//=======================================================================
-
-inline void TCollection_BasicMap::Decrement()
-{
- mySize--;
-}
-
-
+++ /dev/null
-// Created on: 1993-02-26
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <TCollection_BasicMap.hxx>
-#include <TCollection_BasicMapIterator.hxx>
-#include <TCollection_MapNode.hxx>
-
-//=======================================================================
-//function : TCollection_BasicMapIterator
-//purpose :
-//=======================================================================
-TCollection_BasicMapIterator::TCollection_BasicMapIterator () :
- myNode(NULL),
- myNbBuckets(0),
- myBuckets(NULL),
- myBucket(0)
-{}
-
-
-//=======================================================================
-//function : TCollection_BasicMapIterator
-//purpose :
-//=======================================================================
-
-TCollection_BasicMapIterator::TCollection_BasicMapIterator
- (const TCollection_BasicMap& M) :
- myNode(NULL),
- myNbBuckets(M.myNbBuckets),
- myBuckets(M.myData1),
- myBucket(-1)
-{
- if (!myBuckets) myNbBuckets = -1;
- Next();
-}
-
-//=======================================================================
-//function : Initialize
-//purpose :
-//=======================================================================
-
-void TCollection_BasicMapIterator::Initialize
- (const TCollection_BasicMap& M)
-{
- myNbBuckets = M.myNbBuckets;
- myBuckets = M.myData1;
- myBucket = -1;
- myNode = NULL;
- if (!myBuckets) myNbBuckets = -1;
- Next();
-}
-
-//=======================================================================
-//function : Reset
-//purpose :
-//=======================================================================
-
-void TCollection_BasicMapIterator::Reset()
-{
- myBucket = -1;
- myNode = NULL;
- Next();
-}
-
-//=======================================================================
-//function : Next
-//purpose :
-//=======================================================================
-
-void TCollection_BasicMapIterator::Next()
-{
- if (!myBuckets) return;
-
- if (myNode) {
- myNode = ((TCollection_MapNode*) myNode)->Next();
- if (myNode) return;
- }
-
- while (!myNode) {
- myBucket++;
- if (myBucket > myNbBuckets) return;
- myNode = ((TCollection_MapNodePtr*)myBuckets)[myBucket];
- }
-}
-
+++ /dev/null
-// Created on: 1993-02-26
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _TCollection_BasicMapIterator_HeaderFile
-#define _TCollection_BasicMapIterator_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <Standard_Integer.hxx>
-#include <Standard_Address.hxx>
-#include <Standard_Boolean.hxx>
-class TCollection_BasicMap;
-
-
-//! This class provides basic services for the
-//! iterators on Maps. The iterators are inherited
-//! from this one.
-//!
-//! The iterator contains an array of pointers
-//! (buckets). Each bucket is a pointer on a node. A
-//! node contains a pointer on the next node.
-//!
-//! This class provides also basic services for the
-//! implementation of Maps.
-//! A map iterator provides a step by step exploration of all
-//! entries of a map. After initialization of a concrete derived
-//! iterator, use in a loop:
-//! - the function More to know if there is a current entry for
-//! the iterator in the map,
-//! - then the functions which read data on an entry of the
-//! map (these functions are provided by each type of map),
-//! - then the function Next to set the iterator to the next entry of the map.
-//! Warning
-//! - A map is a non-ordered data structure. The order in
-//! which entries of a map are explored by the iterator
-//! depends on its contents, and change when the map is edited.
-//! - It is not recommended to modify the contents of a map
-//! during iteration: the result is unpredictable.
-class TCollection_BasicMapIterator
-{
-public:
-
- DEFINE_STANDARD_ALLOC
-
-
- //! Resets the iterator to the first node.
- Standard_EXPORT void Reset();
-
- //! Returns true if there is a current entry for this iterator in the map.
- //! Use the function Next to set this iterator to the position of
- //! the next entry, if it exists.
- Standard_Boolean More() const;
-
- //! Sets this iterator to the position of the next entry of the map.
- //! Nothing is changed if there is no more entry to explore in
- //! the map: this iterator is always positioned on the last entry
- //! of the map but the function More returns false.
- Standard_EXPORT void Next();
-
-
-
-
-protected:
-
-
- //! Creates an empty iterator.
- Standard_EXPORT TCollection_BasicMapIterator();
-
- //! Initialize on the first node in the buckets.
- Standard_EXPORT TCollection_BasicMapIterator(const TCollection_BasicMap& M);
-
- //! Initialize on the first node in the buckets.
- Standard_EXPORT void Initialize (const TCollection_BasicMap& M);
-
-
- Standard_Address myNode;
-
-
-private:
-
-
-
- Standard_Integer myNbBuckets;
- Standard_Address myBuckets;
- Standard_Integer myBucket;
-
-
-};
-
-
-#include <TCollection_BasicMapIterator.lxx>
-
-
-
-
-
-#endif // _TCollection_BasicMapIterator_HeaderFile
+++ /dev/null
-// Created on: 1993-02-26
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : More
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TCollection_BasicMapIterator::More() const
-{
- return myNode != 0L;
-}
-
-
-
+++ /dev/null
-// Created on: 1993-01-08
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_DomainError.hxx>
-#include <Standard_NoSuchObject.hxx>
-
-//=======================================================================
-//function : TCollection_DataMap
-//purpose :
-//=======================================================================
-
-TCollection_DataMap::TCollection_DataMap(const Standard_Integer NbBuckets) :
- TCollection_BasicMap(NbBuckets,Standard_True)
-{
-}
-
-//=======================================================================
-//function : TCollection_DataMap
-//purpose :
-//=======================================================================
-
-TCollection_DataMap::TCollection_DataMap(const TCollection_DataMap& Other) :
- TCollection_BasicMap(Other.NbBuckets(),Standard_True)
-{
- if (!Other.IsEmpty())
- throw Standard_DomainError("TCollection:Copy of DataMap");
-}
-
-//=======================================================================
-//function : Assign
-//purpose :
-//=======================================================================
-
-TCollection_DataMap& TCollection_DataMap::Assign
- (const TCollection_DataMap& Other)
-{
- // very simple implementation
- // not optimal (recompute the hashcode values)
-
- if (this == &Other) return *this;
- Clear();
-// ReSize(Other.NbBuckets());
- if (!Other.IsEmpty()) {
- ReSize(Other.Extent());
- for (TCollection_DataMapIterator It(Other); It.More(); It.Next()) {
- Bind(It.Key(),It.Value());
- }
- }
- return *this;
-}
-
-
-//=======================================================================
-//function : ReSize
-//purpose :
-//=======================================================================
-
-void TCollection_DataMap::ReSize(const Standard_Integer N)
-{
- Standard_Integer newBuck;
- Standard_Address newData1=NULL, dummy=NULL;
- if (BeginResize(N,newBuck,newData1,dummy)) {
- if (myData1) {
- TCollection_DataMapNode** newdata = (TCollection_DataMapNode**) newData1;
- TCollection_DataMapNode** olddata = (TCollection_DataMapNode**) myData1;
- TCollection_DataMapNode *p, *q;
- Standard_Integer i,k;
- for (i = 0; i <= NbBuckets(); i++) {
- if (olddata[i]) {
- p = olddata[i];
- while (p) {
- k = Hasher::HashCode(p->Key(),newBuck);
- q = (TCollection_DataMapNode*) p->Next();
- p->Next() = newdata[k];
- newdata[k] = p;
- p = q;
- }
- }
- }
- }
- EndResize(N,newBuck,newData1,dummy);
- }
-}
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-void TCollection_DataMap::Clear()
-{
- if (!IsEmpty()) {
- Standard_Integer i;
- TCollection_DataMapNode** data = (TCollection_DataMapNode**) myData1;
- TCollection_DataMapNode *p,*q;
- for (i = 0; i <= NbBuckets(); i++) {
- if (data[i]) {
- p = data[i];
- while (p) {
- q = (TCollection_DataMapNode*) p->Next();
- delete p;
- p = q;
- }
- }
- }
- }
- TCollection_BasicMap::Destroy();
-}
-
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_DataMap::Bind(const TheKey& K, const TheItem& I)
-{
- if (Resizable()) ReSize(Extent());
- TCollection_DataMapNode** data = (TCollection_DataMapNode**)myData1;
- Standard_Integer k = Hasher::HashCode(K,NbBuckets());
- TCollection_DataMapNode* p = data[k];
- while (p) {
- if (Hasher::IsEqual(p->Key(),K)) {
- p->Value() = I;
- return Standard_False;
- }
- p = (TCollection_DataMapNode*) p->Next();
- }
- Increment();
- data[k] = new TCollection_DataMapNode(K,I,data[k]);
- return Standard_True;
-}
-
-
-//=======================================================================
-//function : Remove
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_DataMap::UnBind(const TheKey& K)
-{
- if (IsEmpty()) return Standard_False;
- TCollection_DataMapNode** data = (TCollection_DataMapNode**) myData1;
- Standard_Integer k = Hasher::HashCode(K,NbBuckets());
- TCollection_DataMapNode* p = data[k];
- TCollection_DataMapNode* q = NULL;
- while (p) {
- if (Hasher::IsEqual(p->Key(),K)) {
- Decrement();
- if (q) q->Next() = p->Next();
- else data[k] = (TCollection_DataMapNode*) p->Next();
- delete p;
- return Standard_True;
- }
- q = p;
- p = (TCollection_DataMapNode*) p->Next();
- }
- return Standard_False;
-}
-//=======================================================================
-//function : IsBound
-//purpose :
-//=======================================================================
-Standard_Boolean TCollection_DataMap::IsBound(const TheKey& K) const
-{
- if (IsEmpty()) return Standard_False;
- TCollection_DataMapNode** data = (TCollection_DataMapNode**) myData1;
- TCollection_DataMapNode* p = data[Hasher::HashCode(K,NbBuckets())];
- while (p) {
- if (Hasher::IsEqual(p->Key(),K)) {
- return Standard_True;
- }
- p = (TCollection_DataMapNode*) p->Next();
- }
- return Standard_False;
-}
-//=======================================================================
-//function : Find
-//purpose :
-//=======================================================================
-const TheItem& TCollection_DataMap::Find(const TheKey& K) const
-{
- Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_DataMap::Find");
- TCollection_DataMapNode** data = (TCollection_DataMapNode**) myData1;
- TCollection_DataMapNode* p = data[Hasher::HashCode(K,NbBuckets())];
- while (p) {
- if (Hasher::IsEqual(p->Key(),K)) {
- return p->Value();
- }
- p = (TCollection_DataMapNode*) p->Next();
- }
- throw Standard_NoSuchObject("TCollection_DataMap::Find");
-}
-//=======================================================================
-//function : ChangeFind
-//purpose :
-//=======================================================================
-TheItem& TCollection_DataMap::ChangeFind(const TheKey& K)
-{
- Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_DataMap::ChangeFind");
- TCollection_DataMapNode** data = (TCollection_DataMapNode**) myData1;
- TCollection_DataMapNode* p = data[Hasher::HashCode(K,NbBuckets())];
- while (p) {
- if (Hasher::IsEqual(p->Key(),K)) {
- return p->Value();
- }
- p = (TCollection_DataMapNode*) p->Next();
- }
- throw Standard_NoSuchObject("TCollection_DataMap::ChangeFind");
-}
-//modified by NIZNHY-PKV Tue Jul 05 09:54:14 2011f
-//=======================================================================
-//function : Find1
-//purpose :
-//=======================================================================
-Standard_Address TCollection_DataMap::Find1(const TheKey& K) const
-{
- TCollection_DataMap *pMap=(TCollection_DataMap *)this;
- return pMap->ChangeFind1(K);
-}
-//=======================================================================
-//function : ChangeFind1
-//purpose :
-//=======================================================================
-Standard_Address TCollection_DataMap::ChangeFind1(const TheKey& K)
-{
- if (IsEmpty()) {
- return NULL;
- }
- TCollection_DataMapNode** data = (TCollection_DataMapNode**) myData1;
- TCollection_DataMapNode* p = data[Hasher::HashCode(K,NbBuckets())];
- while (p) {
- if (Hasher::IsEqual(p->Key(),K)) {
- return (Standard_Address)&p->Value();
- }
- p = (TCollection_DataMapNode*) p->Next();
- }
- return NULL;
-}
-//modified by NIZNHY-PKV Tue Jul 05 09:54:18 2011t
-
-
-
-
-// method of the iterator
-
-//=======================================================================
-//function : Key
-//purpose :
-//=======================================================================
-
-const TheKey& TCollection_DataMapIterator::Key() const
-{
- Standard_NoSuchObject_Raise_if(!More(),"TCollection_DataMapIterator::Key");
- return ((TCollection_DataMapNode*) myNode)->Key();
-}
-
-
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-
-const TheItem& TCollection_DataMapIterator::Value() const
-{
- Standard_NoSuchObject_Raise_if(!More(),"TCollection_DataMapIterator::Value");
- return ((TCollection_DataMapNode*) myNode)->Value();
-}
+++ /dev/null
-// Created on: 1993-02-26
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : TCollection_DataMapIterator
-//purpose :
-//=======================================================================
-
-TCollection_DataMapIterator::TCollection_DataMapIterator() :
- TCollection_BasicMapIterator()
-{}
-
-//=======================================================================
-//function : TCollection_DataMapIterator
-//purpose :
-//=======================================================================
-
-TCollection_DataMapIterator::TCollection_DataMapIterator(const TCollection_DataMap& aMap) :
- TCollection_BasicMapIterator(aMap)
-{}
-
-//=======================================================================
-//function : TCollection_DataMapIterator
-//purpose :
-//=======================================================================
-
-void TCollection_DataMapIterator::Initialize(const TCollection_DataMap& aMap)
-{
- TCollection_BasicMapIterator::Initialize(aMap);
-}
-
+++ /dev/null
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline TCollection_DataMapNode::TCollection_DataMapNode(const TheKey& K, const TheItem& I,const TCollection_MapNodePtr& n)
-: TCollection_MapNode(n),myKey(K)
-{
- myValue = I;
-}
-
-inline TheKey& TCollection_DataMapNode::Key() const
-{
- return (TheKey&)myKey;
-}
-
-inline TheItem& TCollection_DataMapNode::Value() const
-{
- return (TheItem&)myValue;
-}
-
+++ /dev/null
-// Created on: 1993-01-08
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_DomainError.hxx>
-#include <Standard_MultiplyDefined.hxx>
-#include <Standard_NoSuchObject.hxx>
-
-
-//=======================================================================
-//function : TCollection_DoubleMap
-//purpose :
-//=======================================================================
-
-TCollection_DoubleMap::TCollection_DoubleMap(const Standard_Integer NbBuckets):
- TCollection_BasicMap(NbBuckets,Standard_False)
-{
-}
-
-//=======================================================================
-//function : TCollection_DoubleMap
-//purpose :
-//=======================================================================
-
-TCollection_DoubleMap::TCollection_DoubleMap
- (const TCollection_DoubleMap& Other) :
- TCollection_BasicMap(Other.NbBuckets(),Standard_False)
-{
- if (Other.Extent() != 0)
- throw Standard_DomainError("TCollection:Copy of DoubleMap");
-}
-
-//=======================================================================
-//function : Assign
-//purpose :
-//=======================================================================
-
-TCollection_DoubleMap& TCollection_DoubleMap::Assign
- (const TCollection_DoubleMap& Other)
-{
- if (this == &Other) return *this;
- Clear();
-// ReSize(Other.NbBuckets());
- if (!Other.IsEmpty()) {
- ReSize(Other.Extent());
- for (TCollection_DoubleMapIterator It(Other); It.More(); It.Next()) {
- Bind(It.Key1(),It.Key2());
- }
- }
- return *this;
-}
-
-
-//=======================================================================
-//function : ReSize
-//purpose :
-//=======================================================================
-
-void TCollection_DoubleMap::ReSize(const Standard_Integer N)
-{
- Standard_Integer newBuck;
- Standard_Address newData1=NULL, newData2=NULL;
- if (BeginResize(N,newBuck,newData1,newData2)) {
- if (myData1) {
- TCollection_DoubleMapNode** newdata1 = (TCollection_DoubleMapNode**) newData1;
- TCollection_DoubleMapNode** newdata2 = (TCollection_DoubleMapNode**) newData2;
- TCollection_DoubleMapNode** olddata1 = (TCollection_DoubleMapNode**) myData1;
- TCollection_DoubleMapNode *p, *q;
- Standard_Integer i,k1,k2;
- for (i = 0; i <= NbBuckets(); i++) {
- if (olddata1[i]) {
- p = olddata1[i];
- while (p) {
- k1 = Hasher1::HashCode(p->Key1(),newBuck);
- k2 = Hasher2::HashCode(p->Key2(),newBuck);
- q = (TCollection_DoubleMapNode*) p->Next();
- p->Next() = newdata1[k1];
- p->Next2() = newdata2[k2];
- newdata1[k1] = p;
- newdata2[k2] = p;
- p = q;
- }
- }
- }
- }
- EndResize(N,newBuck,newData1,newData2);
- }
-}
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-void TCollection_DoubleMap::Clear()
-{
- if (!IsEmpty()) {
- Standard_Integer i;
- TCollection_DoubleMapNode** data1 = (TCollection_DoubleMapNode**) myData1;
-// TCollection_DoubleMapNode** data2 = (TCollection_DoubleMapNode**) myData2;
- TCollection_DoubleMapNode *p,*q;
- for (i = 0; i <= NbBuckets(); i++) {
- p = data1[i];
- while (p) {
- q = (TCollection_DoubleMapNode*) p->Next();
- delete p;
- p = q;
- }
- }
- }
- TCollection_BasicMap::Destroy();
-}
-
-//=======================================================================
-//function : Bind
-//purpose :
-//=======================================================================
-
-void TCollection_DoubleMap::Bind(const TheKey1& K1, const TheKey2& K2)
-{
- if (Resizable()) ReSize(Extent());
- TCollection_DoubleMapNode** data1 = (TCollection_DoubleMapNode**)myData1;
- TCollection_DoubleMapNode** data2 = (TCollection_DoubleMapNode**)myData2;
- Standard_Integer k1 = Hasher1::HashCode(K1,NbBuckets());
- Standard_Integer k2 = Hasher2::HashCode(K2,NbBuckets());
- TCollection_DoubleMapNode* p;
- p = data1[k1];
- while (p) {
- if (Hasher1::IsEqual(p->Key1(),K1))
- throw Standard_MultiplyDefined("DoubleMap:Bind");
- p = (TCollection_DoubleMapNode*) p->Next();
- }
- p = data2[k2];
- while (p) {
- if (Hasher2::IsEqual(p->Key2(),K2))
- throw Standard_MultiplyDefined("DoubleMap:Bind");
- p = (TCollection_DoubleMapNode*)p->Next2();
- }
- p = new TCollection_DoubleMapNode(K1,K2,data1[k1],data2[k2]);
- data1[k1] = p;
- data2[k2] = p;
- Increment();
-}
-
-//=======================================================================
-//function : AreBound
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_DoubleMap::AreBound(const TheKey1& K1,
- const TheKey2& K2) const
-{
- if (IsEmpty()) return Standard_False;
- TCollection_DoubleMapNode** data1 = (TCollection_DoubleMapNode**)myData1;
- TCollection_DoubleMapNode** data2 = (TCollection_DoubleMapNode**)myData2;
- Standard_Integer k1 = Hasher1::HashCode(K1,NbBuckets());
- Standard_Integer k2 = Hasher2::HashCode(K2,NbBuckets());
- TCollection_DoubleMapNode *p1, *p2;
- p1 = data1[k1];
- while (p1) {
- if (Hasher1::IsEqual(p1->Key1(),K1)) break;
- p1 = (TCollection_DoubleMapNode*) p1->Next();
- }
- if (p1 == NULL) return Standard_False;
- p2 = data2[k2];
- while (p2) {
- if (Hasher2::IsEqual(p2->Key2(),K2))
- break;
- p2 = (TCollection_DoubleMapNode*)p2->Next2();
- }
- if (p2 == NULL) return Standard_False;
- return p1 == p2;
-}
-
-//=======================================================================
-//function : IsBound1
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_DoubleMap::IsBound1(const TheKey1& K1) const
-{
- if (IsEmpty()) return Standard_False;
- TCollection_DoubleMapNode** data1 = (TCollection_DoubleMapNode**)myData1;
- Standard_Integer k1 = Hasher1::HashCode(K1,NbBuckets());
- TCollection_DoubleMapNode *p1;
- p1 = data1[k1];
- while (p1) {
- if (Hasher1::IsEqual(p1->Key1(),K1)) return Standard_True;
- p1 = (TCollection_DoubleMapNode*) p1->Next();
- }
- return Standard_False;
-}
-
-//=======================================================================
-//function : IsBound2
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_DoubleMap::IsBound2(const TheKey2& K2) const
-{
- if (IsEmpty()) return Standard_False;
- TCollection_DoubleMapNode** data2 = (TCollection_DoubleMapNode**)myData2;
- Standard_Integer k2 = Hasher2::HashCode(K2,NbBuckets());
- TCollection_DoubleMapNode *p2;
- p2 = data2[k2];
- while (p2) {
- if (Hasher2::IsEqual(p2->Key2(),K2)) return Standard_True;
- p2 = (TCollection_DoubleMapNode*)p2->Next2();
- }
- return Standard_False;
-}
-
-//=======================================================================
-//function : Find1
-//purpose :
-//=======================================================================
-
-const TheKey2& TCollection_DoubleMap::Find1(const TheKey1& K1) const
-{
- Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_DoubleMap::Find1");
- TCollection_DoubleMapNode** data1 = (TCollection_DoubleMapNode**)myData1;
- Standard_Integer k1 = Hasher1::HashCode(K1,NbBuckets());
- TCollection_DoubleMapNode *p1;
- p1 = data1[k1];
- while (p1) {
- if (Hasher1::IsEqual(p1->Key1(),K1)) return p1->Key2();
- p1 = (TCollection_DoubleMapNode*) p1->Next();
- }
- throw Standard_NoSuchObject("TCollection_DoubleMap::Find1");
- return p1->Key2();
-}
-
-//=======================================================================
-//function : Find2
-//purpose :
-//=======================================================================
-
-const TheKey1& TCollection_DoubleMap::Find2(const TheKey2& K2) const
-{
- Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_DoubleMap::Find2");
- TCollection_DoubleMapNode** data2 = (TCollection_DoubleMapNode**)myData2;
- Standard_Integer k2 = Hasher2::HashCode(K2,NbBuckets());
- TCollection_DoubleMapNode *p2;
- p2 = data2[k2];
- while (p2) {
- if (Hasher2::IsEqual(p2->Key2(),K2)) return p2->Key1();
- p2 = (TCollection_DoubleMapNode*)p2->Next2();
- }
- throw Standard_NoSuchObject("TCollection_DoubleMap::Find2");
- return p2->Key1();
-}
-
-//=======================================================================
-//function : UnBind1
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_DoubleMap::UnBind1(const TheKey1& K1)
-{
- if (IsEmpty()) return Standard_False;
- TCollection_DoubleMapNode** data1 = (TCollection_DoubleMapNode**)myData1;
- TCollection_DoubleMapNode** data2 = (TCollection_DoubleMapNode**)myData2;
- Standard_Integer k1 = Hasher1::HashCode(K1,NbBuckets());
- Standard_Integer k2;
- TCollection_DoubleMapNode *p1, *p2, *q1, *q2;
- q1 = q2 = NULL;
- p1 = data1[k1];
- while (p1) {
- if (Hasher1::IsEqual(p1->Key1(),K1)) {
- // remove from the first
- if (q1)
- q1->Next() = p1->Next();
- else
- data1[k1] = (TCollection_DoubleMapNode*) p1->Next();
- // remove from the second
- k2 = Hasher2::HashCode(p1->Key2(),NbBuckets());
- p2 = data2[k2];
- while (p2) {
- if (p2 == p1) {
- if (q2)
- q2->Next2() = p2->Next2();
- else
- data2[k2] = (TCollection_DoubleMapNode*)p2->Next2();
- break;
- }
- q2 = p2;
- p2 = (TCollection_DoubleMapNode*)p2->Next2();
- }
- delete p1;
- Decrement();
- return Standard_True;
- }
- q1 = p1;
- p1 = (TCollection_DoubleMapNode*) p1->Next();
- }
- return Standard_False;
-}
-
-//=======================================================================
-//function : UnBind2
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_DoubleMap::UnBind2(const TheKey2& K2)
-{
- if (IsEmpty()) return Standard_False;
- TCollection_DoubleMapNode** data1 = (TCollection_DoubleMapNode**)myData1;
- TCollection_DoubleMapNode** data2 = (TCollection_DoubleMapNode**)myData2;
- Standard_Integer k2 = Hasher2::HashCode(K2,NbBuckets());
- Standard_Integer k1;
- TCollection_DoubleMapNode *p1, *p2, *q1, *q2;
- q1 = q2 = NULL;
- p2 = data2[k2];
- while (p2) {
- if (Hasher2::IsEqual(p2->Key2(),K2)) {
- // remove from the second
- if (q2)
- q2->Next2() = p2->Next2();
- else
- data2[k2] = (TCollection_DoubleMapNode*)p2->Next2();
- // remove from the first
- k1 = Hasher1::HashCode(p2->Key1(),NbBuckets());
- p1 = data1[k1];
- while (p1) {
- if (p2 == p1) {
- if (q1)
- q1->Next() = p1->Next();
- else
- data1[k1] = (TCollection_DoubleMapNode*) p1->Next();
- break;
- }
- q1 = p1;
- p1 = (TCollection_DoubleMapNode*) p1->Next();
- }
- delete p2;
- Decrement();
- return Standard_True;
- }
- q2 = p2;
- p2 = (TCollection_DoubleMapNode*)p2->Next2();
- }
- return Standard_False;
-}
-
-// method of the iterator
-
-//=======================================================================
-//function : Key1
-//purpose :
-//=======================================================================
-
-const TheKey1& TCollection_DoubleMapIterator::Key1() const
-{
- Standard_NoSuchObject_Raise_if(!More(),"TCollection_DoubleMapIterator::Key1");
- return ((TCollection_DoubleMapNode*) myNode)->Key1();
-}
-
-//=======================================================================
-//function : Key2
-//purpose :
-//=======================================================================
-
-const TheKey2& TCollection_DoubleMapIterator::Key2() const
-{
- Standard_NoSuchObject_Raise_if(!More(),"TCollection_DoubleMapIterator::Key2");
- return ((TCollection_DoubleMapNode*) myNode)->Key2();
-}
+++ /dev/null
-// Created on: 1993-02-26
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : TCollection_DoubleMapIterator
-//purpose :
-//=======================================================================
-
-TCollection_DoubleMapIterator::TCollection_DoubleMapIterator() :
- TCollection_BasicMapIterator()
-{}
-
-//=======================================================================
-//function : TCollection_DoubleMapIterator
-//purpose :
-//=======================================================================
-
-TCollection_DoubleMapIterator::TCollection_DoubleMapIterator(const TCollection_DoubleMap& aMap) :
- TCollection_BasicMapIterator(aMap)
-{}
-
-//=======================================================================
-//function : TCollection_DoubleMapIterator
-//purpose :
-//=======================================================================
-
-void TCollection_DoubleMapIterator::Initialize(const TCollection_DoubleMap& aMap)
-{
- TCollection_BasicMapIterator::Initialize(aMap);
-}
-
+++ /dev/null
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline TCollection_DoubleMapNode::TCollection_DoubleMapNode(const TheKey1& K1,const TheKey2& K2,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2)
-: TCollection_MapNode(n1),myKey1(K1),myKey2(K2),myNext2(n2)
-{
-}
-
-inline TheKey1& TCollection_DoubleMapNode::Key1() const
-{
- return (TheKey1&)myKey1;
-}
-
-inline TheKey2& TCollection_DoubleMapNode::Key2() const
-{
- return (TheKey2&)myKey2;
-}
-
-
-inline TCollection_MapNodePtr& TCollection_DoubleMapNode::Next2() const
-{
- return (TCollection_MapNodePtr&)myNext2;
-}
-
+++ /dev/null
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
+++ /dev/null
-// Created on: 1993-03-11
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : TCollection_HArray1
-//purpose :
-//=======================================================================
-
-inline TCollection_HArray1::TCollection_HArray1(const Standard_Integer First,
- const Standard_Integer Last) :
- myArray(First,Last)
-{
-}
-
-//=======================================================================
-//function : Length
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_HArray1::Length () const
-{
- return myArray.Length();
-}
-
-//=======================================================================
-//function : TCollection_HArray1
-//purpose :
-//=======================================================================
-inline TCollection_HArray1::TCollection_HArray1(const Standard_Integer First,
- const Standard_Integer Last,
- const ItemHArray1& V) :
- myArray(First,Last)
-{
- myArray.Init(V);
-}
-
-
-//=======================================================================
-//function : Init
-//purpose :
-//=======================================================================
-
-inline void TCollection_HArray1::Init(const ItemHArray1& V)
-{
- myArray.Init(V);
-}
-
-//=======================================================================
-//function : Lower
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_HArray1::Lower () const
-{
- return myArray.Lower();
-}
-
-//=======================================================================
-//function : Upper
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_HArray1::Upper () const
-{
- return myArray.Upper();
-}
-
-//=======================================================================
-//function : SetValue
-//purpose :
-//=======================================================================
-
-inline void TCollection_HArray1::SetValue (const Standard_Integer Index,
- const ItemHArray1& Value)
-{
- myArray.SetValue(Index,Value);
-}
-
-//=======================================================================
-//function : Array1
-//purpose :
-//=======================================================================
-
-inline const TheArray1& TCollection_HArray1::Array1() const
-{
- return myArray;
-}
-
-
-//=======================================================================
-//function : ChangeArray1
-//purpose :
-//=======================================================================
-
-inline TheArray1& TCollection_HArray1::ChangeArray1()
-{
- return myArray;
-}
-
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-
-inline const ItemHArray1& TCollection_HArray1::Value(const Standard_Integer Index) const
-{
- return myArray(Index);
-}
-
-//=======================================================================
-//function : ChangeValue
-//purpose :
-//=======================================================================
-
-inline ItemHArray1& TCollection_HArray1::ChangeValue(const Standard_Integer Index)
-{
- return myArray(Index);
-}
-
-
+++ /dev/null
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : IsSameState
-//purpose :
-//=======================================================================
-
-//Standard_Boolean TCollection_HArray2::IsSameState
-// (const Handle (TCollection_HArray2)& other) const
-//{
-// const TheArray2 & otherArray =
-// Handle(TCollection_HArray2)::DownCast(other)->Array2();
-// for (Standard_Integer i = myArray.LowerRow();
-// i <= myArray.UpperRow();
-// i++) {
-// for (Standard_Integer j = myArray.LowerCol();
-// j <= myArray.UpperCol();
-// j++) {
-// if (!(myArray(i,j) == otherArray(i,j))) return Standard_False;
-// }
-// }
-// return Standard_True;
-//}
+++ /dev/null
-// Created on: 1993-03-11
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : TCollection_HArray2
-//purpose :
-//=======================================================================
-
-inline TCollection_HArray2::TCollection_HArray2 (const Standard_Integer R1,
- const Standard_Integer R2,
- const Standard_Integer C1,
- const Standard_Integer C2) :
- myArray(R1,R2,C1,C2)
-{}
-
-
-//=======================================================================
-//function : TCollection_HArray2
-//purpose :
-//=======================================================================
-
-inline TCollection_HArray2::TCollection_HArray2 (const Standard_Integer R1,
- const Standard_Integer R2,
- const Standard_Integer C1,
- const Standard_Integer C2,
- const ItemHArray2& V) :
- myArray(R1,R2,C1,C2)
-{myArray.Init(V);}
-
-//=======================================================================
-//function : TCollection_HArray2
-//purpose :
-//=======================================================================
-
-inline void TCollection_HArray2::Init(const ItemHArray2& V)
-{ myArray.Init(V);}
-
-//=======================================================================
-//function : ColLength
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_HArray2::ColLength () const
-{
- return myArray.ColLength();
-}
-
-//=======================================================================
-//function : LowerCol
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_HArray2::LowerCol () const
-{
- return myArray.LowerCol();
-}
-
-//=======================================================================
-//function : LowerRow
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_HArray2::LowerRow () const
-{
- return myArray.LowerRow();
-}
-
-//=======================================================================
-//function : RowLength
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_HArray2::RowLength () const
-{
- return myArray.RowLength();
-}
-
-//=======================================================================
-//function : UpperRow
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_HArray2::UpperRow () const
-{
- return myArray.UpperRow();
-}
-
-//=======================================================================
-//function : UpperCol
-//purpose :
-//=======================================================================
-
-inline Standard_Integer TCollection_HArray2::UpperCol () const
-{
- return myArray.UpperCol();
-}
-
-//=======================================================================
-//function : SetValue
-//purpose :
-//=======================================================================
-
-inline void TCollection_HArray2::SetValue ( const Standard_Integer Row,
- const Standard_Integer Col,
- const ItemHArray2& Value )
-{
- myArray.SetValue(Row,Col,Value);
-}
-
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-
-inline const ItemHArray2& TCollection_HArray2::Value(const Standard_Integer Row,
- const Standard_Integer Col) const
-{
- return myArray(Row,Col);
-}
-
-//=======================================================================
-//function : ChangeValue
-//purpose :
-//=======================================================================
-
-inline ItemHArray2& TCollection_HArray2::ChangeValue(const Standard_Integer Row,
- const Standard_Integer Col)
-{
- return myArray(Row,Col);
-}
-
-
-//=======================================================================
-//function : Array2
-//purpose :
-//=======================================================================
-
-inline const TheArray2& TCollection_HArray2::Array2() const
-{
- return myArray;
-}
-
-//=======================================================================
-//function : ChangeArray2
-//purpose :
-//=======================================================================
-
-inline TheArray2& TCollection_HArray2::ChangeArray2()
-{
- return myArray;
-}
+++ /dev/null
-// Created on: 1992-11-24
-// Created by: Mireille MERCIEN
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// ----------------------------------------------------------------------
-// ----------------------------------------------------------------------
-
-// ----------------------------------
-// Clear : Clear the Current HSequence
-// ----------------------------------
-void TCollection_HSequence::Clear()
-{
- mySequence.Clear();
-}
-
-// -------------------------------------------------
-// Append : Push an item at the end of the sequence
-// -------------------------------------------------
-void TCollection_HSequence::Append(const Item& T)
-{
- mySequence.Append(T);
-}
-
-// ---------------------------------------------------
-// Append : Push a Sequence at the end of the sequence
-// ---------------------------------------------------
-void TCollection_HSequence::Append(const Handle(TCollection_HSequence)& S)
-{
- Standard_Integer i,l = S->Length();
- for (i = 1; i <= l; i++) mySequence.Append(S->Value(i));
-}
-
-// ---------------------------------------------------------
-// Prepend : Push an element at the begining of the sequence
-// ---------------------------------------------------------
-void TCollection_HSequence::Prepend(const Item& T)
-{
- mySequence.Prepend(T);
-}
-
-// ---------------------------------------------------------
-// Prepend : Push an element at the begining of the sequence
-// ---------------------------------------------------------
-void TCollection_HSequence::Prepend(const Handle(TCollection_HSequence)& S)
-{
- Standard_Integer i,l = S->Length();
- for (i = 0; i < l; i++) mySequence.Prepend(S->Value(S->Length()-i));
-}
-
-// ---------------------------------------------------------
-// Reverse : Reverse the order of a given sequence
-// ---------------------------------------------------------
-void TCollection_HSequence::Reverse()
-{
- mySequence.Reverse();
-}
-
-// -------------------------------------------------------------------
-// InsertBefore : Insert an item before a given index in the sequence
-// --------------------------------------------------------------------
-void TCollection_HSequence::InsertBefore(const Standard_Integer Index,
- const Item& T)
-{
- mySequence.InsertBefore(Index,T);
-}
-
-// ----------------------------------------------------------------------
-// InsertBefore : Insert a sequence before a specific index in a HSequence
-// ----------------------------------------------------------------------
-void TCollection_HSequence::InsertBefore(const Standard_Integer Index ,
- const Handle(TCollection_HSequence)& S)
-{
- Standard_Integer i,l = S->Length();
- for (i = 1; i <= l; i++) mySequence.InsertBefore(Index+i-1,S->Value(i));
-}
-
-// -----------------------------------------------------------------
-// InsertAfter : Insert an element after a given index in a sequence
-// -----------------------------------------------------------------
-void TCollection_HSequence::InsertAfter(const Standard_Integer Index,
- const Item& T)
-{
- mySequence.InsertAfter(Index,T);
-}
-
-// -------------------------------------------------------------------
-// InsertAfter : Insert a sequence after a given index in the sequence
-// -------------------------------------------------------------------
-void TCollection_HSequence::InsertAfter(const Standard_Integer Index,
- const Handle(TCollection_HSequence)& S)
-{
- Standard_Integer i,l = S->Length();
- for (i = 1; i <= l; i++) mySequence.InsertAfter(Index+i-1,S->Value(i));
-}
-
-// ----------------------------------------
-// Exchange : Exchange two elements in the sequence
-// ----------------------------------------
-void TCollection_HSequence::Exchange(const Standard_Integer I,
- const Standard_Integer J)
-{
- mySequence.Exchange(I,J);
-}
-
-// ---------------------------------------------
-// Split : Split a sequence in two sub-sequences
-// ---------------------------------------------
-Handle (TCollection_HSequence)
- TCollection_HSequence::Split(const Standard_Integer Index)
-{
- TheSequence SS;
- mySequence.Split(Index,SS);
- Handle(TCollection_HSequence) NS = new TCollection_HSequence();
- Standard_Integer i,l = SS.Length();
- for (i=1; i<= l; i++) NS->Append(SS(i));
- return NS;
-}
-
-// ----------------------------------------------------------
-// SetValue : Change the element of a given index in a sequence
-// ----------------------------------------------------------
-void TCollection_HSequence::SetValue(const Standard_Integer Index,
- const Item& T)
-{
- mySequence(Index) = T;
-}
-
-// -----------------------------------------
-// Value : Return the value of a given index
-// -----------------------------------------
-const Item& TCollection_HSequence::Value(const Standard_Integer Index) const
-{
- return (mySequence(Index));
-}
-
-// -----------------------------------------
-// ChangeValue : Return the value of a given index
-// -----------------------------------------
-Item& TCollection_HSequence::ChangeValue(const Standard_Integer Index)
-{
- return (mySequence(Index));
-}
-
-// -------------------------------------
-// Remove : Remove an item in a sequence
-// -------------------------------------
-void TCollection_HSequence::Remove(const Standard_Integer Index)
-{
- mySequence.Remove(Index);
-}
-
-// ---------------------
-// Remove a set of items
-// ---------------------
-void TCollection_HSequence::Remove(const Standard_Integer From,
- const Standard_Integer To)
-{
- mySequence.Remove(From,To);
-}
-
-// ----------------------------------------------------------------------------
-// IsSamestate
-// ----------------------------------------------------------------------------
-// Standard_Boolean TCollection_HSequence::IsSameState
-// (const Handle(TCollection_HSequence)& other) const
-// {
-// Handle(TCollection_HSequence) Seq =
-// Handle(TCollection_HSequence)::DownCast(other);
-// if (Seq->Length() != Length()) return Standard_False;
-// for (Standard_Integer I = 1; I<= Length(); I++) {
-// if ( !(Value(I) == Seq->Value(I)) ) return Standard_False;
-// }
-// return Standard_True;
-// }
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-// Created on: 1993-03-12
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// -----------
-// constructor :
-// -----------
-inline TCollection_HSequence::TCollection_HSequence(){}
-
-//--------------------------------------------------
-// IsEmpty: Returns True if the Sequence is empty
-//--------------------------------------------------
-inline Standard_Boolean TCollection_HSequence::IsEmpty() const
-{
- return mySequence.IsEmpty();
-}
-
-//--------------------------------------------------
-// Length : Returns the length of the sequence
-//--------------------------------------------------
-inline Standard_Integer TCollection_HSequence::Length() const
-{
- return mySequence.Length();
-}
-
-//=======================================================================
-//function : Sequence
-//purpose :
-//=======================================================================
-
-inline const TheSequence& TCollection_HSequence::Sequence() const
-{
- return mySequence;
-}
-
-
-//=======================================================================
-//function : ChangeSequence
-//purpose :
-//=======================================================================
-
-inline TheSequence& TCollection_HSequence::ChangeSequence()
-{
- return mySequence;
-}
-
+++ /dev/null
-// Created on: 1993-01-08
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_DomainError.hxx>
-#include <Standard_MultiplyDefined.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_OutOfRange.hxx>
-#include <TCollection_BasicMapIterator.hxx>
-
-//=======================================================================
-//function : TCollection_IndexedDataMap
-//purpose :
-//=======================================================================
-
-TCollection_IndexedDataMap::TCollection_IndexedDataMap
- (const Standard_Integer NbBuckets):
- TCollection_BasicMap(NbBuckets,Standard_False)
-{
-}
-
-//=======================================================================
-//function : TCollection_IndexedDataMap
-//purpose :
-//=======================================================================
-
-TCollection_IndexedDataMap::TCollection_IndexedDataMap
- (const TCollection_IndexedDataMap& Other) :
- TCollection_BasicMap(Other.NbBuckets(),Standard_False)
-{
- if (Other.Extent() != 0)
- throw Standard_DomainError("TCollection:Copy of non empty IndexedDataMap");
-}
-
-//=======================================================================
-//function : Assign
-//purpose :
-//=======================================================================
-
-TCollection_IndexedDataMap& TCollection_IndexedDataMap::Assign
- (const TCollection_IndexedDataMap& Other)
-{
- // very simple implementation
- // not optimal (recompute the hashcode values)
-
- if (this == &Other) return *this;
- Clear();
-// ReSize(Other.NbBuckets());
- if (!Other.IsEmpty()) {
- ReSize(Other.Extent());
- for (Standard_Integer i = 1; i <= Other.Extent(); i++) {
- Add(Other.FindKey(i),Other(i));
- }
- }
- return *this;
-}
-
-
-
-//=======================================================================
-//function : ReSize
-//purpose :
-//=======================================================================
-
-void TCollection_IndexedDataMap::ReSize(const Standard_Integer N)
-{
- Standard_Integer newBuck;
- Standard_Address newData1=NULL, newData2=NULL;
- if (BeginResize(N,newBuck,newData1,newData2)) {
- if (myData1) {
- TCollection_IndexedDataMapNode** newdata1 = (TCollection_IndexedDataMapNode**)newData1;
- TCollection_IndexedDataMapNode** newdata2 = (TCollection_IndexedDataMapNode**)newData2;
- TCollection_IndexedDataMapNode** olddata1 = (TCollection_IndexedDataMapNode**) myData1;
- TCollection_IndexedDataMapNode *p, *q;
- Standard_Integer i,k1,k2;
- for (i = 0; i <= NbBuckets(); i++) {
- if (olddata1[i]) {
- p = olddata1[i];
- while (p) {
- k1 = Hasher::HashCode(p->Key1(),newBuck);
- k2 = ::HashCode(p->Key2(),newBuck);
- q = (TCollection_IndexedDataMapNode*)p->Next();
- p->Next() = newdata1[k1];
- p->Next2() = newdata2[k2];
- newdata1[k1] = p;
- newdata2[k2] = p;
- p = q;
- }
- }
- }
- }
- EndResize(N,newBuck,newData1,newData2);
- }
-}
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-void TCollection_IndexedDataMap::Clear()
-{
- if (!IsEmpty()) {
- Standard_Integer i;
- TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**) myData1;
- TCollection_IndexedDataMapNode** data2 = (TCollection_IndexedDataMapNode**) myData2;
- TCollection_IndexedDataMapNode *p,*q;
- for (i = 0; i <= NbBuckets(); i++) {
- p = data1[i];
- while (p) {
- q = (TCollection_IndexedDataMapNode*) p->Next();
- delete p;
- p = q;
- }
- data1[i] = data2[i] = NULL;
- }
- }
- TCollection_BasicMap::Destroy();
-}
-
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-
-Standard_Integer TCollection_IndexedDataMap::Add(const TheKey& K1, const TheItem& I)
-{
- if (Resizable()) ReSize(Extent());
- TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- TCollection_IndexedDataMapNode* p;
- p = data1[k1];
- while (p) {
- if (Hasher::IsEqual(p->Key1(),K1))
- return p->Key2();
- p = (TCollection_IndexedDataMapNode*) p->Next();
- }
- Increment();
- TCollection_IndexedDataMapNode** data2 = (TCollection_IndexedDataMapNode**)myData2;
- Standard_Integer k2 = ::HashCode(Extent(),NbBuckets());
- p = new TCollection_IndexedDataMapNode(K1,Extent(),I,data1[k1],data2[k2]);
- data1[k1] = p;
- data2[k2] = p;
- return Extent();
-}
-
-
-//=======================================================================
-//function : Substitute
-//purpose :
-//=======================================================================
-
-void TCollection_IndexedDataMap::Substitute(const Standard_Integer I,
- const TheKey& K1,
- const TheItem& T)
-{
- Standard_OutOfRange_Raise_if(I < 1 || I > Extent(), "IndexedDataMap::Substitute : "
- "Index is out of range");
- TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
- TCollection_IndexedDataMapNode* p;
-
- // check if K1 is not already in the map
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- p = data1[k1];
- while (p) {
- if (Hasher::IsEqual(p->Key1(),K1)) {
- if (p->Key2() != I)
- throw Standard_DomainError("IndexedDataMap::Substitute : "
- "Attempt to substitute existing key");
- p->Key1() = K1;
- p->Value() = T;
- return;
- }
- p = (TCollection_IndexedDataMapNode*) p->Next();
- }
-
- // Find the node for the index I
- TCollection_IndexedDataMapNode** data2 = (TCollection_IndexedDataMapNode**)myData2;
- Standard_Integer k2 = ::HashCode(I,NbBuckets());
- p = data2[k2];
- while (p) {
- if (p->Key2() == I)
- break;
- p = (TCollection_IndexedDataMapNode*) p->Next2();
- }
-
- // remove the old key
- Standard_Integer k = Hasher::HashCode(p->Key1(),NbBuckets());
- TCollection_IndexedDataMapNode* q = data1[k];
- if (q == p) data1[k] = (TCollection_IndexedDataMapNode*) p->Next();
- else {
- while(q->Next() != p) q = (TCollection_IndexedDataMapNode*) q->Next();
- q->Next() = p->Next();
- }
-
- // update the node
- p->Key1() = K1;
- p->Value() = T;
- p->Next() = data1[k1];
- data1[k1] = p;
-}
-
-//=======================================================================
-//function : RemoveLast
-//purpose :
-//=======================================================================
-
-void TCollection_IndexedDataMap::RemoveLast()
-{
- Standard_OutOfRange_Raise_if(Extent() == 0,
- "IndexedMap::RemoveLast");
- TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
- TCollection_IndexedDataMapNode* p;
- TCollection_IndexedDataMapNode* q;
-
- // Find the node for the last index and remove it
- TCollection_IndexedDataMapNode** data2 = (TCollection_IndexedDataMapNode**)myData2;
- Standard_Integer k2 = ::HashCode(Extent(),NbBuckets());
- p = data2[k2];
- q = NULL;
- while (p) {
- if (p->Key2() == Extent())
- break;
- q = p;
- p = (TCollection_IndexedDataMapNode*) p->Next2();
- }
- if (q == NULL)
- data2[k2] = (TCollection_IndexedDataMapNode*)p->Next2();
- else
- q->Next2() = p->Next2();
-
- // remove the key
- Standard_Integer k = Hasher::HashCode(p->Key1(),NbBuckets());
- q = data1[k];
- if (q == p) data1[k] = (TCollection_IndexedDataMapNode*) p->Next();
- else {
- while(q->Next() != p) q = (TCollection_IndexedDataMapNode*) q->Next();
- q->Next() = p->Next();
- }
-
- Decrement();
- delete p;
-}
-
-
-//=======================================================================
-//function : FindKey
-//purpose :
-//=======================================================================
-
-const TheKey& TCollection_IndexedDataMap::FindKey(const Standard_Integer K2) const
-{
- Standard_OutOfRange_Raise_if(K2 < 1 || K2 > Extent(), "IndexedDataMap");
- TCollection_IndexedDataMapNode** data2 = (TCollection_IndexedDataMapNode**)myData2;
- Standard_Integer k2 = ::HashCode(K2,NbBuckets());
- TCollection_IndexedDataMapNode *p2;
- p2 = data2[k2];
- while (p2) {
- if (p2->Key2() == K2) return p2->Key1();
- p2 = (TCollection_IndexedDataMapNode*)p2->Next2();
- }
- throw Standard_OutOfRange("IndexedDataMap : missing index !!!");
- return p2->Key1();
-}
-
-//=======================================================================
-//function : FindFromIndex
-//purpose :
-//=======================================================================
-
-const TheItem& TCollection_IndexedDataMap::FindFromIndex
- (const Standard_Integer K2) const
-{
- Standard_OutOfRange_Raise_if(K2 < 1 || K2 > Extent(), "IndexedDataMap");
- TCollection_IndexedDataMapNode** data2 = (TCollection_IndexedDataMapNode**)myData2;
- Standard_Integer k2 = ::HashCode(K2,NbBuckets());
- TCollection_IndexedDataMapNode *p2;
- p2 = data2[k2];
- while (p2) {
- if (p2->Key2() == K2) return p2->Value();
- p2 = (TCollection_IndexedDataMapNode*)p2->Next2();
- }
- throw Standard_OutOfRange("IndexedDataMap : missing index !!!");
- return p2->Value();
-}
-
-//=======================================================================
-//function : ChangeFromIndex
-//purpose :
-//=======================================================================
-
-TheItem& TCollection_IndexedDataMap::ChangeFromIndex(const Standard_Integer K2)
-{
- Standard_OutOfRange_Raise_if(K2 < 1 || K2 > Extent(), "IndexedDataMap");
- TCollection_IndexedDataMapNode** data2 = (TCollection_IndexedDataMapNode**)myData2;
- Standard_Integer k2 = ::HashCode(K2,NbBuckets());
- TCollection_IndexedDataMapNode *p2;
- p2 = data2[k2];
- while (p2) {
- if (p2->Key2() == K2) return p2->Value();
- p2 = (TCollection_IndexedDataMapNode*)p2->Next2();
- }
- throw Standard_OutOfRange("IndexedDataMap : missing index !!!");
- return p2->Value();
-}
-
-//=======================================================================
-//function : FindIndex
-//purpose :
-//=======================================================================
-
-Standard_Integer TCollection_IndexedDataMap::FindIndex(const TheKey& K1) const
-{
- if (IsEmpty()) return 0;
- TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- TCollection_IndexedDataMapNode *p1;
- p1 = data1[k1];
- while (p1) {
- if (Hasher::IsEqual(p1->Key1(),K1)) return p1->Key2();
- p1 = (TCollection_IndexedDataMapNode*)p1->Next();
- }
- return 0;
-}
-//=======================================================================
-//function : Contains
-//purpose :
-//=======================================================================
-Standard_Boolean TCollection_IndexedDataMap::Contains(const TheKey& K1) const
-{
- if (IsEmpty()) return Standard_False;
- TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- TCollection_IndexedDataMapNode *p1;
- p1 = data1[k1];
- while (p1) {
- if (Hasher::IsEqual(p1->Key1(),K1)) return Standard_True;
- p1 = (TCollection_IndexedDataMapNode*) p1->Next();
- }
- return Standard_False;
-}
-//=======================================================================
-//function : FindFromKey
-//purpose :
-//=======================================================================
-const TheItem& TCollection_IndexedDataMap::FindFromKey(const TheKey& K1) const
-{
- Standard_OutOfRange_Raise_if(IsEmpty(),"TCollection_IndexedDataMap::FindFromKey");
- TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- TCollection_IndexedDataMapNode *p1;
- p1 = data1[k1];
- while (p1) {
- if (Hasher::IsEqual(p1->Key1(),K1)) return p1->Value();
- p1 = (TCollection_IndexedDataMapNode*) p1->Next();
- }
- throw Standard_OutOfRange("TCollection_IndexedDataMap::FindFromKey");
- return p1->Value();
-}
-//=======================================================================
-//function : ChangeFromKey
-//purpose :
-//=======================================================================
-TheItem& TCollection_IndexedDataMap::ChangeFromKey(const TheKey& K1)
-{
- Standard_OutOfRange_Raise_if(IsEmpty(),"TCollection_IndexedDataMap::ChangeFromKey");
- TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- TCollection_IndexedDataMapNode *p1;
- p1 = data1[k1];
- while (p1) {
- if (Hasher::IsEqual(p1->Key1(),K1)) return p1->Value();
- p1 = (TCollection_IndexedDataMapNode*)p1->Next();
- }
- throw Standard_OutOfRange("TCollection_IndexedDataMap::ChangeFromKey");
- return p1->Value();
-}
-//modified by NIZNHY-PKV Tue Jul 05 08:37:03 2011f
-//=======================================================================
-//function : FindFromKey1
-//purpose :
-//=======================================================================
-Standard_Address TCollection_IndexedDataMap::FindFromKey1(const TheKey& K1) const
-{
- TCollection_IndexedDataMap *pMap=(TCollection_IndexedDataMap *)this;
- return pMap->ChangeFromKey1(K1);
-}
-//=======================================================================
-//function : ChangeFromKey1
-//purpose :
-//=======================================================================
-Standard_Address TCollection_IndexedDataMap::ChangeFromKey1(const TheKey& K1)
-{
- if (IsEmpty()) {
- return NULL;
- }
- TCollection_IndexedDataMapNode** data1 = (TCollection_IndexedDataMapNode**)myData1;
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- TCollection_IndexedDataMapNode *p1;
- p1 = data1[k1];
- while (p1) {
- if (Hasher::IsEqual(p1->Key1(),K1)) {
- return (Standard_Address)&p1->Value();
- }
- p1 = (TCollection_IndexedDataMapNode*) p1->Next();
- }
- return NULL;
-}
+++ /dev/null
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline TCollection_IndexedDataMapNode::TCollection_IndexedDataMapNode(const TheKey& K1,const Standard_Integer K2,const TheItem& I,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2)
-: TCollection_MapNode(n1),myKey1(K1),myKey2(K2),myNext2(n2)
-{
- myValue = I;
-}
-
-inline TheKey& TCollection_IndexedDataMapNode::Key1() const
-{
- return (TheKey&)myKey1;
-}
-
-inline Standard_Integer& TCollection_IndexedDataMapNode::Key2() const
-{
- return (Standard_Integer&)myKey2;
-}
-
-
-inline TCollection_MapNodePtr& TCollection_IndexedDataMapNode::Next2() const
-{
- return (TCollection_MapNodePtr&)myNext2;
-}
-
-inline TheItem & TCollection_IndexedDataMapNode::Value() const
-{
- return (TheItem&)myValue;
-}
+++ /dev/null
-// Created on: 1993-01-08
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_DomainError.hxx>
-#include <Standard_MultiplyDefined.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Standard_OutOfRange.hxx>
-#include <TCollection_BasicMapIterator.hxx>
-
-
-//=======================================================================
-//function : TCollection_IndexedMap
-//purpose :
-//=======================================================================
-
-TCollection_IndexedMap::TCollection_IndexedMap
- (const Standard_Integer NbBuckets):
- TCollection_BasicMap(NbBuckets,Standard_False)
-{
-}
-
-//=======================================================================
-//function : TCollection_IndexedMap
-//purpose :
-//=======================================================================
-
-TCollection_IndexedMap::TCollection_IndexedMap
- (const TCollection_IndexedMap& Other) :
- TCollection_BasicMap(Other.NbBuckets(),Standard_False)
-{
- if (!Other.IsEmpty()) {
- ReSize(Other.Extent());
- for (Standard_Integer i = 1; i <= Other.Extent(); i++) {
- Add(Other(i));
- }
- }
-}
-
-//=======================================================================
-//function : Assign
-//purpose :
-//=======================================================================
-
-TCollection_IndexedMap& TCollection_IndexedMap::Assign
- (const TCollection_IndexedMap& Other)
-{
- // very simple implementation
- // not optimal (recompute the hashcode values)
-
- if (this == &Other) return *this;
- Clear();
-// ReSize(Other.NbBuckets());
- if (!Other.IsEmpty()) {
- ReSize(Other.Extent());
- for (Standard_Integer i = 1; i <= Other.Extent(); i++) {
- Add(Other(i));
- }
- }
- return *this;
-}
-
-//=======================================================================
-//function : ReSize
-//purpose :
-//=======================================================================
-
-void TCollection_IndexedMap::ReSize(const Standard_Integer N)
-{
- Standard_Integer newBuck;
- Standard_Address newData1, newData2;
- if (BeginResize(N,newBuck,newData1,newData2)) {
- if (myData1) {
- TCollection_IndexedMapNode** newdata1 = (TCollection_IndexedMapNode**)newData1;
- TCollection_IndexedMapNode** newdata2 = (TCollection_IndexedMapNode**)newData2;
- TCollection_IndexedMapNode** olddata1 = (TCollection_IndexedMapNode**) myData1;
- TCollection_IndexedMapNode *p, *q;
- Standard_Integer i,k1,k2;
- for (i = 0; i <= NbBuckets(); i++) {
- if (olddata1[i]) {
- p = olddata1[i];
- while (p) {
- k1 = Hasher::HashCode(p->Key1(),newBuck);
- q = (TCollection_IndexedMapNode*) p->Next();
- p->Next() = newdata1[k1];
- newdata1[k1] = p;
- if (p->Key2() > 0) {
- k2 = ::HashCode(p->Key2(),newBuck);
- p->Next2() = newdata2[k2];
- newdata2[k2] = p;
- }
- p = q;
- }
- }
- }
- }
- EndResize(N,newBuck,newData1,newData2);
- }
-}
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-void TCollection_IndexedMap::Clear()
-{
- if (!IsEmpty()) {
- Standard_Integer i;
- TCollection_IndexedMapNode** data1 = (TCollection_IndexedMapNode**) myData1;
-// TCollection_IndexedMapNode** data2 = (TCollection_IndexedMapNode**) myData2;
- TCollection_IndexedMapNode *p,*q;
- for (i = 0; i <= NbBuckets(); i++) {
- p = data1[i];
- while (p) {
- q = (TCollection_IndexedMapNode*) p->Next();
- delete p;
- p = q;
- }
- }
- }
- TCollection_BasicMap::Destroy();
-}
-
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-
-Standard_Integer TCollection_IndexedMap::Add(const TheKey& K1)
-{
- if (Resizable()) ReSize(Extent());
- TCollection_IndexedMapNode** data1 = (TCollection_IndexedMapNode**)myData1;
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- TCollection_IndexedMapNode* p;
- p = data1[k1];
- while (p) {
- if (Hasher::IsEqual(p->Key1(),K1))
- return p->Key2();
- p = (TCollection_IndexedMapNode*) p->Next();
- }
- Increment();
- TCollection_IndexedMapNode** data2 = (TCollection_IndexedMapNode**)myData2;
- Standard_Integer k2 = ::HashCode(Extent(),NbBuckets());
- p = new TCollection_IndexedMapNode(K1,Extent(),data1[k1],data2[k2]);
- data1[k1] = p;
- data2[k2] = p;
- return Extent();
-}
-
-//=======================================================================
-//function : Substitute
-//purpose :
-//=======================================================================
-
-void TCollection_IndexedMap::Substitute(const Standard_Integer I,
- const TheKey& K1)
-{
- Standard_OutOfRange_Raise_if(I < 1 || I > Extent(), "IndexedMap::Substitute : "
- "Index is out of range");
- TCollection_IndexedMapNode** data1 = (TCollection_IndexedMapNode**)myData1;
- TCollection_IndexedMapNode* p;
-
- // check if K1 is not already in the map
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- p = data1[k1];
- while (p) {
- if (Hasher::IsEqual(p->Key1(),K1)) {
- if (p->Key2() != I)
- throw Standard_DomainError("IndexedMap::Substitute : "
- "Attempt to substitute existing key");
- p->Key1() = K1;
- return;
- }
- p = (TCollection_IndexedMapNode*) p->Next();
- }
-
- // Find the node for the index I
- TCollection_IndexedMapNode** data2 = (TCollection_IndexedMapNode**)myData2;
- Standard_Integer k2 = ::HashCode(I,NbBuckets());
- p = data2[k2];
- while (p) {
- if (p->Key2() == I)
- break;
- p = (TCollection_IndexedMapNode*) p->Next2();
- }
-
- // remove the old key
- Standard_Integer k = Hasher::HashCode(p->Key1(),NbBuckets());
- TCollection_IndexedMapNode* q = data1[k];
- if (q == p) data1[k] = (TCollection_IndexedMapNode*) p->Next();
- else {
- while(q->Next() != p) q = (TCollection_IndexedMapNode*) q->Next();
- q->Next() = p->Next();
- }
-
- // update the node
- p->Key1() = K1;
- p->Next() = data1[k1];
- data1[k1] = p;
-}
-
-//=======================================================================
-//function : RemoveLast
-//purpose :
-//=======================================================================
-
-void TCollection_IndexedMap::RemoveLast()
-{
- Standard_OutOfRange_Raise_if(Extent() == 0,
- "IndexedMap::RemoveLast");
- TCollection_IndexedMapNode** data1 = (TCollection_IndexedMapNode**)myData1;
- TCollection_IndexedMapNode* p;
- TCollection_IndexedMapNode* q;
-
- // Find the node for the last index and remove it
- TCollection_IndexedMapNode** data2 = (TCollection_IndexedMapNode**)myData2;
- Standard_Integer k2 = ::HashCode(Extent(),NbBuckets());
- p = data2[k2];
- q = NULL;
- while (p) {
- if (p->Key2() == Extent())
- break;
- q = p;
- p = (TCollection_IndexedMapNode*) p->Next2();
- }
- if (q == NULL)
- data2[k2] = (TCollection_IndexedMapNode*)p->Next2();
- else
- q->Next2() = p->Next2();
-
- // remove the key
- Standard_Integer k = Hasher::HashCode(p->Key1(),NbBuckets());
- q = data1[k];
- if (q == p) data1[k] = (TCollection_IndexedMapNode*) p->Next();
- else {
- while(q->Next() != p) q = (TCollection_IndexedMapNode*) q->Next();
- q->Next() = p->Next();
- }
-
- Decrement();
- delete p;
-}
-
-//=======================================================================
-//function : Contains
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_IndexedMap::Contains(const TheKey& K1) const
-{
- if (IsEmpty()) return Standard_False;
- TCollection_IndexedMapNode** data1 = (TCollection_IndexedMapNode**)myData1;
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- TCollection_IndexedMapNode *p1;
- p1 = data1[k1];
- while (p1) {
- if (Hasher::IsEqual(p1->Key1(),K1)) return Standard_True;
- p1 = (TCollection_IndexedMapNode*) p1->Next();
- }
- return Standard_False;
-}
-
-//=======================================================================
-//function : FindKey
-//purpose :
-//=======================================================================
-
-const TheKey& TCollection_IndexedMap::FindKey(const Standard_Integer K2) const
-{
- Standard_OutOfRange_Raise_if(K2 < 1 || K2 > Extent(), "IndexedMap");
- TCollection_IndexedMapNode** data2 = (TCollection_IndexedMapNode**)myData2;
- Standard_Integer k2 = ::HashCode(K2,NbBuckets());
- TCollection_IndexedMapNode *p2;
- p2 = data2[k2];
- while (p2) {
- if (p2->Key2() == K2) return p2->Key1();
- p2 = (TCollection_IndexedMapNode*)p2->Next2();
- }
- throw Standard_OutOfRange("IndexedMap : missing index !!!");
- return p2->Key1();
-}
-
-//=======================================================================
-//function : FindIndex
-//purpose :
-//=======================================================================
-
-Standard_Integer TCollection_IndexedMap::FindIndex(const TheKey& K1) const
-{
- if (IsEmpty()) return 0;
- TCollection_IndexedMapNode** data1 = (TCollection_IndexedMapNode**)myData1;
- Standard_Integer k1 = Hasher::HashCode(K1,NbBuckets());
- TCollection_IndexedMapNode *p1;
- p1 = data1[k1];
- while (p1) {
- if (Hasher::IsEqual(p1->Key1(),K1)) return p1->Key2();
- p1 = (TCollection_IndexedMapNode*) p1->Next();
- }
- return 0;
-}
+++ /dev/null
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline TCollection_IndexedMapNode::TCollection_IndexedMapNode(const TheKey& K1,const Standard_Integer K2,const TCollection_MapNodePtr& n1,const TCollection_MapNodePtr& n2)
-: TCollection_MapNode(n1),myKey1(K1),myKey2(K2),myNext2(n2)
-{
-}
-
-inline TheKey& TCollection_IndexedMapNode::Key1() const
-{
- return (TheKey&)myKey1;
-}
-
-inline Standard_Integer& TCollection_IndexedMapNode::Key2() const
-{
- return (Standard_Integer&)myKey2;
-}
-
-
-inline TCollection_MapNodePtr& TCollection_IndexedMapNode::Next2() const
-{
- return (TCollection_MapNodePtr&)myNext2;
-}
+++ /dev/null
-// Created on: 1992-12-17
-// Created by: Remi LEQUETTE
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// Revised: Thu Jan 17 11:40:17 1995
-// By: Mireille MERCIEN
-
-
-#include <Standard_NoMoreObject.hxx>
-#include <Standard_NoSuchObject.hxx>
-
-//=======================================================================
-//function : TCollection_List
-//purpose :
-//=======================================================================
-
-TCollection_List::TCollection_List() :
- myFirst(NULL),
- myLast(NULL)
-{}
-
-//=======================================================================
-//function : TCollection_List
-//purpose :
-//=======================================================================
-
-TCollection_List::TCollection_List(const TCollection_List& Other) :
- myFirst(NULL),
- myLast(NULL)
-{
- if (!Other.IsEmpty()) {
-// cout << "List copied : magic constructor"<<endl;
- TCollection_ListIterator It(Other);
- while (It.More()) {
- Append(It.Value());
- It.Next();
- }
- }
-}
-
-//=======================================================================
-//function : Assign
-//purpose :
-//=======================================================================
-
-void TCollection_List::Assign(const TCollection_List& Other)
-{
- if (this != &Other) {
- Clear();
- TCollection_ListIterator It(Other);
- while (It.More()) {
- Append(It.Value());
- It.Next();
- }
- }
-}
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-void TCollection_List::Clear()
-{
- TCollection_ListNode* p = (TCollection_ListNode*) myFirst;
- TCollection_ListNode* q;
- while (p != NULL) {
- q = p;
- p = (TCollection_ListNode*)q->Next();
- delete q;
- }
- myFirst = myLast = NULL;
-}
-
-//=======================================================================
-//function : Extent
-//purpose :
-//=======================================================================
-
-Standard_Integer TCollection_List::Extent() const
-{
- Standard_Integer Size = 0;
- TCollection_ListNode* p = (TCollection_ListNode*) myFirst;
- while (p != NULL) {
- Size++;
- p = (TCollection_ListNode*)p->Next();
- }
- return Size;
-}
-
-
-//=======================================================================
-//function : Prepend
-//purpose :
-//=======================================================================
-
-void TCollection_List::Prepend(const Item& I)
-{
- myFirst = new TCollection_ListNode(I,(TCollection_ListNode*)myFirst);
- if (myLast == NULL) myLast = myFirst;
-}
-
-//=======================================================================
-//function : Prepend
-//purpose :
-//=======================================================================
-
-void TCollection_List::Prepend(const Item& I, TCollection_ListIterator& theIt)
-{
- myFirst = new TCollection_ListNode(I,(TCollection_ListNode*)myFirst);
-
- theIt.current = myFirst;
- theIt.previous = NULL;
-
- if (myLast == NULL) myLast = myFirst;
-
-}
-
-//=======================================================================
-//function : Prepend
-//purpose :
-//=======================================================================
-
-void TCollection_List::Prepend(TCollection_List& Other)
-{
- if (!Other.IsEmpty()) {
- ((TCollection_ListNode*)Other.myLast)->Next() = (TCollection_ListNode*)myFirst;
- myFirst = Other.myFirst;
- Other.myFirst = Other.myLast = NULL;
- }
-}
-
-//=======================================================================
-//function : Append
-//purpose :
-//=======================================================================
-
-void TCollection_List::Append(const Item& I)
-{
- TCollection_ListNode* p = new TCollection_ListNode(I,(TCollection_MapNode*)0L);
-
- if (myFirst == NULL) {
- myFirst = myLast = p;
- }
- else {
- ((TCollection_ListNode*)myLast)->Next() = (TCollection_ListNode*)p;
- myLast = p;
- }
-}
-
-
-//=======================================================================
-//function : Append
-//purpose :
-//=======================================================================
-
-void TCollection_List::Append(const Item& I, TCollection_ListIterator& theIt)
-{
- TCollection_ListNode* p = new TCollection_ListNode(I,(TCollection_MapNode*)0L);
-
- theIt.current = p;
- theIt.previous = myLast;
-
- if (myFirst == NULL) {
- myFirst = myLast = p;
- }
- else {
- ((TCollection_ListNode*)myLast)->Next() = (TCollection_ListNode*)p;
- myLast = p;
- }
-}
-
-//=======================================================================
-//function : Append
-//purpose :
-//=======================================================================
-
-void TCollection_List::Append(TCollection_List& Other)
-{
- if (!Other.IsEmpty()) {
- if (IsEmpty()) {
- myFirst = Other.myFirst;
- myLast = Other.myLast;
- }
- else {
- ((TCollection_ListNode*)myLast)->Next() = (TCollection_ListNode*)Other.myFirst;
- myLast = Other.myLast;
- }
- Other.myLast = Other.myFirst = NULL;
- }
-}
-
-//=======================================================================
-//function : First
-//purpose :
-//=======================================================================
-
-Item& TCollection_List::First() const
-{
- Standard_NoSuchObject_Raise_if(myFirst == NULL,"List:First");
- return ((TCollection_ListNode*) myFirst)->Value();
-}
-
-//=======================================================================
-//function : Last
-//purpose :
-//=======================================================================
-
-Item& TCollection_List::Last() const
-{
- Standard_NoSuchObject_Raise_if(myLast == NULL,"List:Last");
- return ((TCollection_ListNode*) myLast)->Value();
-}
-
-//=======================================================================
-//function : RemoveFirst
-//purpose :
-//=======================================================================
-
-void TCollection_List::RemoveFirst()
-{
- if (myFirst == NULL) return;
- TCollection_ListNode* p = (TCollection_ListNode*) myFirst;
- myFirst = p->Next();
- delete p;
- if (myFirst == NULL) myLast = NULL;
-}
-
-//=======================================================================
-//function : Remove
-//purpose :
-//=======================================================================
-
-void TCollection_List::Remove(TCollection_ListIterator& It)
-{
- Standard_NoSuchObject_Raise_if(!It.More(),
- "TCollection_List::Remove");
- if (It.previous == NULL) {
- RemoveFirst();
- It.current = myFirst;
- }
- else {
- TCollection_ListNode* p = (TCollection_ListNode*)((TCollection_ListNode*) It.current)->Next();
- ((TCollection_ListNode*)It.previous)->Next() = (TCollection_ListNode*)p;
- delete ((TCollection_ListNode*) It.current);
- It.current = p;
- if (p == NULL) myLast = It.previous;
- }
-}
-
-//=======================================================================
-//function : InsertBefore
-//purpose :
-//=======================================================================
-
-void TCollection_List::InsertBefore(const Item& I,
- TCollection_ListIterator& It)
-{
- Standard_NoSuchObject_Raise_if(!It.More(), "TCollection_List::InsertBefore");
- if (It.previous == NULL) {
- Prepend(I);
- It.previous = myFirst;
- }
- else {
- TCollection_ListNode* p = new TCollection_ListNode(I,(TCollection_ListNode*)It.current);
- ((TCollection_ListNode*)It.previous)->Next() = (TCollection_ListNode*)p;
- It.previous = p;
- }
-}
-
-//=======================================================================
-//function : InsertBefore
-//purpose :
-//=======================================================================
-
-void TCollection_List::InsertBefore(TCollection_List& Other,
- TCollection_ListIterator& It)
-{
- Standard_NoSuchObject_Raise_if(!It.More(), "TCollection_List::InsertBefore");
- if (!Other.IsEmpty()) {
- if (It.previous == NULL) {
- It.previous = Other.myLast;
- Prepend(Other);
- }
- else {
- ((TCollection_ListNode*)It.previous)->Next() = (TCollection_ListNode*)Other.myFirst;
- ((TCollection_ListNode*)Other.myLast)->Next() = (TCollection_ListNode*)It.current;
- It.previous = Other.myLast;
- Other.myLast = Other.myFirst = NULL;
- }
- }
-}
-
-//=======================================================================
-//function : InsertAfter
-//purpose :
-//=======================================================================
-
-void TCollection_List::InsertAfter(const Item& I, TCollection_ListIterator& It)
-{
- Standard_NoSuchObject_Raise_if(!It.More(),"TCollection_List::InsertAfter");
-
- if (It.current == myLast)
- Append(I);
- else {
- TCollection_ListNode* p = new TCollection_ListNode(I,((TCollection_ListNode*)It.current)->Next());
- ((TCollection_ListNode*)It.current)->Next() = (TCollection_ListNode*)p;
- }
-}
-
-//=======================================================================
-//function : InsertAfter
-//purpose :
-//=======================================================================
-
-void TCollection_List::InsertAfter(TCollection_List& Other,
- TCollection_ListIterator& It)
-{
- Standard_NoSuchObject_Raise_if(!It.More(),"TCollection_List::InsertAfter");
-
- if (It.current == myLast)
- Append(Other);
- else if (!Other.IsEmpty()) {
- ((TCollection_ListNode*)Other.myLast)->Next() = ((TCollection_ListNode*)It.current)->Next();
- ((TCollection_ListNode*)It.current)->Next() = (TCollection_ListNode*)Other.myFirst;
- Other.myLast = Other.myFirst = NULL;
- }
-}
-
-
-//=======================================================================
-//function : TCollection_ListIterator
-//purpose :
-//=======================================================================
-
-void TCollection_ListIterator::Next()
-{
- Standard_NoMoreObject_Raise_if(current == NULL,
- "TCollection_ListIteratorOfList");
- previous = current;
- current = ((TCollection_ListNode*)previous)->Next();
-}
-
-//=======================================================================
-//function : Value
-//purpose :
-//=======================================================================
-
-Item& TCollection_ListIterator::Value() const
-{
- Standard_NoSuchObject_Raise_if(current == NULL,
- "TCollection_ListIteratorOfList");
- return ((TCollection_ListNode*)current)->Value();
-}
-
-
-
-
-
-
-
+++ /dev/null
-// Created on: 1992-12-17
-// Created by: Remi LEQUETTE
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : IsEmpty
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TCollection_List::IsEmpty() const
-
-{
- return myFirst == 0L;
-}
-
+++ /dev/null
-// Created on: 1992-12-17
-// Created by: Remi LEQUETTE
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// The methods of Iterator needing the Node class
-// are defined in TCollection_List.gxx
-
-
-//=======================================================================
-//function : TCollection_ListIterator
-//purpose :
-//=======================================================================
-
-TCollection_ListIterator::TCollection_ListIterator() :
- current(NULL),
- previous(NULL)
-{}
-
-//=======================================================================
-//function : TCollection_ListIterator
-//purpose :
-//=======================================================================
-
-TCollection_ListIterator::TCollection_ListIterator(const TCollection_List& L) :
- current(L.myFirst),
- previous(NULL)
-{}
-
-//=======================================================================
-//function : Initialize
-//purpose :
-//=======================================================================
-
-void TCollection_ListIterator::Initialize(const TCollection_List& L)
-{
- current = L.myFirst;
- previous = NULL;
-}
+++ /dev/null
-// Created on: 1992-12-17
-// Created by: Remi LEQUETTE
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : More
-//purpose :
-//=======================================================================
-
-inline Standard_Boolean TCollection_ListIterator::More() const
-{
- return current != 0L;
-}
-
+++ /dev/null
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline TCollection_ListNode::TCollection_ListNode(const Item& I,const TCollection_MapNodePtr& n)
-: TCollection_MapNode(n)
-{
- myValue = I;
-}
-
-inline Item& TCollection_ListNode::Value() const
-{
- return (Item&)myValue;
-}
-
+++ /dev/null
-// Created on: 1993-01-07
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_DomainError.hxx>
-#include <Standard_NoSuchObject.hxx>
-
-
-//=======================================================================
-//function : TCollection_Map
-//purpose :
-//=======================================================================
-
-TCollection_Map::TCollection_Map(const Standard_Integer NbBuckets) :
- TCollection_BasicMap(NbBuckets,Standard_True)
-{
-}
-
-//=======================================================================
-//function : TCollection_Map
-//purpose :
-//=======================================================================
-
-TCollection_Map::TCollection_Map(const TCollection_Map& Other) :
- TCollection_BasicMap(Other.NbBuckets(),Standard_True)
-{
- if (!Other.IsEmpty()) {
- ReSize(Other.Extent());
- for (TCollection_MapIterator It(Other); It.More(); It.Next()) {
- Add(It.Key());
- }
- }
-}
-
-//=======================================================================
-//function : Assign
-//purpose :
-//=======================================================================
-
-TCollection_Map& TCollection_Map::Assign(const TCollection_Map& Other)
-{
- if (this == &Other) return *this;
- Clear();
-// ReSize(Other.NbBuckets());
- if (!Other.IsEmpty()) {
- ReSize(Other.Extent());
- for (TCollection_MapIterator It(Other); It.More(); It.Next()) {
- Add(It.Key());
- }
- }
- return *this;
-}
-
-
-//=======================================================================
-//function : ReSize
-//purpose :
-//=======================================================================
-
-void TCollection_Map::ReSize(const Standard_Integer N)
-{
- Standard_Integer newBuck;
- Standard_Address newData1=NULL, dummy=NULL;
- if (BeginResize(N,newBuck,newData1,dummy)) {
- if (myData1) {
- TCollection_StdMapNode** newdata = (TCollection_StdMapNode**)newData1;
- TCollection_StdMapNode** olddata = (TCollection_StdMapNode**) myData1;
- TCollection_StdMapNode *p, *q;
- Standard_Integer i,k;
- for (i = 0; i <= NbBuckets(); i++) {
- if (olddata[i]) {
- p = olddata[i];
- while (p) {
- k = Hasher::HashCode(p->Key(),newBuck);
- q = (TCollection_StdMapNode*) p->Next();
- p->Next() = newdata[k];
- newdata[k] = p;
- p = q;
- }
- }
- }
- }
- EndResize(N,newBuck,newData1,dummy);
- }
-}
-
-//=======================================================================
-//function : Clear
-//purpose :
-//=======================================================================
-
-void TCollection_Map::Clear()
-{
- if (!IsEmpty()) {
- Standard_Integer i;
- TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1;
- TCollection_StdMapNode *p,*q;
- for (i = 0; i <= NbBuckets(); i++) {
- if (data[i]) {
- p = data[i];
- while (p) {
- q = (TCollection_StdMapNode*)p->Next();
- delete p;
- p = q;
- }
- }
- }
- }
- TCollection_BasicMap::Destroy();
-}
-
-//=======================================================================
-//function : Add
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_Map::Add(const TheKey& K)
-{
- if (Resizable()) ReSize(Extent());
- TCollection_StdMapNode** data = (TCollection_StdMapNode**)myData1;
- Standard_Integer k = Hasher::HashCode(K,NbBuckets());
- TCollection_StdMapNode* p = data[k];
- while (p) {
- if (Hasher::IsEqual(p->Key(),K)) return Standard_False;
- p = (TCollection_StdMapNode*)p->Next();
- }
- data[k] = new TCollection_StdMapNode(K,data[k]);
- Increment();
- return Standard_True;
-}
-
-//=======================================================================
-//function : Contains
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_Map::Contains(const TheKey& K) const
-{
- if (IsEmpty()) return Standard_False;
- TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1;
- TCollection_StdMapNode* p = data[Hasher::HashCode(K,NbBuckets())];
- while (p) {
- if (Hasher::IsEqual(p->Key(),K)) {
- return Standard_True;
- }
- p = (TCollection_StdMapNode*)p->Next();
- }
- return Standard_False;
-}
-
-//=======================================================================
-//function : Remove
-//purpose :
-//=======================================================================
-
-Standard_Boolean TCollection_Map::Remove(const TheKey& K)
-{
- if (IsEmpty()) return Standard_False;
- TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1;
- Standard_Integer k = Hasher::HashCode(K,NbBuckets());
- TCollection_StdMapNode* p = data[k];
- TCollection_StdMapNode* q = NULL;
- while (p) {
- if (Hasher::IsEqual(p->Key(),K)) {
- Decrement();
- if (q) q->Next() = p->Next();
- else data[k] = (TCollection_StdMapNode*) p->Next();
- delete p;
- return Standard_True;
- }
- q = p;
- p = (TCollection_StdMapNode*) p->Next();
- }
- return Standard_False;
-}
-
-
-// method of the iterator
-
-//=======================================================================
-//function : Key
-//purpose :
-//=======================================================================
-
-const TheKey& TCollection_MapIterator::Key() const
-{
- Standard_NoSuchObject_Raise_if(!More(),"TCollection_MapIterator::Key");
- return ((TCollection_StdMapNode*) myNode)->Key();
-}
+++ /dev/null
-// Created on: 1993-01-07
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-Standard_Integer TCollection_MapHasher::HashCode(const Key& K,
- const Standard_Integer Upper)
-{
- return ::HashCode(K,Upper);
- //return K->HashCode(Upper);
-}
-
-Standard_Boolean TCollection_MapHasher::IsEqual(const Key& K1,
- const Key& K2)
-{
- return K1 == K2;
-}
-
+++ /dev/null
-// Created on: 1993-02-26
-// Created by: Remi LEQUETTE
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : TCollection_MapIterator
-//purpose :
-//=======================================================================
-
-TCollection_MapIterator::TCollection_MapIterator() :
- TCollection_BasicMapIterator()
-{}
-
-//=======================================================================
-//function : TCollection_MapIterator
-//purpose :
-//=======================================================================
-
-TCollection_MapIterator::TCollection_MapIterator(const TCollection_Map& aMap) :
- TCollection_BasicMapIterator(aMap)
-{}
-
-//=======================================================================
-//function : TCollection_MapIterator
-//purpose :
-//=======================================================================
-
-void TCollection_MapIterator::Initialize(const TCollection_Map& aMap)
-{
- TCollection_BasicMapIterator::Initialize(aMap);
-}
-
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Standard_Type.hxx>
-#include <TCollection_MapNode.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(TCollection_MapNode,Standard_Transient)
\ No newline at end of file
+++ /dev/null
-// Created on: 1998-01-19
-// Created by: Kernel
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _TCollection_MapNode_HeaderFile
-#define _TCollection_MapNode_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_MapNodePtr.hxx>
-#include <Standard_Transient.hxx>
-
-
-class TCollection_MapNode;
-DEFINE_STANDARD_HANDLE(TCollection_MapNode, Standard_Transient)
-
-//! Basic class root of all the Maps.
-class TCollection_MapNode : public Standard_Transient
-{
-
-public:
-
-
- TCollection_MapNode(const TCollection_MapNodePtr& n);
-
- TCollection_MapNodePtr& Next() const;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(TCollection_MapNode,Standard_Transient)
-
-protected:
-
-
-
-
-private:
-
-
- TCollection_MapNodePtr myNext;
-
-
-};
-
-
-#include <TCollection_MapNode.lxx>
-
-
-
-
-
-#endif // _TCollection_MapNode_HeaderFile
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TCollection_MapNodePtr.hxx>
-
-inline TCollection_MapNode::TCollection_MapNode(const TCollection_MapNodePtr& n)
-: myNext(n)
-{
-}
-
-inline TCollection_MapNodePtr& TCollection_MapNode::Next() const
-{
- return (TCollection_MapNodePtr&)myNext;
-}
+++ /dev/null
-// Created on: 1992-10-13
-// Created by: Ramin BARRETO
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _TCollection_MapNodePtr_HeaderFile
-#define _TCollection_MapNodePtr_HeaderFile
-
-class TCollection_MapNode;
-typedef TCollection_MapNode* TCollection_MapNodePtr;
-
-#endif // _TCollection_MapNodePtr_HeaderFile
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Standard_Type.hxx>
-#include <TCollection_SeqNode.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(TCollection_SeqNode,Standard_Transient)
\ No newline at end of file
+++ /dev/null
-// Created on: 1998-01-21
-// Created by: Kernel
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _TCollection_SeqNode_HeaderFile
-#define _TCollection_SeqNode_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_SeqNodePtr.hxx>
-#include <Standard_Transient.hxx>
-
-
-class TCollection_SeqNode;
-DEFINE_STANDARD_HANDLE(TCollection_SeqNode, Standard_Transient)
-
-
-class TCollection_SeqNode : public Standard_Transient
-{
-
-public:
-
-
- TCollection_SeqNode(const TCollection_SeqNodePtr& n, const TCollection_SeqNodePtr& p);
-
- TCollection_SeqNodePtr& Next() const;
-
- TCollection_SeqNodePtr& Previous() const;
-
-
-
-
- DEFINE_STANDARD_RTTIEXT(TCollection_SeqNode,Standard_Transient)
-
-protected:
-
-
-
-
-private:
-
-
- TCollection_SeqNodePtr myNext;
- TCollection_SeqNodePtr myPrevious;
-
-
-};
-
-
-#include <TCollection_SeqNode.lxx>
-
-
-
-
-
-#endif // _TCollection_SeqNode_HeaderFile
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline TCollection_SeqNode::TCollection_SeqNode(const TCollection_SeqNodePtr& n,const TCollection_SeqNodePtr& p )
-: myNext(n),myPrevious(p)
-{
-}
-
-inline TCollection_SeqNodePtr& TCollection_SeqNode::Next() const
-{
- return (TCollection_SeqNodePtr&)myNext;
-}
-
-inline TCollection_SeqNodePtr& TCollection_SeqNode::Previous() const
-{
- return (TCollection_SeqNodePtr&)myPrevious;
-}
+++ /dev/null
-// Created on: 1992-10-13
-// Created by: Ramin BARRETO
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _TCollection_SeqNodePtr_HeaderFile
-#define _TCollection_SeqNodePtr_HeaderFile
-
-class TCollection_SeqNode;
-typedef TCollection_SeqNode* TCollection_SeqNodePtr;
-
-#endif // _TCollection_SeqNodePtr_HeaderFile
+++ /dev/null
-// Created on: 1992-09-24
-// Created by: Mireille MERCIEN
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// ----------------------------------------------------------------------
-// Updated: Remi Lequette,J.P. TIRAULT February,23 1995
-// we added a basic class BaseSequence where all
-// instantiations of Sequence inherit.
-// ----------------------------------------------------------------------
-
-static void delnode(TCollection_SeqNode* p)
-{
- TCollection_SequenceNode* q = (TCollection_SequenceNode*) p;
- delete q;
-}
-
-// ----------------------------------
-// Clear : Clear the Current Sequence
-// ----------------------------------
-void TCollection_Sequence::Clear()
-{
- TCollection_BaseSequence::Clear((void*)&delnode);
-}
-
-//=======================================================================
-//function : Assign
-//purpose :
-//=======================================================================
-
-const TCollection_Sequence& TCollection_Sequence::Assign
- (const TCollection_Sequence& Other)
-{
- if (this == &Other) return *this;
- Clear();
- TCollection_SequenceNode* current = (TCollection_SequenceNode*) Other.FirstItem;
- TCollection_SequenceNode* previous = NULL;
- TCollection_SequenceNode* newnode = NULL;
- FirstItem = NULL;
- while (current) {
- newnode = new TCollection_SequenceNode(current->Value(),previous,(TCollection_SeqNode*)0L);
- if (previous) previous->Next() = newnode;
- else FirstItem = newnode;
- current = (TCollection_SequenceNode *) current->Next();
- previous = newnode;
- }
- LastItem = newnode;
- Size = Other.Size;
- CurrentItem = FirstItem;
- CurrentIndex = 1;
- return *this;
-}
-
-
-// -------------------------------------------------
-// Append : Push an item at the end of the sequence
-// -------------------------------------------------
-void TCollection_Sequence::Append(const SeqItem& T)
-{
- TCollection_SequenceNode* newnode = new TCollection_SequenceNode(T,(TCollection_SeqNode*)LastItem,(TCollection_SeqNode*)0L);
- PAppend ((void*)newnode);
-}
-
-
-// ---------------------------------------------------------
-// Prepend : Push an element at the begining of the sequence
-// ---------------------------------------------------------
-void TCollection_Sequence::Prepend(const SeqItem& T)
-{
- TCollection_SequenceNode* newnode = new TCollection_SequenceNode(T,(TCollection_SeqNode*)0L,(TCollection_SequenceNode*)FirstItem);
- PPrepend ((void*)newnode);
-}
-
-// -----------------------------------------------------------------
-// InsertAfter : Insert an element after a given index in a sequence
-// -----------------------------------------------------------------
-void TCollection_Sequence::InsertAfter(const Standard_Integer Index,
- const SeqItem& T)
-{
- Standard_OutOfRange_Raise_if (Index < 0 || Index > Size, "TCollection_Sequence::InsertAfter() - index is out of range");
- TCollection_SequenceNode* newnode = new TCollection_SequenceNode(T,(TCollection_SeqNode*)0L,(TCollection_SeqNode*)0L);
- PInsertAfter (Index,(void*)newnode);
-}
-
-// ---------------------------------------------------
-// First : Returns the first element of the sequence
-// Raises an exeption if the sequence is empty
-// ----------------------------------------------------
-const SeqItem& TCollection_Sequence::First() const
-{
- Standard_NoSuchObject_Raise_if (Size == 0, "TCollection_Sequence::First() - sequence is empty");
- return ((TCollection_SequenceNode*) FirstItem)->Value();
-}
-
-// ----------------------------------------------------
-// Last : Returns the last element of the sequence
-// Raises an exeption if the sequence is empty
-// ----------------------------------------------------
-const SeqItem& TCollection_Sequence::Last() const
-{
- Standard_NoSuchObject_Raise_if (Size == 0, "TCollection_Sequence::Last() - sequence is empty");
- return ((TCollection_SequenceNode*) LastItem)->Value();
-}
-
-// -----------------------------------------
-// Value : Return the value of a given index
-// -----------------------------------------
-const SeqItem& TCollection_Sequence::Value(const Standard_Integer Index) const
-{
- Standard_OutOfRange_Raise_if (Index <= 0 || Index > Size, "TCollection_Sequence::Value() - index is out of range");
- TCollection_Sequence* const aLocalTHIS = (TCollection_Sequence* const) this;
- aLocalTHIS->CurrentItem = (TCollection_SequenceNode*) Find(Index);
- aLocalTHIS->CurrentIndex = Index;
- return ((TCollection_SequenceNode*)CurrentItem)->Value();
-}
-
-// -------------------------------------------------------
-// ChangeValue : Return the modifiable value of a given index
-// -------------------------------------------------------
-SeqItem & TCollection_Sequence::ChangeValue(const Standard_Integer Index)
-{
- Standard_OutOfRange_Raise_if (Index <= 0 || Index > Size, "TCollection_Sequence::ChangeValue() - index is out of range");
-
- CurrentItem = (TCollection_SequenceNode*) Find(Index);
- CurrentIndex = Index;
- return ((TCollection_SequenceNode*)CurrentItem)->Value();
-}
-
-void TCollection_Sequence::Remove(const Standard_Integer Index)
-{
- TCollection_BaseSequence::Remove(Index,(void*)&delnode);
-}
-
-// ---------------------
-// Remove a set of items
-// ---------------------
-void TCollection_Sequence::Remove(const Standard_Integer FromIndex, const Standard_Integer ToIndex)
-{
- TCollection_BaseSequence::Remove(FromIndex,ToIndex,(void*)&delnode);
-}
-
-
-//=======================================================================
-//function : SetValue
-//purpose : Sets a value to an index
-//=======================================================================
-void TCollection_Sequence::SetValue (const Standard_Integer Index,
- const SeqItem& I)
-{
- ChangeValue(Index) = I ;
-}
+++ /dev/null
-// Created on: 1992-12-22
-// Created by: Remi LEQUETTE
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-//=======================================================================
-//function : Empty constructor
-//purpose :
-//=======================================================================
-
-inline TCollection_Sequence::TCollection_Sequence()
-{
-}
-
-//=======================================================================
-//function : Copy constructor
-//purpose :
-//=======================================================================
-
-inline TCollection_Sequence::TCollection_Sequence(const TCollection_Sequence& theOther)
-{
- Assign(theOther);
-}
-
-//=======================================================================
-//function : Append
-//purpose : Appends a Sequence to myself
-//=======================================================================
-inline void TCollection_Sequence::Append (TCollection_Sequence& S)
-{
- if (FirstItem == S.FirstItem) Assign(S);
- PAppend (S);
-}
-
-//=======================================================================
-//function : Prepend
-//purpose : Prepends a Sequence to myself
-//=======================================================================
-inline void TCollection_Sequence::Prepend (TCollection_Sequence& S)
-{
- if (FirstItem == S.FirstItem) Assign(S);
- PPrepend (S);
-}
-//=======================================================================
-//function : InsertBefore
-//purpose : Inserts an item before an index
-//=======================================================================
-inline void TCollection_Sequence::InsertBefore (const Standard_Integer Index,
- const SeqItem& I)
-{
- InsertAfter(Index-1,I);
-}
-
-//=======================================================================
-//function : InsertBefore
-//purpose : Inserts a Sequence before an index
-//=======================================================================
-inline void TCollection_Sequence::InsertBefore (const Standard_Integer Index,
- TCollection_Sequence& S)
-{
- InsertAfter(Index-1,S);
-}
-
-//=======================================================================
-//function : InsertAfter
-//purpose : Inserts a Sequence after an index
-//=======================================================================
-inline void TCollection_Sequence::InsertAfter (const Standard_Integer Index,
- TCollection_Sequence& S)
-{
- PInsertAfter(Index,S);
-}
-
-//=======================================================================
-//function : Split
-//purpose : Cuts a Sequence into two
-//=======================================================================
-inline void TCollection_Sequence::Split (const Standard_Integer Index,
- TCollection_Sequence& S)
-{
- S.Clear();
- PSplit(Index,S);
-}
-
-
-
-
-
-
-
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline TCollection_SequenceNode::TCollection_SequenceNode(const SeqItem& I, const TCollection_SeqNodePtr& n, const TCollection_SeqNodePtr& p)
-: TCollection_SeqNode(p,n)
-{
- myValue = I;
-}
-
-inline SeqItem& TCollection_SequenceNode::Value() const
-{
- return (SeqItem&)myValue;
-}
+++ /dev/null
-// Created on: 1992-10-13
-// Created by: Ramin BARRETO
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _TCollection_Side_HeaderFile
-#define _TCollection_Side_HeaderFile
-
-
-enum TCollection_Side
-{
-TCollection_Left,
-TCollection_Right
-};
-
-#endif // _TCollection_Side_HeaderFile
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-inline TCollection_StdMapNode::TCollection_StdMapNode(const TheKey& K,const TCollection_MapNodePtr& n)
-: TCollection_MapNode(n),myKey(K)
-{
-}
-
-inline TheKey& TCollection_StdMapNode::Key() const
-{
- return (TheKey&)myKey;
-}