1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024742: Remove rarely used collection classes: Stack

Generic class TCollection_Stack removed (along with TCollection_StackIterator and TCollection_StackNode).

Code using TCollection_Stack changed to equivalent use of TCollection_List (replacing Push -> Prepend, Top -> First, Pop -> RemoveFirst).
This commit is contained in:
dln
2014-04-08 14:22:56 +04:00
committed by abv
parent bd2de3965e
commit 6af4fe1c46
41 changed files with 73 additions and 986 deletions

View File

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

View File

@@ -207,21 +207,6 @@ static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer ar
return 0;
}
//=======================================================================
//function : QANColTestStack
//purpose :
//=======================================================================
static Standard_Integer QANColTestStack(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
if ( argc != 1) {
di << "Usage : " << argv[0] << "\n";
return 1;
}
QANCollection_StackFunc aStack;
TestStack(aStack);
return 0;
}
//=======================================================================
//function : QANColTestSet
//purpose :
@@ -264,7 +249,6 @@ void QANCollection::Commands2(Draw_Interpretor& theCommands) {
theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group);
theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group);
theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
theCommands.Add("QANColTestStack", "QANColTestStack", __FILE__, QANColTestStack, group);
theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group);
theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group);

View File

@@ -97,20 +97,6 @@ static Standard_Integer QANColPerfList(Draw_Interpretor& di, Standard_Integer ar
return 0;
}
//=======================================================================
//function : QANColPerfStack
//purpose :
//=======================================================================
static Standard_Integer QANColPerfStack(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
Standard_Integer Repeat, Size;
if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
return 1;
}
CompStack(Repeat,Size);
return 0;
}
//=======================================================================
//function : QANColPerfSet
//purpose :
@@ -230,7 +216,6 @@ void QANCollection::Commands3(Draw_Interpretor& theCommands) {
theCommands.Add("QANColPerfArray1", "QANColPerfArray1 Repeat Size", __FILE__, QANColPerfArray1, group);
theCommands.Add("QANColPerfArray2", "QANColPerfArray2 Repeat Size", __FILE__, QANColPerfArray2, group);
theCommands.Add("QANColPerfList", "QANColPerfList Repeat Size", __FILE__, QANColPerfList, group);
theCommands.Add("QANColPerfStack", "QANColPerfStack Repeat Size", __FILE__, QANColPerfStack, group);
theCommands.Add("QANColPerfSet", "QANColPerfSet Repeat Size", __FILE__, QANColPerfSet, group);
theCommands.Add("QANColPerfSequence", "QANColPerfSequence Repeat Size", __FILE__, QANColPerfSequence, group);
theCommands.Add("QANColPerfMap", "QANColPerfMap Repeat Size", __FILE__, QANColPerfMap, group);

View File

@@ -67,15 +67,12 @@ DEFINE_INDEXEDMAP(QANCollection_IndexedMapFunc,QANCollection_Key1BaseColFunc,Key
DEFINE_INDEXEDDATAMAP(QANCollection_IDMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
#include <NCollection_DefineList.hxx>
#include <NCollection_DefineStack.hxx>
#include <NCollection_DefineSet.hxx>
#include <NCollection_DefineHSet.hxx>
////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
////////////////////////////////DEFINE_STACK(QANCollection_Stack,QANCollection_BaseCol,ItemType)
////////////////////////////////DEFINE_SET(QANCollection_Set,QANCollection_Key2BaseCol,Key2Type)
////////////////////////////////DEFINE_HSET(QANCollection_HSet,QANCollection_Set)
DEFINE_LIST(QANCollection_ListFunc,QANCollection_BaseColFunc,ItemType)
DEFINE_STACK(QANCollection_StackFunc,QANCollection_BaseColFunc,ItemType)
DEFINE_SET(QANCollection_SetFunc,QANCollection_Key2BaseColFunc,Key2Type)
DEFINE_HSET(QANCollection_HSetFunc,QANCollection_SetFunc)

View File

@@ -67,15 +67,12 @@ DEFINE_INDEXEDMAP(QANCollection_IndexedMapPerf,QANCollection_Key1BaseColPerf,Key
DEFINE_INDEXEDDATAMAP(QANCollection_IDMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType)
#include <NCollection_DefineList.hxx>
#include <NCollection_DefineStack.hxx>
#include <NCollection_DefineSet.hxx>
#include <NCollection_DefineHSet.hxx>
////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
////////////////////////////////DEFINE_STACK(QANCollection_Stack,QANCollection_BaseCol,ItemType)
////////////////////////////////DEFINE_SET(QANCollection_Set,QANCollection_Key2BaseCol,Key2Type)
////////////////////////////////DEFINE_HSET(QANCollection_HSet,QANCollection_Set)
DEFINE_LIST(QANCollection_ListPerf,QANCollection_BaseColPerf,ItemType)
DEFINE_STACK(QANCollection_StackPerf,QANCollection_BaseColPerf,ItemType)
DEFINE_SET(QANCollection_SetPerf,QANCollection_Key2BaseColPerf,Key2Type)
DEFINE_HSET(QANCollection_HSetPerf,QANCollection_SetPerf)

View File

@@ -70,40 +70,6 @@ void TestList (QANCollection_ListFunc& theL)
aL.Clear();
}
// ===================== Test methods of Stack type ===========================
////////////////////////////////void TestStack (QANCollection_Stack& theS)
void TestStack (QANCollection_StackFunc& theS)
{
// Depth
Standard_Integer iDep=theS.Depth();
Standard_Integer i;
printf ("Info: testing Stack(%d)\n", iDep);
// Push, Pop, Top, ChangeTop
ItemType anItem;
////////////////////////////////QANCollection_Stack aS;
QANCollection_StackFunc aS;
for (i=0; i<4; i++)
{
Random (anItem);
aS.Push (anItem);
Random(aS.ChangeTop());
Random (anItem);
aS.Push (anItem);
PrintItem(aS.Top());
aS.Pop();
}
// Copy constructor + operator=
////////////////////////////////theS = QANCollection_Stack(aS);
theS = QANCollection_StackFunc(aS);
// Assign
AssignCollection (theS, aS);
// Clear
aS.Clear();
}
// ===================== Test methods of Set type =============================
////////////////////////////////void TestSet (QANCollection_Set& theS)
void TestSet (QANCollection_SetFunc& theS)

View File

@@ -34,7 +34,6 @@
// Standard_EXPORT void TestInDaMap (QANCollection_IDMap& theNM);
#include <QANCollection_FuncMaps.hxx>
// Standard_EXPORT void TestList (QANCollection_List& theLi);
// Standard_EXPORT void TestStack (QANCollection_Stack& theSt);
// Standard_EXPORT void TestSet (QANCollection_Set& theSe);
// Standard_EXPORT void TestSequence(QANCollection_Sequence& theSq);
#include <QANCollection_FuncLists.hxx>

View File

@@ -17,7 +17,6 @@
#define QANCollection_PerfLists_HeaderFile
#include <QANCollection_ListOfPnt.hxx>
#include <QANCollection_StackOfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_SetOfInteger.hxx>
@@ -93,92 +92,6 @@ void CompList (const Standard_Integer theRep,
}
// ===================== Test perform of Stack type ==========================
void CompStack (const Standard_Integer theRep,
const Standard_Integer theSize)
{
Standard_Integer i,j;
////////////////////////////////Perf_Meter aNPush ("NCollection_Stack pushing",0);
////////////////////////////////Perf_Meter aTPush ("TCollection_Stack pushing",0);
////////////////////////////////Perf_Meter aNPopp ("NCollection_Stack popping",0);
////////////////////////////////Perf_Meter aTPopp ("TCollection_Stack popping",0);
////////////////////////////////Perf_Meter aNOper ("NCollection_Stack operator=",0);
////////////////////////////////Perf_Meter aTOper ("TCollection_Stack operator=",0);
////////////////////////////////Perf_Meter aNClea ("NCollection_Stack clearing",0);
////////////////////////////////Perf_Meter aTClea ("TCollection_Stack clearing",0);
////////////////////////////////Perf_Meter aNAssi ("NCollection_Stack Assign",0);
for (i=0; i<theRep; i++)
{
////////////////////////////////QANCollection_Stack a1, a2;
QANCollection_StackPerf a1, a2;
////////////////////////////////aNPush.Start();
PERF_START_METER("NCollection_Stack pushing")
for (j=1; j<=theSize; j++)
{
ItemType anItem;
Random(anItem);
a1.Push(anItem);
}
////////////////////////////////aNPush.Stop();
PERF_STOP_METER("NCollection_Stack pushing")
////////////////////////////////aNOper.Start();
PERF_START_METER("NCollection_Stack operator=")
a2 = a1;
////////////////////////////////aNOper.Stop();
PERF_STOP_METER("NCollection_Stack operator=")
////////////////////////////////aNAssi.Start();
PERF_START_METER("NCollection_Stack Assign")
a2.Assign(a1);
////////////////////////////////aNAssi.Stop();
PERF_STOP_METER("NCollection_Stack Assign")
////////////////////////////////aNPopp.Start();
PERF_START_METER("NCollection_Stack popping")
for (j=1; j<=theSize; j++)
a1.Pop();
////////////////////////////////aNPopp.Stop();
PERF_STOP_METER("NCollection_Stack popping")
////////////////////////////////aNClea.Start();
PERF_START_METER("NCollection_Stack clearing")
a2.Clear();
////////////////////////////////aNClea.Stop();
PERF_STOP_METER("NCollection_Stack clearing")
}
for (i=0; i<theRep; i++)
{
QANCollection_StackOfPnt a1, a2;
////////////////////////////////aTPush.Start();
PERF_START_METER("TCollection_Stack pushing")
for (j=1; j<=theSize; j++)
{
ItemType anItem;
Random(anItem);
a1.Push(anItem);
}
////////////////////////////////aTPush.Stop();
PERF_STOP_METER("TCollection_Stack pushing")
////////////////////////////////aTOper.Start();
PERF_START_METER("TCollection_Stack operator=")
a2 = a1;
////////////////////////////////aTOper.Stop();
PERF_STOP_METER("TCollection_Stack operator=")
////////////////////////////////aTPopp.Start();
PERF_START_METER("TCollection_Stack popping")
for (j=1; j<=theSize; j++)
a1.Pop();
////////////////////////////////aTPopp.Stop();
PERF_STOP_METER("TCollection_Stack popping")
////////////////////////////////aTClea.Start();
PERF_START_METER("TCollection_Stack clearing")
a2.Clear();
////////////////////////////////aTClea.Stop();
PERF_STOP_METER("TCollection_Stack clearing")
}
PERF_PRINT_ALL
}
// ===================== Test perform of Set type ==========================
void CompSet (const Standard_Integer theRep,
const Standard_Integer theSize)