1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0024742: Remove rarely used collection classes: SList

Generic "TCollection_SList" class and nested "TCollection_SListNode" class moved (as non-generic) to the "TopLoc" package (the only place where they were instantiated).
Names of these classes changed to "TopLoc_SListOfItemLocation" and "TopLoc_SListNodeOfItemLocation".

"NCollection_SList" class removed as unused (along with NCollection_DefineSList.hxx).
This commit is contained in:
dln 2014-04-08 14:21:26 +04:00 committed by abv
parent 3125ebb6f3
commit bd2de3965e
19 changed files with 120 additions and 586 deletions

View File

@ -29,7 +29,6 @@ NCollection_Array2.hxx
NCollection_HArray2.hxx NCollection_HArray2.hxx
NCollection_Stack.hxx NCollection_Stack.hxx
NCollection_List.hxx NCollection_List.hxx
NCollection_SList.hxx
NCollection_Set.hxx NCollection_Set.hxx
NCollection_HSet.hxx NCollection_HSet.hxx
NCollection_Map.hxx NCollection_Map.hxx
@ -51,7 +50,6 @@ NCollection_DefineDataMap.hxx
NCollection_DefineDoubleMap.hxx NCollection_DefineDoubleMap.hxx
NCollection_DefineIndexedMap.hxx NCollection_DefineIndexedMap.hxx
NCollection_DefineIndexedDataMap.hxx NCollection_DefineIndexedDataMap.hxx
NCollection_DefineSList.hxx
NCollection_DefineSequence.hxx NCollection_DefineSequence.hxx
NCollection_DefineHSequence.hxx NCollection_DefineHSequence.hxx
NCollection_DefineSet.hxx NCollection_DefineSet.hxx

View File

@ -1,54 +0,0 @@
// Created on: 2002-04-17
// Created by: Alexander Kartomin (akm)
// Copyright (c) 2002-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.
// Automatically created from NCollection_SList.hxx by GAWK
// Purpose: An SList is a LISP like list of Items.
// An SList is :
// . Empty.
// . Or it has a Value and a Tail which is an other SList.
// The Tail of an empty list is an empty list.
// SList are shared. It means that they can be
// modified through other lists.
// SList may be used as Iterators. They have Next,
// More, and value methods. To iterate on the content
// of the list S just do.
// SList Iterator;
// for (Iterator = S; Iterator.More(); Iterator.Next())
// X = Iterator.Value();
// Memory usage is automatically managed for SLists
// (using reference counts).
// Example:
// If S1 and S2 are SLists :
// if S1.Value() is X.
// And the following is done :
// S2 = S1;
// S2.SetValue(Y);
// S1.Value() becomes also Y. So SList must be used
// with care. Mainly the SetValue() method is
// dangerous.
#ifndef NCollection_DefineSList_HeaderFile
#define NCollection_DefineSList_HeaderFile
#include <NCollection_DefineBaseCollection.hxx>
#include <NCollection_SList.hxx>
// **************************************** Template for SList class ********
#define DEFINE_SLIST(_ClassName_, _BaseCollection_, TheItemType) \
typedef NCollection_SList<TheItemType > _ClassName_;
#endif

View File

@ -1,285 +0,0 @@
// Created on: 2002-04-17
// Created by: Alexander Kartomin (akm)
// Copyright (c) 2002-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 NCollection_SList_HeaderFile
#define NCollection_SList_HeaderFile
#include <NCollection_BaseCollection.hxx>
#if !defined No_Exception && !defined No_Standard_NoSuchObject
#include <Standard_NoSuchObject.hxx>
#endif
/**
* Purpose: An SList is a LISP like list of Items.
* An SList is :
* . Empty.
* . Or it has a Value and a Tail which is an other SList.
*
* The Tail of an empty list is an empty list.
* SList are shared. It means that they can be
* modified through other lists.
* SList may be used as Iterators. They have Next,
* More, and value methods. To iterate on the content
* of the list S just do.
*
* SList Iterator;
* for (Iterator = S; Iterator.More(); Iterator.Next())
* X = Iterator.Value();
*
* Memory usage is automatically managed for SLists
* (using reference counts).
*
* Example:
* If S1 and S2 are SLists :
* if S1.Value() is X.
*
* And the following is done :
* S2 = S1;
* S2.SetValue(Y);
*
* S1.Value() becomes also Y. So SList must be used
* with care. Mainly the SetValue() method is
* dangerous.
*/
template <class TheItemType> class NCollection_SList
: public NCollection_BaseCollection<TheItemType>,
public NCollection_BaseCollection<TheItemType>::Iterator
{
public:
//! The node of SList
class SListNode
{
private:
//! Constructor
SListNode (const TheItemType& theItem,
const NCollection_SList& theTail) :
myCount(1),
myValue(theItem)
{ myTail = new (theTail.myAllocator) NCollection_SList(theTail); }
//! Tail
NCollection_SList& Tail (void)
{ return (*myTail); }
//! Value
TheItemType& Value (void)
{ return myValue; }
//! Clear
void Clear (void)
{
myTail->Clear();
myTail->myAllocator->Free(myTail);
}
DEFINE_STANDARD_ALLOC
DEFINE_NCOLLECTION_ALLOC
private:
// ---------- PRIVATE FIELDS ------------
Standard_Integer myCount; //!< Reference count
NCollection_SList * myTail; //!< The tail
TheItemType myValue; //!< Datum
// Everything above is private. Only SList has an access
friend class NCollection_SList<TheItemType>;
}; // End of nested class SListNode
public:
// ---------- PUBLIC METHODS ------------
//! Empty constructor
NCollection_SList(const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
NCollection_BaseCollection<TheItemType>(theAllocator),
myNode(NULL) {}
//! Constructor
NCollection_SList(const TheItemType& theItem,
const NCollection_SList& theTail) :
NCollection_BaseCollection<TheItemType>(theTail.myAllocator)
{ myNode = new (theTail.myAllocator) SListNode(theItem,theTail); }
//! Copy constructor
NCollection_SList (const NCollection_SList& theOther) :
NCollection_BaseCollection<TheItemType>(theOther.myAllocator)
{
myNode = theOther.myNode;
if (myNode)
myNode->myCount++;
}
//! Clear the items out
void Clear (void)
{
if (!myNode)
return;
myNode->myCount--;
if (myNode->myCount < 1)
{
myNode->Clear();
this->myAllocator->Free(myNode);
}
myNode = NULL;
}
//! Make this list identical to theOther
NCollection_SList& operator= (const NCollection_SList& theOther)
{
if (myNode != theOther.myNode)
{
if (theOther.myNode)
theOther.myNode->myCount++;
Clear();
this->myAllocator = theOther.myAllocator;
myNode = theOther.myNode;
}
return *this;
}
//! Replace this list by the items of theOther collection
virtual void Assign (const NCollection_BaseCollection<TheItemType>& theOther)
{
if (this == &theOther)
return;
Clear();
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& anIter =
theOther.CreateIterator();
if (!anIter.More())
return;
SListNode *aNode, *aPrevNode=NULL;
for (; anIter.More(); anIter.Next())
{
aNode = new (this->myAllocator) SListNode
(anIter.Value(), NCollection_SList(this->myAllocator));
if (IsEmpty())
myNode = aNode;
else
aPrevNode->Tail().myNode = aNode;
aPrevNode = aNode;
}
}
//! IsEmpty query
Standard_Boolean IsEmpty (void) const
{ return (myNode==NULL); }
//! Value - constant access
virtual const TheItemType& Value (void) const
{
#if !defined No_Exception && !defined No_Standard_NoSuchObject
if (IsEmpty())
Standard_NoSuchObject::Raise ("NCollection_SList::Value");
#endif
return myNode->Value();
}
//! ChangeValue - variable access
virtual TheItemType& ChangeValue (void) const
{
#if !defined No_Exception && !defined No_Standard_NoSuchObject
if (IsEmpty())
Standard_NoSuchObject::Raise ("NCollection_SList::ChangeValue");
#endif
return myNode->Value();
}
//! SetValue
void SetValue (const TheItemType& theItem)
{
#if !defined No_Exception && !defined No_Standard_NoSuchObject
if (IsEmpty())
Standard_NoSuchObject::Raise ("NCollection_SList::SetValue");
#endif
myNode->Value() = theItem;
}
//! Tail
const NCollection_SList& Tail (void) const
{
if (!IsEmpty())
return myNode->Tail();
else
return *this;
}
//! ChangeTail
NCollection_SList& ChangeTail (void)
{
if (!IsEmpty())
return myNode->Tail();
else
return *this;
}
//! SetTail
void SetTail (NCollection_SList& theList)
{
if (!IsEmpty())
myNode->Tail() = theList;
else
*this = theList;
}
//! Construct
void Construct(const TheItemType& theItem)
{ *this = NCollection_SList (theItem, *this); }
//! Constructed
NCollection_SList Constructed(const TheItemType& theItem) const
{ return NCollection_SList (theItem, *this); }
//! ToTail
void ToTail (void)
{ *this = Tail(); }
//! Initialize (~Assign)
void Initialize (const NCollection_SList& theOther)
{ *this = theOther; }
//! Init (virtual method of base iterator)
void Init (const NCollection_SList& theOther)
{ *this = theOther; }
//! More (~!IsEmpty)
virtual Standard_Boolean More (void) const
{ return !IsEmpty(); }
//! Next (~ToTail)
virtual void Next (void)
{ ToTail(); }
//! Size - Number of items
virtual Standard_Integer Size (void) const
{ return (IsEmpty() ? 0 : 1+myNode->Tail().Size()); }
//! Destructor - clears the SList
~NCollection_SList (void)
{ Clear(); }
private:
// ----------- PRIVATE METHODS -----------
//! Creates Iterator for use on BaseCollection
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator&
CreateIterator(void) const
{ return *(new (this->IterAllocator()) NCollection_SList(*this)); }
private:
// ---------- PRIVATE FIELDS ------------
SListNode* myNode;
friend class SListNode;
};
#endif

View File

@ -24,7 +24,6 @@ uses
is is
class ListOfPnt instantiates List from TCollection (Pnt from gp); class ListOfPnt instantiates List from TCollection (Pnt from gp);
class StackOfPnt instantiates Stack from TCollection (Pnt from gp); class StackOfPnt instantiates Stack from TCollection (Pnt from gp);
class SListOfPnt instantiates SList from TCollection (Pnt from gp);
class DataMapOfRealPnt instantiates DataMap from TCollection class DataMapOfRealPnt instantiates DataMap from TCollection
(Real from Standard, (Real from Standard,
Pnt from gp, Pnt from gp,

View File

@ -237,21 +237,6 @@ static Standard_Integer QANColTestSet(Draw_Interpretor& di, Standard_Integer arg
return 0; return 0;
} }
//=======================================================================
//function : QANColTestSList
//purpose :
//=======================================================================
static Standard_Integer QANColTestSList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if ( argc != 1) {
di << "Usage : " << argv[0] << "\n";
return 1;
}
QANCollection_SListFunc aSList;
TestSList(aSList);
return 0;
}
//======================================================================= //=======================================================================
//function : QANColTestSequence //function : QANColTestSequence
//purpose : //purpose :
@ -281,7 +266,6 @@ void QANCollection::Commands2(Draw_Interpretor& theCommands) {
theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group); theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
theCommands.Add("QANColTestStack", "QANColTestStack", __FILE__, QANColTestStack, group); theCommands.Add("QANColTestStack", "QANColTestStack", __FILE__, QANColTestStack, group);
theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group); theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group);
theCommands.Add("QANColTestSList", "QANColTestSList", __FILE__, QANColTestSList, group);
theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group); theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group);
return; return;

View File

@ -125,20 +125,6 @@ static Standard_Integer QANColPerfSet(Draw_Interpretor& di, Standard_Integer arg
return 0; return 0;
} }
//=======================================================================
//function : QANColPerfSList
//purpose :
//=======================================================================
static Standard_Integer QANColPerfSList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
Standard_Integer Repeat, Size;
if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
return 1;
}
CompSList(Repeat,Size);
return 0;
}
//======================================================================= //=======================================================================
//function : QANColPerfSequence //function : QANColPerfSequence
//purpose : //purpose :
@ -246,7 +232,6 @@ void QANCollection::Commands3(Draw_Interpretor& theCommands) {
theCommands.Add("QANColPerfList", "QANColPerfList Repeat Size", __FILE__, QANColPerfList, group); theCommands.Add("QANColPerfList", "QANColPerfList Repeat Size", __FILE__, QANColPerfList, group);
theCommands.Add("QANColPerfStack", "QANColPerfStack Repeat Size", __FILE__, QANColPerfStack, group); theCommands.Add("QANColPerfStack", "QANColPerfStack Repeat Size", __FILE__, QANColPerfStack, group);
theCommands.Add("QANColPerfSet", "QANColPerfSet Repeat Size", __FILE__, QANColPerfSet, group); theCommands.Add("QANColPerfSet", "QANColPerfSet Repeat Size", __FILE__, QANColPerfSet, group);
theCommands.Add("QANColPerfSList", "QANColPerfSList Repeat Size", __FILE__, QANColPerfSList, group);
theCommands.Add("QANColPerfSequence", "QANColPerfSequence Repeat Size", __FILE__, QANColPerfSequence, group); theCommands.Add("QANColPerfSequence", "QANColPerfSequence Repeat Size", __FILE__, QANColPerfSequence, group);
theCommands.Add("QANColPerfMap", "QANColPerfMap Repeat Size", __FILE__, QANColPerfMap, group); theCommands.Add("QANColPerfMap", "QANColPerfMap Repeat Size", __FILE__, QANColPerfMap, group);
theCommands.Add("QANColPerfDataMap", "QANColPerfDataMap Repeat Size", __FILE__, QANColPerfDataMap, group); theCommands.Add("QANColPerfDataMap", "QANColPerfDataMap Repeat Size", __FILE__, QANColPerfDataMap, group);

View File

@ -79,10 +79,6 @@ DEFINE_STACK(QANCollection_StackFunc,QANCollection_BaseColFunc,ItemType)
DEFINE_SET(QANCollection_SetFunc,QANCollection_Key2BaseColFunc,Key2Type) DEFINE_SET(QANCollection_SetFunc,QANCollection_Key2BaseColFunc,Key2Type)
DEFINE_HSET(QANCollection_HSetFunc,QANCollection_SetFunc) DEFINE_HSET(QANCollection_HSetFunc,QANCollection_SetFunc)
#include <NCollection_DefineSList.hxx>
////////////////////////////////DEFINE_SLIST(QANCollection_SList,QANCollection_BaseCol,ItemType)
DEFINE_SLIST(QANCollection_SListFunc,QANCollection_BaseColFunc,ItemType)
#include <NCollection_DefineSequence.hxx> #include <NCollection_DefineSequence.hxx>
#include <NCollection_DefineHSequence.hxx> #include <NCollection_DefineHSequence.hxx>
////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType) ////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)

View File

@ -79,10 +79,6 @@ DEFINE_STACK(QANCollection_StackPerf,QANCollection_BaseColPerf,ItemType)
DEFINE_SET(QANCollection_SetPerf,QANCollection_Key2BaseColPerf,Key2Type) DEFINE_SET(QANCollection_SetPerf,QANCollection_Key2BaseColPerf,Key2Type)
DEFINE_HSET(QANCollection_HSetPerf,QANCollection_SetPerf) DEFINE_HSET(QANCollection_HSetPerf,QANCollection_SetPerf)
#include <NCollection_DefineSList.hxx>
////////////////////////////////DEFINE_SLIST(QANCollection_SList,QANCollection_BaseCol,ItemType)
DEFINE_SLIST(QANCollection_SListPerf,QANCollection_BaseColPerf,ItemType)
#include <NCollection_DefineSequence.hxx> #include <NCollection_DefineSequence.hxx>
#include <NCollection_DefineHSequence.hxx> #include <NCollection_DefineHSequence.hxx>
////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType) ////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)

View File

@ -156,46 +156,6 @@ void TestSet (QANCollection_SetFunc& theS)
aSet.Clear(); aSet.Clear();
} }
// ===================== Test methods of SList type ===========================
////////////////////////////////void TestSList (QANCollection_SList& theSL)
void TestSList (QANCollection_SListFunc& theSL)
{
printf ("Info: testing SList\n");
ItemType anItem;
////////////////////////////////QANCollection_SList aSL, aSL1;
QANCollection_SListFunc aSL, aSL1;
// Construct, Constructed, operator=, IsEmpty
Random(anItem);
aSL.Construct(anItem);
Random(anItem);
aSL1 = aSL.Constructed(anItem);
if (aSL.IsEmpty())
printf ("Error : SList must not be empty\n");
printCollection(aSL1,"aSL1");
Random(anItem);
aSL.Construct(anItem);
// SetTail
aSL.SetTail(aSL1);
printCollection(aSL,"aSL");
// ChangeValue
Random(aSL1.Tail().ChangeValue());
// ChangeTail, ToTail
Random(anItem);
theSL.Construct(anItem);
printCollection(theSL,"theSL");
theSL.ChangeTail() = aSL;
printCollection(theSL,"theSL");
// Assign
AssignCollection (aSL, theSL);
// Clear
aSL.Clear();
}
// ===================== Test methods of Sequence type ======================== // ===================== Test methods of Sequence type ========================
////////////////////////////////void TestSequence (QANCollection_Sequence& theS) ////////////////////////////////void TestSequence (QANCollection_Sequence& theS)
void TestSequence (QANCollection_SequenceFunc& theS) void TestSequence (QANCollection_SequenceFunc& theS)

View File

@ -36,7 +36,6 @@
// Standard_EXPORT void TestList (QANCollection_List& theLi); // Standard_EXPORT void TestList (QANCollection_List& theLi);
// Standard_EXPORT void TestStack (QANCollection_Stack& theSt); // Standard_EXPORT void TestStack (QANCollection_Stack& theSt);
// Standard_EXPORT void TestSet (QANCollection_Set& theSe); // Standard_EXPORT void TestSet (QANCollection_Set& theSe);
// Standard_EXPORT void TestSList (QANCollection_SList& theSL);
// Standard_EXPORT void TestSequence(QANCollection_Sequence& theSq); // Standard_EXPORT void TestSequence(QANCollection_Sequence& theSq);
#include <QANCollection_FuncLists.hxx> #include <QANCollection_FuncLists.hxx>

View File

@ -17,7 +17,6 @@
#define QANCollection_PerfLists_HeaderFile #define QANCollection_PerfLists_HeaderFile
#include <QANCollection_ListOfPnt.hxx> #include <QANCollection_ListOfPnt.hxx>
#include <QANCollection_SListOfPnt.hxx>
#include <QANCollection_StackOfPnt.hxx> #include <QANCollection_StackOfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx> #include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_SetOfInteger.hxx> #include <TColStd_SetOfInteger.hxx>
@ -273,78 +272,6 @@ void CompSet (const Standard_Integer theRep,
PERF_PRINT_ALL PERF_PRINT_ALL
} }
// ===================== Test perform of SList type ==========================
void CompSList (const Standard_Integer theRep,
const Standard_Integer theSize)
{
Standard_Integer i,j;
////////////////////////////////Perf_Meter aNAppe ("NCollection_SList constructing",0);
////////////////////////////////Perf_Meter aTAppe ("TCollection_SList constructing",0);
////////////////////////////////Perf_Meter aNOper ("NCollection_SList operator=",0);
////////////////////////////////Perf_Meter aTOper ("TCollection_SList operator=",0);
////////////////////////////////Perf_Meter aNAssi ("NCollection_SList Assign",0);
////////////////////////////////Perf_Meter aNClea ("NCollection_SList clearing",0);
////////////////////////////////Perf_Meter aTClea ("TCollection_SList clearing",0);
for (i=0; i<theRep; i++)
{
////////////////////////////////QANCollection_SList a1, a2;
QANCollection_SListPerf a1, a2;
////////////////////////////////aNAppe.Start();
PERF_START_METER("NCollection_SList constructing")
for (j=1; j<=theSize; j++)
{
ItemType anItem;
Random(anItem);
a1.Construct(anItem);
}
////////////////////////////////aNAppe.Stop();
PERF_STOP_METER("NCollection_SList constructing")
////////////////////////////////aNOper.Start();
PERF_START_METER("NCollection_SList operator=")
a2 = a1;
////////////////////////////////aNOper.Stop();
PERF_STOP_METER("NCollection_SList operator=")
////////////////////////////////aNAssi.Start();
PERF_START_METER("NCollection_SList Assign")
a2.Assign(a1);
////////////////////////////////aNAssi.Stop();
PERF_STOP_METER("NCollection_SList Assign")
////////////////////////////////aNClea.Start();
PERF_START_METER("NCollection_SList clearing")
a2.Clear();
////////////////////////////////aNClea.Stop();
PERF_STOP_METER("NCollection_SList clearing")
}
for (i=0; i<theRep; i++)
{
QANCollection_SListOfPnt a1, a2;
////////////////////////////////aTAppe.Start();
PERF_START_METER("TCollection_SList constructing")
for (j=1; j<=theSize; j++)
{
ItemType anItem;
Random(anItem);
a1.Construct(anItem);
}
////////////////////////////////aTAppe.Stop();
PERF_STOP_METER("TCollection_SList constructing")
////////////////////////////////aTOper.Start();
PERF_START_METER("TCollection_SList operator=")
a2 = a1;
////////////////////////////////aTOper.Stop();
PERF_STOP_METER("TCollection_SList operator=")
////////////////////////////////aTClea.Start();
PERF_START_METER("TCollection_SList clearing")
a2.Clear();
////////////////////////////////aTClea.Stop();
PERF_STOP_METER("TCollection_SList clearing")
}
PERF_PRINT_ALL
}
// ===================== Test perform of Sequence type ========================== // ===================== Test perform of Sequence type ==========================
void CompSequence (const Standard_Integer theRep, void CompSequence (const Standard_Integer theRep,
const Standard_Integer theSize) const Standard_Integer theSize)

View File

@ -22,7 +22,7 @@
-- Adding of modifying classes -- Adding of modifying classes
-- - Sequence, HSequence -- - Sequence, HSequence
-- - Set, HSet -- - Set, HSet
-- - List, SList -- - List
-- - Stack -- - Stack
-- - BasicMap, BasicMapIterator -- - BasicMap, BasicMapIterator
-- - Map, DataMap, DoubleMap, IndexedMap, IndexedDataMap -- - Map, DataMap, DoubleMap, IndexedMap, IndexedDataMap
@ -58,9 +58,6 @@ is
generic class List, ListNode, ListIterator; generic class List, ListNode, ListIterator;
---Purpose: A single list handled by value. ---Purpose: A single list handled by value.
generic class SList,SListNode;
---Purpose: A LISP like sharable list.
class BaseSequence; class BaseSequence;
class SeqNode; class SeqNode;
pointer SeqNodePtr to SeqNode from TCollection; pointer SeqNodePtr to SeqNode from TCollection;

View File

@ -42,9 +42,8 @@ is
---Purpose: Used to implement the Location. A Datum3D with a ---Purpose: Used to implement the Location. A Datum3D with a
-- power elevation. -- power elevation.
private class SListOfItemLocation instantiates private class SListOfItemLocation;
SList from TCollection(ItemLocation from TopLoc); private class SListNodeOfItemLocation;
---Purpose: Used to implement the Location.
class Location; class Location;
---Purpose: A Local Coordinate System. A list of elementary ---Purpose: A Local Coordinate System. A list of elementary

View File

@ -0,0 +1,45 @@
-- 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.
private class SListNodeOfItemLocation from TopLoc inherits TShared from MMgt
uses
SListOfItemLocation from TopLoc,
ItemLocation from TopLoc
is
Create(I : ItemLocation from TopLoc; aTail : SListOfItemLocation from TopLoc) returns mutable SListNodeOfItemLocation from TopLoc;
---C++:inline
Count(me) returns Integer;
---C++:inline
---C++: return &
Tail(me) returns SListOfItemLocation from TopLoc;
---C++:inline
---C++: return &
Value(me) returns ItemLocation from TopLoc;
---C++:inline
---C++: return &
fields
myTail : SListOfItemLocation from TopLoc;
myValue : ItemLocation from TopLoc;
end;

View File

@ -11,3 +11,6 @@
// //
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <TopLoc_SListNodeOfItemLocation.ixx>

View File

@ -12,18 +12,20 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
inline TCollection_SListNode::TCollection_SListNode(const Item& I, const TCollection_SList& T) #include <TopLoc_ItemLocation.hxx>
inline TopLoc_SListNodeOfItemLocation::TopLoc_SListNodeOfItemLocation(const TopLoc_ItemLocation& I, const TopLoc_SListOfItemLocation& T)
: myTail(T),myValue(I) : myTail(T),myValue(I)
{ {
} }
inline TCollection_SList& TCollection_SListNode::Tail() const inline TopLoc_SListOfItemLocation& TopLoc_SListNodeOfItemLocation::Tail() const
{ {
return (TCollection_SList&)myTail; return (TopLoc_SListOfItemLocation&)myTail;
} }
inline Item& TCollection_SListNode::Value() const inline TopLoc_ItemLocation& TopLoc_SListNodeOfItemLocation::Value() const
{ {
return (Item&)myValue; return (TopLoc_ItemLocation&)myValue;
} }

View File

@ -14,78 +14,59 @@
-- Alternatively, this file may be used under the terms of Open CASCADE -- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement. -- commercial license or contractual agreement.
generic class SList from TCollection (Item as any) private class SListOfItemLocation from TopLoc
---Purpose: An SList is a LISP like list of Items. ---Purpose: An SListOfItemLocation is a LISP like list of Items.
-- An SList is : -- An SListOfItemLocation is :
-- . Empty. -- . Empty.
-- . Or it has a Value and a Tail which is an other SList. -- . Or it has a Value and a Tail which is an other SListOfItemLocation.
-- --
-- The Tail of an empty list is an empty list. -- The Tail of an empty list is an empty list.
-- SList are shared. It means that they can be -- SListOfItemLocation are shared. It means that they can be
-- modified through other lists. -- modified through other lists.
-- SList may be used as Iterators. They have Next, -- SListOfItemLocation may be used as Iterators. They have Next,
-- More, and value methods. To iterate on the content -- More, and value methods. To iterate on the content
-- of the list S just do. -- of the list S just do.
-- --
-- SList Iterator; -- SListOfItemLocation Iterator;
-- for (Iterator = S; Iterator.More(); Iterator.Next()) -- for (Iterator = S; Iterator.More(); Iterator.Next())
-- X = Iterator.Value(); -- X = Iterator.Value();
-- --
-- Memory usage is automatically managed for SLists -- Memory usage is automatically managed for SListOfItemLocations
-- (using reference counts). -- (using reference counts).
---Example: ---Example:
-- If S1 and S2 are SLists : -- If S1 and S2 are SListOfItemLocations :
-- if S1.Value() is X. -- if S1.Value() is X.
-- --
-- And the following is done : -- And the following is done :
-- S2 = S1; -- S2 = S1;
-- S2.SetValue(Y); -- S2.SetValue(Y);
-- --
-- S1.Value() becomes also Y. So SList must be used -- S1.Value() becomes also Y. So SListOfItemLocation must be used
-- with care. Mainly the SetValue() method is -- with care. Mainly the SetValue() method is
-- dangerous. -- dangerous.
uses
SListNodeOfItemLocation from TopLoc,
ItemLocation from TopLoc
raises raises
NoSuchObject from Standard NoSuchObject from Standard
class SListNode from TCollection
inherits TShared from MMgt
is
Create(I : Item; aTail : SList from TCollection) returns mutable SListNode from TCollection;
---C++:inline
Count(me) returns Integer;
---C++:inline
---C++: return &
Tail(me) returns SList from TCollection;
---C++:inline
---C++: return &
Value(me) returns Item;
---C++:inline
---C++: return &
fields
myTail : SList from TCollection;
myValue : Item;
end;
is is
Create returns SList from TCollection; Create returns SListOfItemLocation from TopLoc;
---Purpose: Creates an empty List. ---Purpose: Creates an empty List.
Create(anItem : Item; aTail : SList from TCollection) Create(anItem : ItemLocation from TopLoc; aTail : SListOfItemLocation from TopLoc)
returns SList from TCollection; returns SListOfItemLocation from TopLoc;
---Purpose: Creates a List with <anItem> as value and <aTail> as tail. ---Purpose: Creates a List with <anItem> as value and <aTail> as tail.
Create(Other : SList from TCollection) Create(Other : SListOfItemLocation from TopLoc)
returns SList from TCollection; returns SListOfItemLocation from TopLoc;
---Purpose: Creates a list from an other one. The lists are shared. ---Purpose: Creates a list from an other one. The lists are shared.
Assign(me : in out; Other : SList from TCollection) Assign(me : in out; Other : SListOfItemLocation from TopLoc)
returns SList from TCollection returns SListOfItemLocation from TopLoc
---Level: Public ---Level: Public
---Purpose: Sets a list from an other one. The lists are ---Purpose: Sets a list from an other one. The lists are
-- shared. The list itself is returned. -- shared. The list itself is returned.
@ -104,7 +85,7 @@ is
---C++: alias ~ ---C++: alias ~
is static; is static;
Value(me) returns any Item Value(me) returns any ItemLocation from TopLoc
---Level: Public ---Level: Public
---Purpose: Returns the current value of the list. An error is ---Purpose: Returns the current value of the list. An error is
-- raised if the list is empty. -- raised if the list is empty.
@ -113,7 +94,7 @@ is
NoSuchObject from Standard NoSuchObject from Standard
is static; is static;
ChangeValue(me : in out) returns any Item ChangeValue(me : in out) returns any ItemLocation from TopLoc
---Level: Public ---Level: Public
---Purpose: Returns the current value of the list. An error is ---Purpose: Returns the current value of the list. An error is
-- raised if the list is empty. This value may be -- raised if the list is empty. This value may be
@ -125,7 +106,7 @@ is
NoSuchObject from Standard NoSuchObject from Standard
is static; is static;
SetValue(me : in out; anItem : Item) SetValue(me : in out; anItem : ItemLocation from TopLoc)
---Level: Public ---Level: Public
---Purpose: Changes the current value in the list. An error is ---Purpose: Changes the current value in the list. An error is
-- raised if the list is empty. -- raised if the list is empty.
@ -133,14 +114,14 @@ is
NoSuchObject from Standard NoSuchObject from Standard
is static; is static;
Tail(me) returns SList from TCollection Tail(me) returns SListOfItemLocation from TopLoc
---Level: Public ---Level: Public
---Purpose: Returns the current tail of the list. On an empty ---Purpose: Returns the current tail of the list. On an empty
-- list the tail is the list itself. -- list the tail is the list itself.
---C++: return const & ---C++: return const &
is static; is static;
ChangeTail(me : in out) returns SList from TCollection ChangeTail(me : in out) returns SListOfItemLocation from TopLoc
---Level: Public ---Level: Public
---Purpose: Returns the current tail of the list. This tail ---Purpose: Returns the current tail of the list. This tail
-- may be modified. A method modifying the tail can -- may be modified. A method modifying the tail can
@ -149,20 +130,20 @@ is
---C++: return & ---C++: return &
is static; is static;
SetTail(me : in out; aList : SList from TCollection) SetTail(me : in out; aList : SListOfItemLocation from TopLoc)
---Level: Public ---Level: Public
---Purpose: Changes the current tail in the list. On an empty ---Purpose: Changes the current tail in the list. On an empty
-- list SetTail is Assign. -- list SetTail is Assign.
is static; is static;
Construct(me : in out; anItem : Item) Construct(me : in out; anItem : ItemLocation from TopLoc)
---Level: Public ---Level: Public
---Purpose: Replaces the list by a list with <anItem> as Value ---Purpose: Replaces the list by a list with <anItem> as Value
-- and the list <me> as tail. -- and the list <me> as tail.
---C++: inline ---C++: inline
is static; is static;
Constructed(me; anItem : Item) returns SList from TCollection Constructed(me; anItem : ItemLocation from TopLoc) returns SListOfItemLocation from TopLoc
---Level: Public ---Level: Public
---Purpose: Returns a new list with <anItem> as Value an the ---Purpose: Returns a new list with <anItem> as Value an the
-- list <me> as tail. -- list <me> as tail.
@ -175,7 +156,7 @@ is
---C++: inline ---C++: inline
is static; is static;
Initialize(me : in out; aList : SList from TCollection) Initialize(me : in out; aList : SListOfItemLocation from TopLoc)
---Level: Public ---Level: Public
---Purpose: Sets the iterator to iterate on the content of ---Purpose: Sets the iterator to iterate on the content of
-- <aList>. This is Assign(). -- <aList>. This is Assign().
@ -197,6 +178,6 @@ is
is static; is static;
fields fields
myNode : SListNode from TCollection; myNode : SListNodeOfItemLocation from TopLoc;
end SList; end SListOfItemLocation;

View File

@ -14,32 +14,34 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
#include <TopLoc_SListOfItemLocation.ixx>
#include <Standard_NoSuchObject.hxx> #include <Standard_NoSuchObject.hxx>
//======================================================================= //=======================================================================
//function : TCollection_SList //function : TopLoc_SListOfItemLocation
//purpose : //purpose :
//======================================================================= //=======================================================================
TCollection_SList::TCollection_SList() TopLoc_SListOfItemLocation::TopLoc_SListOfItemLocation()
{} {}
//======================================================================= //=======================================================================
//function : TCollection_SList //function : TopLoc_SListOfItemLocation
//purpose : //purpose :
//======================================================================= //=======================================================================
TCollection_SList::TCollection_SList(const Item& anItem, TopLoc_SListOfItemLocation::TopLoc_SListOfItemLocation(const TopLoc_ItemLocation& anItem,
const TCollection_SList& aTail) : const TopLoc_SListOfItemLocation& aTail) :
myNode(new TCollection_SListNode(anItem,aTail)) myNode(new TopLoc_SListNodeOfItemLocation(anItem,aTail))
{} {}
//======================================================================= //=======================================================================
//function : TCollection_SList //function : TopLoc_SListOfItemLocation
//purpose : //purpose :
//======================================================================= //=======================================================================
TCollection_SList::TCollection_SList(const TCollection_SList& Other) : TopLoc_SListOfItemLocation::TopLoc_SListOfItemLocation(const TopLoc_SListOfItemLocation& Other) :
myNode(Other.myNode) myNode(Other.myNode)
{ {
} }
@ -49,7 +51,7 @@ TCollection_SList::TCollection_SList(const TCollection_SList& Other) :
//purpose : //purpose :
//======================================================================= //=======================================================================
TCollection_SList& TCollection_SList::Assign(const TCollection_SList& Other) TopLoc_SListOfItemLocation& TopLoc_SListOfItemLocation::Assign(const TopLoc_SListOfItemLocation& Other)
{ {
if (this == &Other) return *this; if (this == &Other) return *this;
Clear(); Clear();
@ -63,7 +65,7 @@ TCollection_SList& TCollection_SList::Assign(const TCollection_SList& Other)
//purpose : //purpose :
//======================================================================= //=======================================================================
void TCollection_SList::Clear() void TopLoc_SListOfItemLocation::Clear()
{ {
if (!myNode.IsNull()) { if (!myNode.IsNull()) {
myNode.Nullify(); myNode.Nullify();
@ -75,9 +77,9 @@ void TCollection_SList::Clear()
//purpose : //purpose :
//======================================================================= //=======================================================================
const Item& TCollection_SList::Value() const const TopLoc_ItemLocation& TopLoc_SListOfItemLocation::Value() const
{ {
Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TCollection_SList::Value"); Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TopLoc_SListOfItemLocation::Value");
return myNode->Value(); return myNode->Value();
} }
@ -86,9 +88,9 @@ const Item& TCollection_SList::Value() const
//purpose : //purpose :
//======================================================================= //=======================================================================
Item& TCollection_SList::ChangeValue() TopLoc_ItemLocation& TopLoc_SListOfItemLocation::ChangeValue()
{ {
Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TCollection_SList::Value"); Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TopLoc_SListOfItemLocation::Value");
return myNode->Value(); return myNode->Value();
} }
@ -97,9 +99,9 @@ Item& TCollection_SList::ChangeValue()
//purpose : //purpose :
//======================================================================= //=======================================================================
void TCollection_SList::SetValue(const Item& anItem) void TopLoc_SListOfItemLocation::SetValue(const TopLoc_ItemLocation& anItem)
{ {
Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TCollection_SList::Value"); Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TopLoc_SListOfItemLocation::Value");
myNode->Value() = anItem; myNode->Value() = anItem;
} }
@ -108,7 +110,7 @@ void TCollection_SList::SetValue(const Item& anItem)
//purpose : //purpose :
//======================================================================= //=======================================================================
const TCollection_SList& TCollection_SList::Tail() const const TopLoc_SListOfItemLocation& TopLoc_SListOfItemLocation::Tail() const
{ {
if (!myNode.IsNull()) if (!myNode.IsNull())
return myNode->Tail(); return myNode->Tail();
@ -121,7 +123,7 @@ const TCollection_SList& TCollection_SList::Tail() const
//purpose : //purpose :
//======================================================================= //=======================================================================
TCollection_SList& TCollection_SList::ChangeTail() TopLoc_SListOfItemLocation& TopLoc_SListOfItemLocation::ChangeTail()
{ {
if (!myNode.IsNull()) if (!myNode.IsNull())
return myNode->Tail(); return myNode->Tail();
@ -134,7 +136,7 @@ TCollection_SList& TCollection_SList::ChangeTail()
//purpose : //purpose :
//======================================================================= //=======================================================================
void TCollection_SList::SetTail(const TCollection_SList& aList) void TopLoc_SListOfItemLocation::SetTail(const TopLoc_SListOfItemLocation& aList)
{ {
if (!myNode.IsNull()) if (!myNode.IsNull())
myNode->Tail() = aList; myNode->Tail() = aList;

View File

@ -19,7 +19,7 @@
//purpose : //purpose :
//======================================================================= //=======================================================================
inline Standard_Boolean TCollection_SList::IsEmpty() const inline Standard_Boolean TopLoc_SListOfItemLocation::IsEmpty() const
{ {
return myNode.IsNull(); return myNode.IsNull();
} }
@ -34,9 +34,9 @@ inline Standard_Boolean TCollection_SList::IsEmpty() const
//purpose : //purpose :
//======================================================================= //=======================================================================
inline void TCollection_SList::Construct(const Item& anItem) inline void TopLoc_SListOfItemLocation::Construct(const TopLoc_ItemLocation& anItem)
{ {
Assign(TCollection_SList(anItem,*this)); Assign(TopLoc_SListOfItemLocation(anItem,*this));
} }
//======================================================================= //=======================================================================
@ -44,9 +44,9 @@ inline void TCollection_SList::Construct(const Item& anItem)
//purpose : //purpose :
//======================================================================= //=======================================================================
inline TCollection_SList TCollection_SList::Constructed(const Item& anItem) const inline TopLoc_SListOfItemLocation TopLoc_SListOfItemLocation::Constructed(const TopLoc_ItemLocation& anItem) const
{ {
return TCollection_SList(anItem,*this); return TopLoc_SListOfItemLocation(anItem,*this);
} }
//======================================================================= //=======================================================================
@ -54,7 +54,7 @@ inline TCollection_SList TCollection_SList::Constructed(const Item& anItem) cons
//purpose : //purpose :
//======================================================================= //=======================================================================
inline void TCollection_SList::ToTail() inline void TopLoc_SListOfItemLocation::ToTail()
{ {
Assign(Tail()); Assign(Tail());
} }
@ -64,7 +64,7 @@ inline void TCollection_SList::ToTail()
//purpose : //purpose :
//======================================================================= //=======================================================================
inline void TCollection_SList::Initialize(const TCollection_SList& aList) inline void TopLoc_SListOfItemLocation::Initialize(const TopLoc_SListOfItemLocation& aList)
{ {
Assign(aList); Assign(aList);
} }
@ -74,7 +74,7 @@ inline void TCollection_SList::Initialize(const TCollection_SList& aList)
//purpose : //purpose :
//======================================================================= //=======================================================================
inline Standard_Boolean TCollection_SList::More() const inline Standard_Boolean TopLoc_SListOfItemLocation::More() const
{ {
return !IsEmpty(); return !IsEmpty();
} }
@ -84,7 +84,7 @@ inline Standard_Boolean TCollection_SList::More() const
//purpose : //purpose :
//======================================================================= //=======================================================================
inline void TCollection_SList::Next() inline void TopLoc_SListOfItemLocation::Next()
{ {
ToTail(); ToTail();
} }