mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0024742: Remove rarely used collection classes: Queue
Generic "TCollection_Queue" class removed (along with "TCollection_QueueNode" and three instantiations in TColStd). Template class TCollection_Queue removed. The code using queue classes converted to use lists for the same purpose (replacing Push -> Append, Front -> First, Pop -> RemoveFirst). In OpenGl_Context, list is used as stack instead of queue, for it looks more natural for release of resources (last allocated - first released).
This commit is contained in:
@@ -23,7 +23,6 @@ uses
|
||||
|
||||
is
|
||||
class ListOfPnt instantiates List from TCollection (Pnt from gp);
|
||||
class QueueOfPnt instantiates Queue 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
|
||||
|
@@ -207,21 +207,6 @@ static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer ar
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : QANColTestQueue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer QANColTestQueue(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
||||
{
|
||||
if ( argc != 1) {
|
||||
di << "Usage : " << argv[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
QANCollection_QueueFunc aQueue;
|
||||
TestQueue(aQueue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : QANColTestStack
|
||||
//purpose :
|
||||
@@ -294,7 +279,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("QANColTestQueue", "QANColTestQueue", __FILE__, QANColTestQueue, group);
|
||||
theCommands.Add("QANColTestStack", "QANColTestStack", __FILE__, QANColTestStack, group);
|
||||
theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group);
|
||||
theCommands.Add("QANColTestSList", "QANColTestSList", __FILE__, QANColTestSList, group);
|
||||
|
@@ -97,20 +97,6 @@ static Standard_Integer QANColPerfList(Draw_Interpretor& di, Standard_Integer ar
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : QANColPerfQueue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer QANColPerfQueue(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
||||
{
|
||||
Standard_Integer Repeat, Size;
|
||||
if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
|
||||
return 1;
|
||||
}
|
||||
CompQueue(Repeat,Size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : QANColPerfStack
|
||||
//purpose :
|
||||
@@ -258,7 +244,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("QANColPerfQueue", "QANColPerfQueue Repeat Size", __FILE__, QANColPerfQueue, group);
|
||||
theCommands.Add("QANColPerfStack", "QANColPerfStack Repeat Size", __FILE__, QANColPerfStack, group);
|
||||
theCommands.Add("QANColPerfSet", "QANColPerfSet Repeat Size", __FILE__, QANColPerfSet, group);
|
||||
theCommands.Add("QANColPerfSList", "QANColPerfSList Repeat Size", __FILE__, QANColPerfSList, group);
|
||||
|
@@ -67,17 +67,14 @@ DEFINE_INDEXEDMAP(QANCollection_IndexedMapFunc,QANCollection_Key1BaseColFunc,Key
|
||||
DEFINE_INDEXEDDATAMAP(QANCollection_IDMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
|
||||
|
||||
#include <NCollection_DefineList.hxx>
|
||||
#include <NCollection_DefineQueue.hxx>
|
||||
#include <NCollection_DefineStack.hxx>
|
||||
#include <NCollection_DefineSet.hxx>
|
||||
#include <NCollection_DefineHSet.hxx>
|
||||
////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
|
||||
////////////////////////////////DEFINE_QUEUE(QANCollection_Queue,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_QUEUE(QANCollection_QueueFunc,QANCollection_BaseColFunc,ItemType)
|
||||
DEFINE_STACK(QANCollection_StackFunc,QANCollection_BaseColFunc,ItemType)
|
||||
DEFINE_SET(QANCollection_SetFunc,QANCollection_Key2BaseColFunc,Key2Type)
|
||||
DEFINE_HSET(QANCollection_HSetFunc,QANCollection_SetFunc)
|
||||
|
@@ -67,17 +67,14 @@ DEFINE_INDEXEDMAP(QANCollection_IndexedMapPerf,QANCollection_Key1BaseColPerf,Key
|
||||
DEFINE_INDEXEDDATAMAP(QANCollection_IDMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType)
|
||||
|
||||
#include <NCollection_DefineList.hxx>
|
||||
#include <NCollection_DefineQueue.hxx>
|
||||
#include <NCollection_DefineStack.hxx>
|
||||
#include <NCollection_DefineSet.hxx>
|
||||
#include <NCollection_DefineHSet.hxx>
|
||||
////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
|
||||
////////////////////////////////DEFINE_QUEUE(QANCollection_Queue,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_QUEUE(QANCollection_QueuePerf,QANCollection_BaseColPerf,ItemType)
|
||||
DEFINE_STACK(QANCollection_StackPerf,QANCollection_BaseColPerf,ItemType)
|
||||
DEFINE_SET(QANCollection_SetPerf,QANCollection_Key2BaseColPerf,Key2Type)
|
||||
DEFINE_HSET(QANCollection_HSetPerf,QANCollection_SetPerf)
|
||||
|
@@ -70,40 +70,6 @@ void TestList (QANCollection_ListFunc& theL)
|
||||
aL.Clear();
|
||||
}
|
||||
|
||||
// ===================== Test methods of Queue type ===========================
|
||||
////////////////////////////////void TestQueue (QANCollection_Queue& theQ)
|
||||
void TestQueue (QANCollection_QueueFunc& theQ)
|
||||
{
|
||||
// Length
|
||||
Standard_Integer iLen=theQ.Length();
|
||||
Standard_Integer i;
|
||||
|
||||
printf ("Info: testing Queue(%d)\n", iLen);
|
||||
// Push, Pop, Front, ChangeFront
|
||||
ItemType anItem;
|
||||
////////////////////////////////QANCollection_Queue aQ;
|
||||
QANCollection_QueueFunc aQ;
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
Random (anItem);
|
||||
aQ.Push (anItem);
|
||||
Random(aQ.ChangeFront());
|
||||
Random (anItem);
|
||||
aQ.Push (anItem);
|
||||
PrintItem(aQ.Front());
|
||||
aQ.Pop();
|
||||
}
|
||||
// Copy constructor + operator=
|
||||
////////////////////////////////theQ = QANCollection_Queue(aQ);
|
||||
theQ = QANCollection_QueueFunc(aQ);
|
||||
|
||||
// Assign
|
||||
AssignCollection (theQ, aQ);
|
||||
|
||||
// Clear
|
||||
aQ.Clear();
|
||||
}
|
||||
|
||||
// ===================== Test methods of Stack type ===========================
|
||||
////////////////////////////////void TestStack (QANCollection_Stack& theS)
|
||||
void TestStack (QANCollection_StackFunc& theS)
|
||||
|
@@ -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 TestQueue (QANCollection_Queue& theQ);
|
||||
// Standard_EXPORT void TestStack (QANCollection_Stack& theSt);
|
||||
// Standard_EXPORT void TestSet (QANCollection_Set& theSe);
|
||||
// Standard_EXPORT void TestSList (QANCollection_SList& theSL);
|
||||
|
@@ -18,7 +18,6 @@
|
||||
|
||||
#include <QANCollection_ListOfPnt.hxx>
|
||||
#include <QANCollection_SListOfPnt.hxx>
|
||||
#include <QANCollection_QueueOfPnt.hxx>
|
||||
#include <QANCollection_StackOfPnt.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <TColStd_SetOfInteger.hxx>
|
||||
@@ -94,90 +93,6 @@ void CompList (const Standard_Integer theRep,
|
||||
PERF_PRINT_ALL
|
||||
}
|
||||
|
||||
// ===================== Test perform of Queue type ==========================
|
||||
void CompQueue (const Standard_Integer theRep,
|
||||
const Standard_Integer theSize)
|
||||
{
|
||||
Standard_Integer i,j;
|
||||
|
||||
////////////////////////////////Perf_Meter aNPush ("NCollection_Queue pushing",0);
|
||||
////////////////////////////////Perf_Meter aTPush ("TCollection_Queue pushing",0);
|
||||
////////////////////////////////Perf_Meter aNPopp ("NCollection_Queue popping",0);
|
||||
////////////////////////////////Perf_Meter aTPopp ("TCollection_Queue popping",0);
|
||||
////////////////////////////////Perf_Meter aNOper ("NCollection_Queue operator=",0);
|
||||
////////////////////////////////Perf_Meter aTOper ("TCollection_Queue operator=",0);
|
||||
////////////////////////////////Perf_Meter aNClea ("NCollection_Queue clearing",0);
|
||||
////////////////////////////////Perf_Meter aTClea ("TCollection_Queue clearing",0);
|
||||
////////////////////////////////Perf_Meter aNAssi ("NCollection_Queue Assign",0);
|
||||
for (i=0; i<theRep; i++)
|
||||
{
|
||||
////////////////////////////////QANCollection_Queue a1, a2;
|
||||
QANCollection_QueuePerf a1, a2;
|
||||
////////////////////////////////aNPush.Start();
|
||||
PERF_START_METER("NCollection_Queue pushing")
|
||||
for (j=1; j<=theSize; j++)
|
||||
{
|
||||
ItemType anItem;
|
||||
Random(anItem);
|
||||
a1.Push(anItem);
|
||||
}
|
||||
////////////////////////////////aNPush.Stop();
|
||||
PERF_STOP_METER("NCollection_Queue pushing")
|
||||
////////////////////////////////aNOper.Start();
|
||||
PERF_START_METER("NCollection_Queue operator=")
|
||||
a2 = a1;
|
||||
////////////////////////////////aNOper.Stop();
|
||||
PERF_STOP_METER("NCollection_Queue operator=")
|
||||
////////////////////////////////aNAssi.Start();
|
||||
PERF_START_METER("NCollection_Queue Assign")
|
||||
a2.Assign(a1);
|
||||
////////////////////////////////aNAssi.Stop();
|
||||
PERF_STOP_METER("NCollection_Queue Assign")
|
||||
////////////////////////////////aNPopp.Start();
|
||||
PERF_START_METER("NCollection_Queue popping")
|
||||
for (j=1; j<=theSize; j++)
|
||||
a1.Pop();
|
||||
////////////////////////////////aNPopp.Stop();
|
||||
PERF_STOP_METER("NCollection_Queue popping")
|
||||
////////////////////////////////aNClea.Start();
|
||||
PERF_START_METER("NCollection_Queue clearing")
|
||||
a2.Clear();
|
||||
////////////////////////////////aNClea.Stop();
|
||||
PERF_STOP_METER("NCollection_Queue clearing")
|
||||
}
|
||||
|
||||
for (i=0; i<theRep; i++)
|
||||
{
|
||||
QANCollection_QueueOfPnt a1, a2;
|
||||
////////////////////////////////aTPush.Start();
|
||||
PERF_START_METER("TCollection_Queue pushing")
|
||||
for (j=1; j<=theSize; j++)
|
||||
{
|
||||
ItemType anItem;
|
||||
Random(anItem);
|
||||
a1.Push(anItem);
|
||||
}
|
||||
////////////////////////////////aTPush.Stop();
|
||||
PERF_STOP_METER("TCollection_Queue pushing")
|
||||
////////////////////////////////aTOper.Start();
|
||||
PERF_START_METER("TCollection_Queue operator=")
|
||||
a2 = a1;
|
||||
////////////////////////////////aTOper.Stop();
|
||||
PERF_STOP_METER("TCollection_Queue operator=")
|
||||
////////////////////////////////aTPopp.Start();
|
||||
PERF_START_METER("TCollection_Queue popping")
|
||||
for (j=1; j<=theSize; j++)
|
||||
a1.Pop();
|
||||
////////////////////////////////aTPopp.Stop();
|
||||
PERF_STOP_METER("TCollection_Queue popping")
|
||||
////////////////////////////////aTClea.Start();
|
||||
PERF_START_METER("TCollection_Queue clearing")
|
||||
a2.Clear();
|
||||
////////////////////////////////aTClea.Stop();
|
||||
PERF_STOP_METER("TCollection_Queue clearing")
|
||||
}
|
||||
PERF_PRINT_ALL
|
||||
}
|
||||
|
||||
// ===================== Test perform of Stack type ==========================
|
||||
void CompStack (const Standard_Integer theRep,
|
||||
|
Reference in New Issue
Block a user