From 81ff49158aee6c2d6df6d03baabc57fbc5cd7385 Mon Sep 17 00:00:00 2001 From: kgv Date: Mon, 29 Jun 2020 10:35:07 +0300 Subject: [PATCH] 0029642: Foundation Classes - deprecate TCollection classes except strings Removed remnants of generic templates in TCollection package. --- dox/debug/debug.md | 6 - dox/debug/occt.natvis | 7 - .../modeling_data/modeling_data.md | 8 +- .../qt/OCCTOverview/src/OcctHighlighter.cxx | 4 +- src/TCollection/FILES | 57 --- src/TCollection/TCollection.hxx | 90 ---- src/TCollection/TCollection_Array1.gxx | 56 --- src/TCollection/TCollection_Array1.lxx | 150 ------- src/TCollection/TCollection_Array2.gxx | 150 ------- src/TCollection/TCollection_Array2.lxx | 120 ----- src/TCollection/TCollection_BaseSequence.cxx | 371 ---------------- src/TCollection/TCollection_BaseSequence.hxx | 167 ------- src/TCollection/TCollection_BaseSequence.lxx | 25 -- src/TCollection/TCollection_BasicMap.cxx | 152 ------- src/TCollection/TCollection_BasicMap.hxx | 172 ------- src/TCollection/TCollection_BasicMap.lxx | 78 ---- .../TCollection_BasicMapIterator.cxx | 98 ---- .../TCollection_BasicMapIterator.hxx | 112 ----- .../TCollection_BasicMapIterator.lxx | 28 -- src/TCollection/TCollection_DataMap.gxx | 280 ------------ .../TCollection_DataMapIterator.gxx | 44 -- src/TCollection/TCollection_DataMapNode.gxx | 13 - src/TCollection/TCollection_DataMapNode.lxx | 30 -- src/TCollection/TCollection_DoubleMap.gxx | 379 ---------------- .../TCollection_DoubleMapIterator.gxx | 44 -- src/TCollection/TCollection_DoubleMapNode.gxx | 13 - src/TCollection/TCollection_DoubleMapNode.lxx | 35 -- src/TCollection/TCollection_HArray1.gxx | 13 - src/TCollection/TCollection_HArray1.lxx | 133 ------ src/TCollection/TCollection_HArray2.gxx | 35 -- src/TCollection/TCollection_HArray2.lxx | 164 ------- src/TCollection/TCollection_HSequence.gxx | 196 -------- src/TCollection/TCollection_HSequence.lxx | 58 --- .../TCollection_IndexedDataMap.gxx | 420 ------------------ .../TCollection_IndexedDataMapNode.gxx | 13 - .../TCollection_IndexedDataMapNode.lxx | 40 -- src/TCollection/TCollection_IndexedMap.gxx | 313 ------------- .../TCollection_IndexedMapNode.gxx | 13 - .../TCollection_IndexedMapNode.lxx | 34 -- src/TCollection/TCollection_List.gxx | 373 ---------------- src/TCollection/TCollection_List.lxx | 27 -- src/TCollection/TCollection_ListIterator.gxx | 50 --- src/TCollection/TCollection_ListIterator.lxx | 26 -- src/TCollection/TCollection_ListNode.gxx | 13 - src/TCollection/TCollection_ListNode.lxx | 25 -- src/TCollection/TCollection_Map.gxx | 201 --------- src/TCollection/TCollection_MapHasher.gxx | 29 -- src/TCollection/TCollection_MapIterator.gxx | 44 -- src/TCollection/TCollection_MapNode.cxx | 19 - src/TCollection/TCollection_MapNode.hxx | 66 --- src/TCollection/TCollection_MapNode.lxx | 25 -- src/TCollection/TCollection_MapNodePtr.hxx | 23 - src/TCollection/TCollection_SeqNode.cxx | 19 - src/TCollection/TCollection_SeqNode.hxx | 69 --- src/TCollection/TCollection_SeqNode.lxx | 28 -- src/TCollection/TCollection_SeqNodePtr.hxx | 23 - src/TCollection/TCollection_Sequence.gxx | 162 ------- src/TCollection/TCollection_Sequence.lxx | 101 ----- src/TCollection/TCollection_SequenceNode.gxx | 13 - src/TCollection/TCollection_SequenceNode.lxx | 24 - src/TCollection/TCollection_Side.hxx | 27 -- src/TCollection/TCollection_StdMapNode.gxx | 13 - src/TCollection/TCollection_StdMapNode.lxx | 23 - 63 files changed, 5 insertions(+), 5539 deletions(-) delete mode 100644 src/TCollection/TCollection_Array1.gxx delete mode 100644 src/TCollection/TCollection_Array1.lxx delete mode 100644 src/TCollection/TCollection_Array2.gxx delete mode 100644 src/TCollection/TCollection_Array2.lxx delete mode 100644 src/TCollection/TCollection_BaseSequence.cxx delete mode 100644 src/TCollection/TCollection_BaseSequence.hxx delete mode 100644 src/TCollection/TCollection_BaseSequence.lxx delete mode 100644 src/TCollection/TCollection_BasicMap.cxx delete mode 100644 src/TCollection/TCollection_BasicMap.hxx delete mode 100644 src/TCollection/TCollection_BasicMap.lxx delete mode 100644 src/TCollection/TCollection_BasicMapIterator.cxx delete mode 100644 src/TCollection/TCollection_BasicMapIterator.hxx delete mode 100644 src/TCollection/TCollection_BasicMapIterator.lxx delete mode 100644 src/TCollection/TCollection_DataMap.gxx delete mode 100644 src/TCollection/TCollection_DataMapIterator.gxx delete mode 100644 src/TCollection/TCollection_DataMapNode.gxx delete mode 100644 src/TCollection/TCollection_DataMapNode.lxx delete mode 100644 src/TCollection/TCollection_DoubleMap.gxx delete mode 100644 src/TCollection/TCollection_DoubleMapIterator.gxx delete mode 100644 src/TCollection/TCollection_DoubleMapNode.gxx delete mode 100644 src/TCollection/TCollection_DoubleMapNode.lxx delete mode 100644 src/TCollection/TCollection_HArray1.gxx delete mode 100644 src/TCollection/TCollection_HArray1.lxx delete mode 100644 src/TCollection/TCollection_HArray2.gxx delete mode 100644 src/TCollection/TCollection_HArray2.lxx delete mode 100644 src/TCollection/TCollection_HSequence.gxx delete mode 100644 src/TCollection/TCollection_HSequence.lxx delete mode 100644 src/TCollection/TCollection_IndexedDataMap.gxx delete mode 100644 src/TCollection/TCollection_IndexedDataMapNode.gxx delete mode 100644 src/TCollection/TCollection_IndexedDataMapNode.lxx delete mode 100644 src/TCollection/TCollection_IndexedMap.gxx delete mode 100644 src/TCollection/TCollection_IndexedMapNode.gxx delete mode 100644 src/TCollection/TCollection_IndexedMapNode.lxx delete mode 100644 src/TCollection/TCollection_List.gxx delete mode 100644 src/TCollection/TCollection_List.lxx delete mode 100644 src/TCollection/TCollection_ListIterator.gxx delete mode 100644 src/TCollection/TCollection_ListIterator.lxx delete mode 100644 src/TCollection/TCollection_ListNode.gxx delete mode 100644 src/TCollection/TCollection_ListNode.lxx delete mode 100644 src/TCollection/TCollection_Map.gxx delete mode 100644 src/TCollection/TCollection_MapHasher.gxx delete mode 100644 src/TCollection/TCollection_MapIterator.gxx delete mode 100644 src/TCollection/TCollection_MapNode.cxx delete mode 100644 src/TCollection/TCollection_MapNode.hxx delete mode 100644 src/TCollection/TCollection_MapNode.lxx delete mode 100644 src/TCollection/TCollection_MapNodePtr.hxx delete mode 100644 src/TCollection/TCollection_SeqNode.cxx delete mode 100644 src/TCollection/TCollection_SeqNode.hxx delete mode 100644 src/TCollection/TCollection_SeqNode.lxx delete mode 100644 src/TCollection/TCollection_SeqNodePtr.hxx delete mode 100644 src/TCollection/TCollection_Sequence.gxx delete mode 100644 src/TCollection/TCollection_Sequence.lxx delete mode 100644 src/TCollection/TCollection_SequenceNode.gxx delete mode 100644 src/TCollection/TCollection_SequenceNode.lxx delete mode 100644 src/TCollection/TCollection_Side.hxx delete mode 100644 src/TCollection/TCollection_StdMapNode.gxx delete mode 100644 src/TCollection/TCollection_StdMapNode.lxx diff --git a/dox/debug/debug.md b/dox/debug/debug.md index e8381ffdd1..cbd67cae58 100644 --- a/dox/debug/debug.md +++ b/dox/debug/debug.md @@ -260,12 +260,6 @@ TCollection_AsciiString= TCollection_HAsciiString= TCollection_ExtendedString= TCollection_HExtendedString= -TCollection_BaseSequence=size= curr= -TCollection_BasicMap=size= -NCollection_BaseSequence=size= curr= -NCollection_BaseList=length= -NCollection_BaseMap=size= buckets= -NCollection_BaseVector=length= TDF_Label= tag=myTag> TDF_LabelNode=tag= TDocStd_Document=format= count= <,t> diff --git a/dox/debug/occt.natvis b/dox/debug/occt.natvis index ff8b5e3743..fc46e6a823 100644 --- a/dox/debug/occt.natvis +++ b/dox/debug/occt.natvis @@ -77,13 +77,6 @@ {myString.mylength}: {(wchar_t *)myString.mystring,su} - - TCollection_Sequence [{Size}], curr={CurrentIndex} - - - - TCollection_Map [{mySize}] - TColStd_PackedMapOfInteger [{myExtent}] diff --git a/dox/user_guides/modeling_data/modeling_data.md b/dox/user_guides/modeling_data/modeling_data.md index c8cd9d965c..6c034d4e88 100644 --- a/dox/user_guides/modeling_data/modeling_data.md +++ b/dox/user_guides/modeling_data/modeling_data.md @@ -937,10 +937,10 @@ The following steps are performed: **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*. diff --git a/samples/qt/OCCTOverview/src/OcctHighlighter.cxx b/samples/qt/OCCTOverview/src/OcctHighlighter.cxx index 63861ba9d1..5dcc887f9a 100644 --- a/samples/qt/OCCTOverview/src/OcctHighlighter.cxx +++ b/samples/qt/OCCTOverview/src/OcctHighlighter.cxx @@ -94,10 +94,8 @@ OcctHighlighter::OcctHighlighter(QTextDocument* theParent) << "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" diff --git a/src/TCollection/FILES b/src/TCollection/FILES index 03bb64b261..e9d85856a8 100755 --- a/src/TCollection/FILES +++ b/src/TCollection/FILES @@ -1,69 +1,12 @@ 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 diff --git a/src/TCollection/TCollection.hxx b/src/TCollection/TCollection.hxx index 21fc27cd8c..ce65214689 100644 --- a/src/TCollection/TCollection.hxx +++ b/src/TCollection/TCollection.hxx @@ -20,42 +20,7 @@ #include #include #include - #include -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 provides the services for the //! transient basic data structures. @@ -65,7 +30,6 @@ public: DEFINE_STANDARD_ALLOC - //! Returns a prime number greater than suitable //! to dimension a Map. When becomes great there //! is a limit on the result (today the limit is @@ -74,60 +38,6 @@ public: //! 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 diff --git a/src/TCollection/TCollection_Array1.gxx b/src/TCollection/TCollection_Array1.gxx deleted file mode 100644 index 05576afe2a..0000000000 --- a/src/TCollection/TCollection_Array1.gxx +++ /dev/null @@ -1,56 +0,0 @@ -// 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 - - -//======================================================================= -//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 -#include -#include - -#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]; -} - - - diff --git a/src/TCollection/TCollection_Array2.gxx b/src/TCollection/TCollection_Array2.gxx deleted file mode 100644 index dd74161d8d..0000000000 --- a/src/TCollection/TCollection_Array2.gxx +++ /dev/null @@ -1,150 +0,0 @@ -// 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 -#include -#include -#include - -//======================================================================= -//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 -#include - -#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]; -} - - - diff --git a/src/TCollection/TCollection_BaseSequence.cxx b/src/TCollection/TCollection_BaseSequence.cxx deleted file mode 100644 index 2c00ec7194..0000000000 --- a/src/TCollection/TCollection_BaseSequence.cxx +++ /dev/null @@ -1,371 +0,0 @@ -// 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 -#include -#include -#include -#include - -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; -} diff --git a/src/TCollection/TCollection_BaseSequence.hxx b/src/TCollection/TCollection_BaseSequence.hxx deleted file mode 100644 index 1886023c4c..0000000000 --- a/src/TCollection/TCollection_BaseSequence.hxx +++ /dev/null @@ -1,167 +0,0 @@ -// 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 -#include -#include - -#include -#include -#include -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 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 . - //! Example: - //! before - //! me = (A B C) - //! after - //! me = (C B A) - Standard_EXPORT void Reverse(); - - //! Swaps elements which are located at - //! positions and in . - //! 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 at the end of . - //! 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 at the beginning of . - //! 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 in after the - //! position . 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 the items 1 to -1 and - //! puts in the items 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 . - 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 - - - - - -#endif // _TCollection_BaseSequence_HeaderFile diff --git a/src/TCollection/TCollection_BaseSequence.lxx b/src/TCollection/TCollection_BaseSequence.lxx deleted file mode 100644 index a3df6b5a61..0000000000 --- a/src/TCollection/TCollection_BaseSequence.lxx +++ /dev/null @@ -1,25 +0,0 @@ -// 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; - -} - diff --git a/src/TCollection/TCollection_BasicMap.cxx b/src/TCollection/TCollection_BasicMap.cxx deleted file mode 100644 index 831ffaf5f6..0000000000 --- a/src/TCollection/TCollection_BasicMap.cxx +++ /dev/null @@ -1,152 +0,0 @@ -// 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 -#include -#include -#include -#include - -//======================================================================= -//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 "<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 "< -#include -#include - -#include -#include -#include -#include -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 . - Standard_Integer NbBuckets() const; - - //! Returns the number of keys already stored in . - Standard_Integer Extent() const; - - //! Returns True when the map contains no keys. - //! This is exactly Extent() == 0. - Standard_Boolean IsEmpty() const; - - //! Prints on usefull statistics about the map - //! . 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 - - - - - -#endif // _TCollection_BasicMap_HeaderFile diff --git a/src/TCollection/TCollection_BasicMap.lxx b/src/TCollection/TCollection_BasicMap.lxx deleted file mode 100644 index d9a45f93e8..0000000000 --- a/src/TCollection/TCollection_BasicMap.lxx +++ /dev/null @@ -1,78 +0,0 @@ -// 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--; -} - - diff --git a/src/TCollection/TCollection_BasicMapIterator.cxx b/src/TCollection/TCollection_BasicMapIterator.cxx deleted file mode 100644 index 7e6104e637..0000000000 --- a/src/TCollection/TCollection_BasicMapIterator.cxx +++ /dev/null @@ -1,98 +0,0 @@ -// 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 -#include -#include - -//======================================================================= -//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]; - } -} - diff --git a/src/TCollection/TCollection_BasicMapIterator.hxx b/src/TCollection/TCollection_BasicMapIterator.hxx deleted file mode 100644 index 19dfd44cb2..0000000000 --- a/src/TCollection/TCollection_BasicMapIterator.hxx +++ /dev/null @@ -1,112 +0,0 @@ -// 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 -#include -#include - -#include -#include -#include -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 - - - - - -#endif // _TCollection_BasicMapIterator_HeaderFile diff --git a/src/TCollection/TCollection_BasicMapIterator.lxx b/src/TCollection/TCollection_BasicMapIterator.lxx deleted file mode 100644 index a87fc41e88..0000000000 --- a/src/TCollection/TCollection_BasicMapIterator.lxx +++ /dev/null @@ -1,28 +0,0 @@ -// 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; -} - - - diff --git a/src/TCollection/TCollection_DataMap.gxx b/src/TCollection/TCollection_DataMap.gxx deleted file mode 100644 index 2830720da5..0000000000 --- a/src/TCollection/TCollection_DataMap.gxx +++ /dev/null @@ -1,280 +0,0 @@ -// 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 -#include - -//======================================================================= -//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(); -} diff --git a/src/TCollection/TCollection_DataMapIterator.gxx b/src/TCollection/TCollection_DataMapIterator.gxx deleted file mode 100644 index f64f180597..0000000000 --- a/src/TCollection/TCollection_DataMapIterator.gxx +++ /dev/null @@ -1,44 +0,0 @@ -// 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); -} - diff --git a/src/TCollection/TCollection_DataMapNode.gxx b/src/TCollection/TCollection_DataMapNode.gxx deleted file mode 100644 index fec882a382..0000000000 --- a/src/TCollection/TCollection_DataMapNode.gxx +++ /dev/null @@ -1,13 +0,0 @@ -// 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. diff --git a/src/TCollection/TCollection_DataMapNode.lxx b/src/TCollection/TCollection_DataMapNode.lxx deleted file mode 100644 index 0804a9f1a3..0000000000 --- a/src/TCollection/TCollection_DataMapNode.lxx +++ /dev/null @@ -1,30 +0,0 @@ -// 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; -} - diff --git a/src/TCollection/TCollection_DoubleMap.gxx b/src/TCollection/TCollection_DoubleMap.gxx deleted file mode 100644 index 5ed4164578..0000000000 --- a/src/TCollection/TCollection_DoubleMap.gxx +++ /dev/null @@ -1,379 +0,0 @@ -// 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 -#include -#include - - -//======================================================================= -//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(); -} diff --git a/src/TCollection/TCollection_DoubleMapIterator.gxx b/src/TCollection/TCollection_DoubleMapIterator.gxx deleted file mode 100644 index 2d892560fb..0000000000 --- a/src/TCollection/TCollection_DoubleMapIterator.gxx +++ /dev/null @@ -1,44 +0,0 @@ -// 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); -} - diff --git a/src/TCollection/TCollection_DoubleMapNode.gxx b/src/TCollection/TCollection_DoubleMapNode.gxx deleted file mode 100644 index fec882a382..0000000000 --- a/src/TCollection/TCollection_DoubleMapNode.gxx +++ /dev/null @@ -1,13 +0,0 @@ -// 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. diff --git a/src/TCollection/TCollection_DoubleMapNode.lxx b/src/TCollection/TCollection_DoubleMapNode.lxx deleted file mode 100644 index 04af6df09a..0000000000 --- a/src/TCollection/TCollection_DoubleMapNode.lxx +++ /dev/null @@ -1,35 +0,0 @@ -// 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; -} - diff --git a/src/TCollection/TCollection_HArray1.gxx b/src/TCollection/TCollection_HArray1.gxx deleted file mode 100644 index fec882a382..0000000000 --- a/src/TCollection/TCollection_HArray1.gxx +++ /dev/null @@ -1,13 +0,0 @@ -// 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. diff --git a/src/TCollection/TCollection_HArray1.lxx b/src/TCollection/TCollection_HArray1.lxx deleted file mode 100644 index 241c5e3b94..0000000000 --- a/src/TCollection/TCollection_HArray1.lxx +++ /dev/null @@ -1,133 +0,0 @@ -// 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); -} - - diff --git a/src/TCollection/TCollection_HArray2.gxx b/src/TCollection/TCollection_HArray2.gxx deleted file mode 100644 index 124680504c..0000000000 --- a/src/TCollection/TCollection_HArray2.gxx +++ /dev/null @@ -1,35 +0,0 @@ -// 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; -//} diff --git a/src/TCollection/TCollection_HArray2.lxx b/src/TCollection/TCollection_HArray2.lxx deleted file mode 100644 index 840a682134..0000000000 --- a/src/TCollection/TCollection_HArray2.lxx +++ /dev/null @@ -1,164 +0,0 @@ -// 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; -} diff --git a/src/TCollection/TCollection_HSequence.gxx b/src/TCollection/TCollection_HSequence.gxx deleted file mode 100644 index d9d33b5572..0000000000 --- a/src/TCollection/TCollection_HSequence.gxx +++ /dev/null @@ -1,196 +0,0 @@ -// 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; -// } - - - - - - - - - - diff --git a/src/TCollection/TCollection_HSequence.lxx b/src/TCollection/TCollection_HSequence.lxx deleted file mode 100644 index be14cfa8d6..0000000000 --- a/src/TCollection/TCollection_HSequence.lxx +++ /dev/null @@ -1,58 +0,0 @@ -// 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; -} - diff --git a/src/TCollection/TCollection_IndexedDataMap.gxx b/src/TCollection/TCollection_IndexedDataMap.gxx deleted file mode 100644 index 3e151662aa..0000000000 --- a/src/TCollection/TCollection_IndexedDataMap.gxx +++ /dev/null @@ -1,420 +0,0 @@ -// 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 -#include -#include -#include -#include - -//======================================================================= -//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; -} diff --git a/src/TCollection/TCollection_IndexedDataMapNode.gxx b/src/TCollection/TCollection_IndexedDataMapNode.gxx deleted file mode 100644 index fec882a382..0000000000 --- a/src/TCollection/TCollection_IndexedDataMapNode.gxx +++ /dev/null @@ -1,13 +0,0 @@ -// 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. diff --git a/src/TCollection/TCollection_IndexedDataMapNode.lxx b/src/TCollection/TCollection_IndexedDataMapNode.lxx deleted file mode 100644 index 3e2c5c7427..0000000000 --- a/src/TCollection/TCollection_IndexedDataMapNode.lxx +++ /dev/null @@ -1,40 +0,0 @@ -// 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; -} diff --git a/src/TCollection/TCollection_IndexedMap.gxx b/src/TCollection/TCollection_IndexedMap.gxx deleted file mode 100644 index 4740011f11..0000000000 --- a/src/TCollection/TCollection_IndexedMap.gxx +++ /dev/null @@ -1,313 +0,0 @@ -// 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 -#include -#include -#include -#include - - -//======================================================================= -//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; -} diff --git a/src/TCollection/TCollection_IndexedMapNode.gxx b/src/TCollection/TCollection_IndexedMapNode.gxx deleted file mode 100644 index fec882a382..0000000000 --- a/src/TCollection/TCollection_IndexedMapNode.gxx +++ /dev/null @@ -1,13 +0,0 @@ -// 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. diff --git a/src/TCollection/TCollection_IndexedMapNode.lxx b/src/TCollection/TCollection_IndexedMapNode.lxx deleted file mode 100644 index 0350c319de..0000000000 --- a/src/TCollection/TCollection_IndexedMapNode.lxx +++ /dev/null @@ -1,34 +0,0 @@ -// 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; -} diff --git a/src/TCollection/TCollection_List.gxx b/src/TCollection/TCollection_List.gxx deleted file mode 100644 index dc39f25618..0000000000 --- a/src/TCollection/TCollection_List.gxx +++ /dev/null @@ -1,373 +0,0 @@ -// 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 -#include - -//======================================================================= -//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"<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(); -} - - - - - - - diff --git a/src/TCollection/TCollection_List.lxx b/src/TCollection/TCollection_List.lxx deleted file mode 100644 index d782ef3f5d..0000000000 --- a/src/TCollection/TCollection_List.lxx +++ /dev/null @@ -1,27 +0,0 @@ -// 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; -} - diff --git a/src/TCollection/TCollection_ListIterator.gxx b/src/TCollection/TCollection_ListIterator.gxx deleted file mode 100644 index bd788557b8..0000000000 --- a/src/TCollection/TCollection_ListIterator.gxx +++ /dev/null @@ -1,50 +0,0 @@ -// 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; -} diff --git a/src/TCollection/TCollection_ListIterator.lxx b/src/TCollection/TCollection_ListIterator.lxx deleted file mode 100644 index bd50162c54..0000000000 --- a/src/TCollection/TCollection_ListIterator.lxx +++ /dev/null @@ -1,26 +0,0 @@ -// 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; -} - diff --git a/src/TCollection/TCollection_ListNode.gxx b/src/TCollection/TCollection_ListNode.gxx deleted file mode 100644 index fec882a382..0000000000 --- a/src/TCollection/TCollection_ListNode.gxx +++ /dev/null @@ -1,13 +0,0 @@ -// 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. diff --git a/src/TCollection/TCollection_ListNode.lxx b/src/TCollection/TCollection_ListNode.lxx deleted file mode 100644 index 8876be0f15..0000000000 --- a/src/TCollection/TCollection_ListNode.lxx +++ /dev/null @@ -1,25 +0,0 @@ -// 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; -} - diff --git a/src/TCollection/TCollection_Map.gxx b/src/TCollection/TCollection_Map.gxx deleted file mode 100644 index 3dc6991bdb..0000000000 --- a/src/TCollection/TCollection_Map.gxx +++ /dev/null @@ -1,201 +0,0 @@ -// 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 -#include - - -//======================================================================= -//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(); -} diff --git a/src/TCollection/TCollection_MapHasher.gxx b/src/TCollection/TCollection_MapHasher.gxx deleted file mode 100644 index 9fb06418f5..0000000000 --- a/src/TCollection/TCollection_MapHasher.gxx +++ /dev/null @@ -1,29 +0,0 @@ -// 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; -} - diff --git a/src/TCollection/TCollection_MapIterator.gxx b/src/TCollection/TCollection_MapIterator.gxx deleted file mode 100644 index 726804f69f..0000000000 --- a/src/TCollection/TCollection_MapIterator.gxx +++ /dev/null @@ -1,44 +0,0 @@ -// 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); -} - diff --git a/src/TCollection/TCollection_MapNode.cxx b/src/TCollection/TCollection_MapNode.cxx deleted file mode 100644 index 8ab67cd15c..0000000000 --- a/src/TCollection/TCollection_MapNode.cxx +++ /dev/null @@ -1,19 +0,0 @@ -// 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 -#include - -IMPLEMENT_STANDARD_RTTIEXT(TCollection_MapNode,Standard_Transient) \ No newline at end of file diff --git a/src/TCollection/TCollection_MapNode.hxx b/src/TCollection/TCollection_MapNode.hxx deleted file mode 100644 index 936dc24f26..0000000000 --- a/src/TCollection/TCollection_MapNode.hxx +++ /dev/null @@ -1,66 +0,0 @@ -// 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 -#include - -#include -#include - - -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 - - - - - -#endif // _TCollection_MapNode_HeaderFile diff --git a/src/TCollection/TCollection_MapNode.lxx b/src/TCollection/TCollection_MapNode.lxx deleted file mode 100644 index 48f620c1c5..0000000000 --- a/src/TCollection/TCollection_MapNode.lxx +++ /dev/null @@ -1,25 +0,0 @@ -// 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 - -inline TCollection_MapNode::TCollection_MapNode(const TCollection_MapNodePtr& n) -: myNext(n) -{ -} - -inline TCollection_MapNodePtr& TCollection_MapNode::Next() const -{ - return (TCollection_MapNodePtr&)myNext; -} diff --git a/src/TCollection/TCollection_MapNodePtr.hxx b/src/TCollection/TCollection_MapNodePtr.hxx deleted file mode 100644 index b15f45b7c6..0000000000 --- a/src/TCollection/TCollection_MapNodePtr.hxx +++ /dev/null @@ -1,23 +0,0 @@ -// 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 diff --git a/src/TCollection/TCollection_SeqNode.cxx b/src/TCollection/TCollection_SeqNode.cxx deleted file mode 100644 index 845ecdfc7d..0000000000 --- a/src/TCollection/TCollection_SeqNode.cxx +++ /dev/null @@ -1,19 +0,0 @@ -// 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 -#include - -IMPLEMENT_STANDARD_RTTIEXT(TCollection_SeqNode,Standard_Transient) \ No newline at end of file diff --git a/src/TCollection/TCollection_SeqNode.hxx b/src/TCollection/TCollection_SeqNode.hxx deleted file mode 100644 index 582e8d2e47..0000000000 --- a/src/TCollection/TCollection_SeqNode.hxx +++ /dev/null @@ -1,69 +0,0 @@ -// 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 -#include - -#include -#include - - -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 - - - - - -#endif // _TCollection_SeqNode_HeaderFile diff --git a/src/TCollection/TCollection_SeqNode.lxx b/src/TCollection/TCollection_SeqNode.lxx deleted file mode 100644 index c8d7711320..0000000000 --- a/src/TCollection/TCollection_SeqNode.lxx +++ /dev/null @@ -1,28 +0,0 @@ -// 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; -} diff --git a/src/TCollection/TCollection_SeqNodePtr.hxx b/src/TCollection/TCollection_SeqNodePtr.hxx deleted file mode 100644 index 325c8acace..0000000000 --- a/src/TCollection/TCollection_SeqNodePtr.hxx +++ /dev/null @@ -1,23 +0,0 @@ -// 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 diff --git a/src/TCollection/TCollection_Sequence.gxx b/src/TCollection/TCollection_Sequence.gxx deleted file mode 100644 index 9644025275..0000000000 --- a/src/TCollection/TCollection_Sequence.gxx +++ /dev/null @@ -1,162 +0,0 @@ -// 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 ; -} diff --git a/src/TCollection/TCollection_Sequence.lxx b/src/TCollection/TCollection_Sequence.lxx deleted file mode 100644 index 3b060fdeb3..0000000000 --- a/src/TCollection/TCollection_Sequence.lxx +++ /dev/null @@ -1,101 +0,0 @@ -// 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); -} - - - - - - - diff --git a/src/TCollection/TCollection_SequenceNode.gxx b/src/TCollection/TCollection_SequenceNode.gxx deleted file mode 100644 index df42f6159d..0000000000 --- a/src/TCollection/TCollection_SequenceNode.gxx +++ /dev/null @@ -1,13 +0,0 @@ -// 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. diff --git a/src/TCollection/TCollection_SequenceNode.lxx b/src/TCollection/TCollection_SequenceNode.lxx deleted file mode 100644 index f01d4814b7..0000000000 --- a/src/TCollection/TCollection_SequenceNode.lxx +++ /dev/null @@ -1,24 +0,0 @@ -// 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; -} diff --git a/src/TCollection/TCollection_Side.hxx b/src/TCollection/TCollection_Side.hxx deleted file mode 100644 index 32f4d42a18..0000000000 --- a/src/TCollection/TCollection_Side.hxx +++ /dev/null @@ -1,27 +0,0 @@ -// 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 diff --git a/src/TCollection/TCollection_StdMapNode.gxx b/src/TCollection/TCollection_StdMapNode.gxx deleted file mode 100644 index df42f6159d..0000000000 --- a/src/TCollection/TCollection_StdMapNode.gxx +++ /dev/null @@ -1,13 +0,0 @@ -// 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. diff --git a/src/TCollection/TCollection_StdMapNode.lxx b/src/TCollection/TCollection_StdMapNode.lxx deleted file mode 100644 index 173c493eea..0000000000 --- a/src/TCollection/TCollection_StdMapNode.lxx +++ /dev/null @@ -1,23 +0,0 @@ -// 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; -}