1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +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

@ -21,7 +21,7 @@ uses
StackOfDocument from CDM, StackOfDocument from CDM,
MapOfDocument from CDM, MapOfDocument from CDM,
MapIteratorOfMapOfDocument from CDM, MapIteratorOfMapOfDocument from CDM,
StackIteratorOfStackOfDocument from CDM, ListIteratorOfStackOfDocument from CDM,
MetaData from CDM, MetaData from CDM,
ExtendedString from TCollection, ExtendedString from TCollection,
StoreStatus from PCDM StoreStatus from PCDM

View File

@ -46,7 +46,7 @@ CDF_StoreList::CDF_StoreList(const Handle(CDM_Document)& aDocument) {
void CDF_StoreList::Add(const Handle(CDM_Document)& aDocument) { void CDF_StoreList::Add(const Handle(CDM_Document)& aDocument) {
if(!myItems.Contains(aDocument) && aDocument != myMainDocument) myItems.Add(aDocument); if(!myItems.Contains(aDocument) && aDocument != myMainDocument) myItems.Add(aDocument);
myStack.Push(aDocument); myStack.Prepend(aDocument);
CDM_ReferenceIterator it(aDocument); CDM_ReferenceIterator it(aDocument);
for (;it.More();it.Next()) { for (;it.More();it.Next()) {
@ -83,9 +83,9 @@ PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollect
{ {
try { try {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
for (; !myStack.IsEmpty(); myStack.Pop()) { for (; !myStack.IsEmpty(); myStack.RemoveFirst()) {
Handle(CDM_Document) theDocument = myStack.Top(); Handle(CDM_Document) theDocument = myStack.First();
if( theDocument == myMainDocument || theDocument->IsModified()) { if( theDocument == myMainDocument || theDocument->IsModified()) {
if(!PCDM::FindStorageDriver(theDocument)){ if(!PCDM::FindStorageDriver(theDocument)){

View File

@ -64,6 +64,6 @@ is
class DocumentHasher instantiates MapHasher from TCollection(Document from CDM); class DocumentHasher instantiates MapHasher from TCollection(Document from CDM);
class MapOfDocument instantiates Map from TCollection(Document from CDM, DocumentHasher from CDM); class MapOfDocument instantiates Map from TCollection(Document from CDM, DocumentHasher from CDM);
class ListOfDocument instantiates List from TCollection(Document from CDM); class ListOfDocument instantiates List from TCollection(Document from CDM);
class StackOfDocument instantiates Stack from TCollection(Document from CDM); class StackOfDocument instantiates List from TCollection(Document from CDM);
end CDM; end CDM;

View File

@ -49,7 +49,7 @@ is
---Purpose: Encapsulates a Transaction from TDF. ---Purpose: Encapsulates a Transaction from TDF.
class TransactionStack class TransactionStack
instantiates Stack from TCollection (Transaction from DDF); instantiates List from TCollection (Transaction from DDF);
-- ---------------------------------------------------------------------- -- ----------------------------------------------------------------------
-- Package methods -- Package methods

View File

@ -58,7 +58,7 @@ static Standard_Integer OpenTran (Draw_Interpretor& di,
if (DDF::GetDF (a[1], DF)) { if (DDF::GetDF (a[1], DF)) {
Handle(DDF_Transaction) tr = new DDF_Transaction(DF); Handle(DDF_Transaction) tr = new DDF_Transaction(DF);
di<<"Open transaction # "<<tr->Open()<<" # "<<DF->Transaction()<<"\n"; di<<"Open transaction # "<<tr->Open()<<" # "<<DF->Transaction()<<"\n";
DDF_TStack.Push(tr); DDF_TStack.Prepend(tr);
} }
return 0; return 0;
} }
@ -78,10 +78,10 @@ static Standard_Integer AbortTran (Draw_Interpretor& di,
Handle(TDF_Data) DF; Handle(TDF_Data) DF;
if (DDF::GetDF (a[1], DF)) { if (DDF::GetDF (a[1], DF)) {
if (DF->Transaction () > 0) { if (DF->Transaction () > 0) {
Handle(DDF_Transaction) tr = DDF_TStack.Top(); Handle(DDF_Transaction) tr = DDF_TStack.First();
di<<"Abort transaction # "<<tr->Transaction()<<" # "<<DF->Transaction()<<"\n"; di<<"Abort transaction # "<<tr->Transaction()<<" # "<<DF->Transaction()<<"\n";
tr->Abort(); tr->Abort();
DDF_TStack.Pop(); DDF_TStack.RemoveFirst();
} }
else { else {
di<<"DDF_BasicCommands::AbortTran - No more transaction to abort"<<"\n"; di<<"DDF_BasicCommands::AbortTran - No more transaction to abort"<<"\n";
@ -105,12 +105,12 @@ static Standard_Integer CommitTran (Draw_Interpretor& di,
Handle(TDF_Data) DF; Handle(TDF_Data) DF;
if (DDF::GetDF (a[1], DF)) { if (DDF::GetDF (a[1], DF)) {
if (DF->Transaction () > 0) { if (DF->Transaction () > 0) {
Handle(DDF_Transaction) tr = DDF_TStack.Top(); Handle(DDF_Transaction) tr = DDF_TStack.First();
di<<"Commit transaction # "<<tr->Transaction()<<" # "<<DF->Transaction()<<"\n"; di<<"Commit transaction # "<<tr->Transaction()<<" # "<<DF->Transaction()<<"\n";
Standard_Boolean withDelta = Standard_False; Standard_Boolean withDelta = Standard_False;
if (n > 2) withDelta = (Draw::Atoi(a[2]) != 0); if (n > 2) withDelta = (Draw::Atoi(a[2]) != 0);
DDF_LastDelta = tr->Commit(withDelta); DDF_LastDelta = tr->Commit(withDelta);
DDF_TStack.Pop(); DDF_TStack.RemoveFirst();
} }
else { else {
di<<"DDF_BasicCommands::CommitTran - No more transaction to commit"<<"\n"; di<<"DDF_BasicCommands::CommitTran - No more transaction to commit"<<"\n";
@ -135,8 +135,8 @@ static Standard_Integer CurrentTran (Draw_Interpretor& di,
if (DDF::GetDF (a[1], DF)) { if (DDF::GetDF (a[1], DF)) {
di<<"# "<<DF->Transaction()<<"\n"; di<<"# "<<DF->Transaction()<<"\n";
if (!DDF_TStack.IsEmpty()) if (!DDF_TStack.IsEmpty())
if (DF->Transaction() != DDF_TStack.Top()->Transaction()) if (DF->Transaction() != DDF_TStack.First()->Transaction())
di<<"Transaction object said # "<<DDF_TStack.Top()->Transaction()<<"\n"; di<<"Transaction object said # "<<DDF_TStack.First()->Transaction()<<"\n";
} }
return 0; return 0;

View File

@ -43,17 +43,17 @@ is
exception SyntaxError inherits Failure from Standard; exception SyntaxError inherits Failure from Standard;
private class StackOfGeneralExpression instantiates private class StackOfGeneralExpression instantiates
Stack from TCollection (GeneralExpression from Expr); List from TCollection (GeneralExpression from Expr);
private class StackOfGeneralRelation instantiates private class StackOfGeneralRelation instantiates
Stack from TCollection (GeneralRelation from Expr); List from TCollection (GeneralRelation from Expr);
private class StackOfGeneralFunction instantiates private class StackOfGeneralFunction instantiates
Stack from TCollection (GeneralFunction from Expr); List from TCollection (GeneralFunction from Expr);
private class StackOfNames instantiates private class StackOfNames instantiates
Stack from TCollection (AsciiString from TCollection); List from TCollection (AsciiString from TCollection);
Parse(gen : Generator; str : AsciiString from TCollection) Parse(gen : Generator; str : AsciiString from TCollection)
returns Boolean returns Boolean

View File

@ -25,7 +25,7 @@ uses Generator from ExprIntrp,
StackOfGeneralExpression from ExprIntrp, StackOfGeneralExpression from ExprIntrp,
StackOfGeneralRelation from ExprIntrp, StackOfGeneralRelation from ExprIntrp,
StackOfGeneralFunction from ExprIntrp, StackOfGeneralFunction from ExprIntrp,
StackOfInteger from TColStd, ListOfInteger from TColStd,
SequenceOfGeneralExpression from Expr, SequenceOfGeneralExpression from Expr,
SequenceOfNamedFunction from ExprIntrp, SequenceOfNamedFunction from ExprIntrp,
SequenceOfNamedExpression from ExprIntrp, SequenceOfNamedExpression from ExprIntrp,
@ -108,7 +108,7 @@ fields
myGRStack : StackOfGeneralRelation; myGRStack : StackOfGeneralRelation;
myGFStack : StackOfGeneralFunction; myGFStack : StackOfGeneralFunction;
myNameStack : StackOfNames; myNameStack : StackOfNames;
myValueStack : StackOfInteger; myValueStack : ListOfInteger;
myFunctions : SequenceOfNamedFunction; myFunctions : SequenceOfNamedFunction;
myNamed : SequenceOfNamedExpression; myNamed : SequenceOfNamedExpression;
myMaster : Generator; myMaster : Generator;

View File

@ -24,35 +24,35 @@ ExprIntrp_Analysis::ExprIntrp_Analysis() {}
void ExprIntrp_Analysis::Push(const Handle(Expr_GeneralExpression)& exp) void ExprIntrp_Analysis::Push(const Handle(Expr_GeneralExpression)& exp)
{ {
myGEStack.Push(exp); myGEStack.Prepend(exp);
} }
void ExprIntrp_Analysis::PushRelation(const Handle(Expr_GeneralRelation)& rel) void ExprIntrp_Analysis::PushRelation(const Handle(Expr_GeneralRelation)& rel)
{ {
myGRStack.Push(rel); myGRStack.Prepend(rel);
} }
void ExprIntrp_Analysis::PushFunction(const Handle(Expr_GeneralFunction)& func) void ExprIntrp_Analysis::PushFunction(const Handle(Expr_GeneralFunction)& func)
{ {
myGFStack.Push(func); myGFStack.Prepend(func);
} }
void ExprIntrp_Analysis::PushName(const TCollection_AsciiString& name) void ExprIntrp_Analysis::PushName(const TCollection_AsciiString& name)
{ {
myNameStack.Push(name); myNameStack.Prepend(name);
} }
void ExprIntrp_Analysis::PushValue(const Standard_Integer val) void ExprIntrp_Analysis::PushValue(const Standard_Integer val)
{ {
myValueStack.Push(val); myValueStack.Prepend(val);
} }
Handle(Expr_GeneralExpression) ExprIntrp_Analysis::Pop() Handle(Expr_GeneralExpression) ExprIntrp_Analysis::Pop()
{ {
Handle(Expr_GeneralExpression) res; Handle(Expr_GeneralExpression) res;
if (!myGEStack.IsEmpty()) { if (!myGEStack.IsEmpty()) {
res = myGEStack.Top(); res = myGEStack.First();
myGEStack.Pop(); myGEStack.RemoveFirst();
} }
return res; return res;
} }
@ -61,8 +61,8 @@ Handle(Expr_GeneralRelation) ExprIntrp_Analysis::PopRelation()
{ {
Handle(Expr_GeneralRelation) res; Handle(Expr_GeneralRelation) res;
if (!myGRStack.IsEmpty()) { if (!myGRStack.IsEmpty()) {
res = myGRStack.Top(); res = myGRStack.First();
myGRStack.Pop(); myGRStack.RemoveFirst();
} }
return res; return res;
} }
@ -71,8 +71,8 @@ Handle(Expr_GeneralFunction) ExprIntrp_Analysis::PopFunction()
{ {
Handle(Expr_GeneralFunction) res; Handle(Expr_GeneralFunction) res;
if (!myGFStack.IsEmpty()) { if (!myGFStack.IsEmpty()) {
res = myGFStack.Top(); res = myGFStack.First();
myGFStack.Pop(); myGFStack.RemoveFirst();
} }
return res; return res;
} }
@ -81,8 +81,8 @@ TCollection_AsciiString ExprIntrp_Analysis::PopName()
{ {
TCollection_AsciiString res; TCollection_AsciiString res;
if (!myNameStack.IsEmpty()) { if (!myNameStack.IsEmpty()) {
res = myNameStack.Top(); res = myNameStack.First();
myNameStack.Pop(); myNameStack.RemoveFirst();
} }
return res; return res;
} }
@ -91,8 +91,8 @@ Standard_Integer ExprIntrp_Analysis::PopValue()
{ {
Standard_Integer res =0; Standard_Integer res =0;
if (!myValueStack.IsEmpty()) { if (!myValueStack.IsEmpty()) {
res = myValueStack.Top(); res = myValueStack.First();
myValueStack.Pop(); myValueStack.RemoveFirst();
} }
return res; return res;
} }

View File

@ -16,7 +16,7 @@
#include <Standard_NoMoreObject.hxx> #include <Standard_NoMoreObject.hxx>
#include <Standard_NoSuchObject.hxx> #include <Standard_NoSuchObject.hxx>
#include <TColStd_StackOfInteger.hxx> #include <TColStd_ListOfInteger.hxx>
//======================================================================= //=======================================================================
//function : GraphTools_DFSIterator //function : GraphTools_DFSIterator
@ -36,18 +36,18 @@ void GraphTools_DFSIterator::Perform
{ {
Standard_Integer index; Standard_Integer index;
myVisited.Clear(); myVisited.Clear();
TColStd_StackOfInteger myReady; TColStd_ListOfInteger myReady;
index = myVisited.Add(V); index = myVisited.Add(V);
myReady.Push(index); myReady.Prepend(index);
while (!myReady.IsEmpty()) { while (!myReady.IsEmpty()) {
Vertex w1 = myVisited (myReady.Top()); Vertex w1 = myVisited (myReady.First());
myReady.Pop(); myReady.RemoveFirst();
for (VIterator it(G,w1); it.More(); it.Next()) { for (VIterator it(G,w1); it.More(); it.Next()) {
Vertex w2 = it.Value(); Vertex w2 = it.Value();
if (!myVisited.Contains(w2)) { if (!myVisited.Contains(w2)) {
index = myVisited.Add(w2); index = myVisited.Add(w2);
myReady.Push(index); myReady.Prepend(index);
} }
} }
} }

View File

@ -69,7 +69,7 @@ generic class ReducedGraph from GraphTools
uses SC from GraphTools, uses SC from GraphTools,
SCList from GraphTools, SCList from GraphTools,
ListIteratorOfSCList from GraphTools, ListIteratorOfSCList from GraphTools,
StackOfInteger from TColStd ListOfInteger from TColStd
raises NoSuchObject from Standard, raises NoSuchObject from Standard,
NoMoreObject from Standard, NoMoreObject from Standard,
@ -233,7 +233,7 @@ fields
-- algorithm -- algorithm
performed : Boolean from Standard; performed : Boolean from Standard;
myNowIndex : Integer from Standard; myNowIndex : Integer from Standard;
myStack : StackOfInteger from TColStd; myStack : ListOfInteger from TColStd;
-- result -- result
mySort : SCList from GraphTools; mySort : SCList from GraphTools;

View File

@ -220,7 +220,7 @@ Standard_Integer GraphTools_ReducedGraph::Visit
myNowIndex++; myNowIndex++;
myVertices(k).SetVisited(myNowIndex); myVertices(k).SetVisited(myNowIndex);
MIN = myNowIndex; MIN = myNowIndex;
myStack.Push(k); myStack.Prepend(k);
Standard_Integer currentVisited; Standard_Integer currentVisited;
currentVisited = myVertices(k).GetVisited(); currentVisited = myVertices(k).GetVisited();
Standard_Integer adjacentIndex; Standard_Integer adjacentIndex;
@ -242,11 +242,11 @@ Standard_Integer GraphTools_ReducedGraph::Visit
Handle(GraphTools_SC) SC = new GraphTools_SC(); Handle(GraphTools_SC) SC = new GraphTools_SC();
Standard_Boolean more; Standard_Boolean more;
do { do {
SC->AddVertex(myStack.Top()); SC->AddVertex(myStack.First());
myVertices(myStack.Top()).SetVisited(IntegerLast()); myVertices(myStack.First()).SetVisited(IntegerLast());
myVertices(myStack.Top()).SetSC(SC); myVertices(myStack.First()).SetSC(SC);
more = myStack.Top() != k; more = myStack.First() != k;
myStack.Pop() ; myStack.RemoveFirst() ;
} }
while (more); while (more);
mySort.Prepend(SC); mySort.Prepend(SC);

View File

@ -33,7 +33,7 @@ generic class SortedStrgCmptsFromIterator from GraphTools
-- returned before an other which point to it. -- returned before an other which point to it.
uses StackOfInteger from TColStd, uses ListOfInteger from TColStd,
ListOfSequenceOfInteger from GraphTools, ListOfSequenceOfInteger from GraphTools,
ListIteratorOfListOfSequenceOfInteger from GraphTools ListIteratorOfListOfSequenceOfInteger from GraphTools
@ -105,7 +105,7 @@ fields
myVertices : SCMap from GraphTools; myVertices : SCMap from GraphTools;
-- algorithm -- algorithm
myNowIndex : Integer from Standard; myNowIndex : Integer from Standard;
myStack : StackOfInteger from TColStd; myStack : ListOfInteger from TColStd;
-- result -- result
mySort : ListOfSequenceOfInteger from GraphTools; mySort : ListOfSequenceOfInteger from GraphTools;
myIterator : ListIteratorOfListOfSequenceOfInteger from GraphTools; myIterator : ListIteratorOfListOfSequenceOfInteger from GraphTools;

View File

@ -143,7 +143,7 @@ Standard_Integer GraphTools_SortedStrgCmptsFromIterator::Visit
myNowIndex++; myNowIndex++;
myVertices(k) = myNowIndex; myVertices(k) = myNowIndex;
MIN = myNowIndex; MIN = myNowIndex;
myStack.Push(k); myStack.Prepend(k);
Standard_Integer currentVisited; Standard_Integer currentVisited;
currentVisited = myVertices.FindFromIndex (k); currentVisited = myVertices.FindFromIndex (k);
Standard_Integer adjacentIndex; Standard_Integer adjacentIndex;
@ -165,10 +165,10 @@ Standard_Integer GraphTools_SortedStrgCmptsFromIterator::Visit
TColStd_SequenceOfInteger& newSC = mySort.First(); TColStd_SequenceOfInteger& newSC = mySort.First();
Standard_Boolean more; Standard_Boolean more;
do { do {
newSC.Append(myStack.Top()); newSC.Append(myStack.First());
myVertices(myStack.Top()) = IntegerLast(); myVertices(myStack.First()) = IntegerLast();
more = myStack.Top() != k; more = myStack.First() != k;
myStack.Pop() ; myStack.RemoveFirst() ;
} }
while (more); while (more);
} }

View File

@ -27,7 +27,6 @@ NCollection_Array1.hxx
NCollection_HArray1.hxx NCollection_HArray1.hxx
NCollection_Array2.hxx NCollection_Array2.hxx
NCollection_HArray2.hxx NCollection_HArray2.hxx
NCollection_Stack.hxx
NCollection_List.hxx NCollection_List.hxx
NCollection_Set.hxx NCollection_Set.hxx
NCollection_HSet.hxx NCollection_HSet.hxx
@ -54,7 +53,6 @@ NCollection_DefineSequence.hxx
NCollection_DefineHSequence.hxx NCollection_DefineHSequence.hxx
NCollection_DefineSet.hxx NCollection_DefineSet.hxx
NCollection_DefineHSet.hxx NCollection_DefineHSet.hxx
NCollection_DefineStack.hxx
NCollection_BaseVector.hxx NCollection_BaseVector.hxx
NCollection_BaseVector.cxx NCollection_BaseVector.cxx

View File

@ -1,35 +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_Stack.hxx by GAWK
// Purpose: A stack is a structure where item can be added and
// removed from the top. Like a stack of plates in a
// kitchen. The last entered item will be be the
// first removed. This is called a LIFO (last In First Out).
// Inherits BaseList, adding the data item to each node.
#ifndef NCollection_DefineStack_HeaderFile
#define NCollection_DefineStack_HeaderFile
#include <NCollection_DefineBaseCollection.hxx>
#include <NCollection_Stack.hxx>
// **************************************** Template for Stack class ********
#define DEFINE_STACK(_ClassName_, _BaseCollection_, TheItemType) \
typedef NCollection_Stack<TheItemType > _ClassName_;
#endif

View File

@ -1,142 +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_Stack_HeaderFile
#define NCollection_Stack_HeaderFile
#include <NCollection_BaseCollection.hxx>
#include <NCollection_BaseList.hxx>
#include <NCollection_TListNode.hxx>
#include <NCollection_TListIterator.hxx>
#if !defined No_Exception && !defined No_Standard_NoSuchObject
#include <Standard_NoSuchObject.hxx>
#endif
/**
* Purpose: A stack is a structure where item can be added and
* removed from the top. Like a stack of plates in a
* kitchen. The last entered item will be be the
* first removed. This is called a LIFO (last In First Out).
* Inherits BaseList, adding the data item to each node.
*/
template <class TheItemType> class NCollection_Stack
: public NCollection_BaseCollection<TheItemType>,
public NCollection_BaseList
{
public:
typedef NCollection_TListNode<TheItemType> StackNode;
typedef NCollection_TListIterator<TheItemType> Iterator;
public:
// ---------- PUBLIC METHODS ------------
//! Constructor
NCollection_Stack(const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
NCollection_BaseCollection<TheItemType>(theAllocator),
NCollection_BaseList() {}
//! Copy constructor
NCollection_Stack (const NCollection_Stack& theOther) :
NCollection_BaseCollection<TheItemType>(theOther.myAllocator),
NCollection_BaseList()
{ *this = theOther; }
//! Size - Number of items
virtual Standard_Integer Size (void) const
{ return Extent(); }
//! Depth - Number of items
Standard_Integer Depth (void) const
{ return Extent(); }
//! 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();
for (; anIter.More(); anIter.Next())
{
StackNode* pNew = new (this->myAllocator) StackNode(anIter.Value());
PAppend(pNew);
}
}
//! Replace this list by the items of theOther Stack
NCollection_Stack& operator= (const NCollection_Stack& theOther)
{
if (this == &theOther)
return *this;
Clear ();
StackNode * pCur = (StackNode *) theOther.PFirst();
while (pCur)
{
StackNode* pNew = new (this->myAllocator) StackNode(pCur->Value());
PAppend(pNew);
pCur = (StackNode *) pCur->Next();
}
return *this;
}
//! Clear this stack
void Clear (void)
{ PClear (StackNode::delNode, this->myAllocator); }
//! Top item - constant
const TheItemType& Top (void) const
{
#if !defined No_Exception && !defined No_Standard_NoSuchObject
if (IsEmpty()) Standard_NoSuchObject::Raise ("NCollection_Stack::Top");
#endif
return ((StackNode *) PFirst())->Value();
}
//! Top item - variable
TheItemType& ChangeTop (void)
{
#if !defined No_Exception && !defined No_Standard_NoSuchObject
if (IsEmpty()) Standard_NoSuchObject::Raise("NCollection_Stack::ChangeTop");
#endif
return ((StackNode *) PFirst())->ChangeValue();
}
//! Push one item
void Push (const TheItemType& theItem)
{
StackNode * pNew = new (this->myAllocator) StackNode(theItem);
PPrepend(pNew);
}
//! Pop top item
void Pop (void)
{ PRemoveFirst (StackNode::delNode, this->myAllocator); }
//! Destructor - clears the List
~NCollection_Stack (void)
{ Clear(); }
private:
// ----------- PRIVATE METHODS -----------
//! Creates Iterator for use on BaseCollection
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator&
CreateIterator(void) const
{ return *(new (this->IterAllocator()) Iterator(*this)); }
};
#endif

View File

@ -34,7 +34,7 @@ is
-- --
-- utilities and internal Classes -- utilities and internal Classes
class StackOfPlate instantiates Stack from TCollection class StackOfPlate instantiates List from TCollection
(Plate from Plate); (Plate from Plate);
class SequenceOfHGPPConstraint instantiates Sequence from TCollection class SequenceOfHGPPConstraint instantiates Sequence from TCollection
(HGPPConstraint); (HGPPConstraint);

View File

@ -27,7 +27,7 @@
#include <Plate_PinpointConstraint.hxx> #include <Plate_PinpointConstraint.hxx>
#include <Plate_FreeGtoCConstraint.hxx> #include <Plate_FreeGtoCConstraint.hxx>
#include <NLPlate_StackIteratorOfStackOfPlate.hxx> #include <NLPlate_ListIteratorOfStackOfPlate.hxx>
#include <NLPlate_NLPlate.ixx> #include <NLPlate_NLPlate.ixx>
@ -73,7 +73,7 @@ NLPlate_NLPlate::NLPlate_NLPlate(const Handle(Geom_Surface)& InitialSurface) :
if(ordre<maxOrder+2) ordre = maxOrder+2; if(ordre<maxOrder+2) ordre = maxOrder+2;
if(Iterate(0,ord)) if(Iterate(0,ord))
{ {
mySOP.ChangeTop().SetPolynomialPartOnly(Standard_True); mySOP.First().SetPolynomialPartOnly(Standard_True);
ConstraintsSliding(); ConstraintsSliding();
} }
@ -152,7 +152,7 @@ NLPlate_NLPlate::NLPlate_NLPlate(const Handle(Geom_Surface)& InitialSurface) :
else else
Value = myInitialSurface->DN(point2d.X(),point2d.Y(),iu,iv).XYZ(); Value = myInitialSurface->DN(point2d.X(),point2d.Y(),iu,iv).XYZ();
for(NLPlate_StackIteratorOfStackOfPlate SI(mySOP);SI.More();SI.Next()) for(NLPlate_ListIteratorOfStackOfPlate SI(mySOP);SI.More();SI.Next())
{ {
if(SI.Value().IsDone()) if(SI.Value().IsDone())
Value += SI.Value().EvaluateDerivative(point2d,iu,iv); Value += SI.Value().EvaluateDerivative(point2d,iu,iv);
@ -168,7 +168,7 @@ NLPlate_NLPlate::NLPlate_NLPlate(const Handle(Geom_Surface)& InitialSurface) :
{ {
if(!(myInitialSurface->IsCNu(cont+1)&&myInitialSurface->IsCNv(cont+1)))break; if(!(myInitialSurface->IsCNu(cont+1)&&myInitialSurface->IsCNv(cont+1)))break;
} }
for(NLPlate_StackIteratorOfStackOfPlate SI(mySOP);SI.More();SI.Next()) for(NLPlate_ListIteratorOfStackOfPlate SI(mySOP);SI.More();SI.Next())
{ {
if((SI.Value().IsDone())&&(cont > SI.Value().Continuity())) cont = SI.Value().Continuity(); if((SI.Value().IsDone())&&(cont > SI.Value().Continuity())) cont = SI.Value().Continuity();
} }
@ -181,8 +181,8 @@ const Standard_Integer ResolutionOrder,
const Standard_Real IncrementalLoading) const Standard_Real IncrementalLoading)
{ {
Plate_Plate EmptyPlate; Plate_Plate EmptyPlate;
mySOP.Push(EmptyPlate); mySOP.Prepend(EmptyPlate);
Plate_Plate &TopP = mySOP.ChangeTop(); Plate_Plate &TopP = mySOP.First();
for(Standard_Integer index =1; index <= myHGPPConstraints.Length(); index++) for(Standard_Integer index =1; index <= myHGPPConstraints.Length(); index++)
{ {
const Handle(NLPlate_HGPPConstraint) &HGPP = myHGPPConstraints(index); const Handle(NLPlate_HGPPConstraint) &HGPP = myHGPPConstraints(index);
@ -265,7 +265,7 @@ const Standard_Real IncrementalLoading)
TopP.SolveTI(ResolutionOrder); TopP.SolveTI(ResolutionOrder);
if(!TopP.IsDone()) if(!TopP.IsDone())
{ {
mySOP.Pop(); mySOP.RemoveFirst();
return Standard_False; return Standard_False;
} }
else else

View File

@ -43,7 +43,7 @@ Standard_Size OpenGl_StateInterface::Index() const
// ======================================================================= // =======================================================================
void OpenGl_StateInterface::Update() void OpenGl_StateInterface::Update()
{ {
myStateStack.Push (myIndex); myStateStack.Prepend (myIndex);
myIndex = myNextIndex; myIndex = myNextIndex;
++myNextIndex; ++myNextIndex;
} }
@ -56,8 +56,8 @@ void OpenGl_StateInterface::Revert()
{ {
if (!myStateStack.IsEmpty()) if (!myStateStack.IsEmpty())
{ {
myIndex = myStateStack.Top(); myIndex = myStateStack.First();
myStateStack.Pop(); myStateStack.RemoveFirst();
} }
else else
{ {

View File

@ -21,7 +21,7 @@
#include <OpenGl_Element.hxx> #include <OpenGl_Element.hxx>
#include <OpenGl_Light.hxx> #include <OpenGl_Light.hxx>
#include <NCollection_Stack.hxx> #include <NCollection_List.hxx>
//! Defines interface for OpenGL state. //! Defines interface for OpenGL state.
class OpenGl_StateInterface class OpenGl_StateInterface
@ -44,7 +44,7 @@ protected:
Standard_Size myIndex; //!< Current state index Standard_Size myIndex; //!< Current state index
Standard_Size myNextIndex; //!< Next state index Standard_Size myNextIndex; //!< Next state index
NCollection_Stack<Standard_Size> myStateStack; //!< Stack of previous states. NCollection_List<Standard_Size> myStateStack; //!< Stack of previous states.
}; };

View File

@ -22,7 +22,6 @@
#include <V3d_View.hxx> #include <V3d_View.hxx>
#include <ViewerTest.hxx> #include <ViewerTest.hxx>
#include <ViewerTest_EventManager.hxx> #include <ViewerTest_EventManager.hxx>
#include <TColStd_StackOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx> #include <TColStd_ListOfInteger.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx> #include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_HSequenceOfReal.hxx> #include <TColStd_HSequenceOfReal.hxx>

View File

@ -23,7 +23,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 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

@ -207,21 +207,6 @@ static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer ar
return 0; 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 //function : QANColTestSet
//purpose : //purpose :
@ -264,7 +249,6 @@ void QANCollection::Commands2(Draw_Interpretor& theCommands) {
theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group); theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group);
theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group); theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group);
theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group); theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
theCommands.Add("QANColTestStack", "QANColTestStack", __FILE__, QANColTestStack, group);
theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group); theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group);
theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, 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; 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 //function : QANColPerfSet
//purpose : //purpose :
@ -230,7 +216,6 @@ void QANCollection::Commands3(Draw_Interpretor& theCommands) {
theCommands.Add("QANColPerfArray1", "QANColPerfArray1 Repeat Size", __FILE__, QANColPerfArray1, group); theCommands.Add("QANColPerfArray1", "QANColPerfArray1 Repeat Size", __FILE__, QANColPerfArray1, group);
theCommands.Add("QANColPerfArray2", "QANColPerfArray2 Repeat Size", __FILE__, QANColPerfArray2, group); theCommands.Add("QANColPerfArray2", "QANColPerfArray2 Repeat Size", __FILE__, QANColPerfArray2, group);
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("QANColPerfSet", "QANColPerfSet Repeat Size", __FILE__, QANColPerfSet, group); theCommands.Add("QANColPerfSet", "QANColPerfSet Repeat Size", __FILE__, QANColPerfSet, 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);

View File

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

View File

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

View File

@ -70,40 +70,6 @@ void TestList (QANCollection_ListFunc& theL)
aL.Clear(); 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 ============================= // ===================== Test methods of Set type =============================
////////////////////////////////void TestSet (QANCollection_Set& theS) ////////////////////////////////void TestSet (QANCollection_Set& theS)
void TestSet (QANCollection_SetFunc& theS) void TestSet (QANCollection_SetFunc& theS)

View File

@ -34,7 +34,6 @@
// Standard_EXPORT void TestInDaMap (QANCollection_IDMap& theNM); // Standard_EXPORT void TestInDaMap (QANCollection_IDMap& theNM);
#include <QANCollection_FuncMaps.hxx> #include <QANCollection_FuncMaps.hxx>
// Standard_EXPORT void TestList (QANCollection_List& theLi); // Standard_EXPORT void TestList (QANCollection_List& theLi);
// Standard_EXPORT void TestStack (QANCollection_Stack& theSt);
// Standard_EXPORT void TestSet (QANCollection_Set& theSe); // Standard_EXPORT void TestSet (QANCollection_Set& theSe);
// 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_StackOfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx> #include <TColgp_SequenceOfPnt.hxx>
#include <TColStd_SetOfInteger.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 ========================== // ===================== Test perform of Set type ==========================
void CompSet (const Standard_Integer theRep, void CompSet (const Standard_Integer theRep,
const Standard_Integer theSize) const Standard_Integer theSize)

View File

@ -171,14 +171,6 @@ class ListOfReal instantiates List from TCollection(Real );
class ListOfTransient instantiates List from TCollection(Transient); class ListOfTransient instantiates List from TCollection(Transient);
class ListOfAsciiString instantiates List from TCollection(AsciiString from TCollection); class ListOfAsciiString instantiates List from TCollection(AsciiString from TCollection);
--
-- Instantiations Stack (Integer,Real,Transient)
-- *********************************************
--
class StackOfInteger instantiates Stack from TCollection(Integer );
class StackOfReal instantiates Stack from TCollection(Real );
class StackOfTransient instantiates Stack from TCollection(Transient);
-- --
-- Instantiations MapHasher (Integer,Real, Transient, Persistent) -- Instantiations MapHasher (Integer,Real, Transient, Persistent)
-- ************************************************************** -- **************************************************************

View File

@ -23,7 +23,6 @@
-- - Sequence, HSequence -- - Sequence, HSequence
-- - Set, HSet -- - Set, HSet
-- - List -- - List
-- - Stack
-- - BasicMap, BasicMapIterator -- - BasicMap, BasicMapIterator
-- - Map, DataMap, DoubleMap, IndexedMap, IndexedDataMap -- - Map, DataMap, DoubleMap, IndexedMap, IndexedDataMap
@ -52,9 +51,6 @@ is
generic class HArray2; generic class HArray2;
generic class Stack, StackNode, StackIterator;
---Purpose: A stack handled by value.
generic class List, ListNode, ListIterator; generic class List, ListNode, ListIterator;
---Purpose: A single list handled by value. ---Purpose: A single list handled by value.

View File

@ -1,244 +0,0 @@
-- Created on: 1993-01-18
-- 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.
-- Updated: M. MERCIEN 26, Oct 1994
-- Subject: StackIterator implementation
generic class Stack from TCollection (Item as any)
---Purpose: A stack is a structure where item can be added and
-- removed from the top. Like a stack of plates in a
-- kitchen. The last entered item will be be the
-- first removed. This is called a LIFO (last In First Out).
-- Stack is a generic class which depends on Item, the type
-- of element in the structure.
-- Use a StackIterator iterator to explore a Stack structure.
-- Note: An iterator class is automatically instantiated from
-- the TCollection_StackIterator class at the time of
-- instantiation of a Stack structure.
raises
NoSuchObject from Standard
class StackNode from TCollection
inherits MapNode from TCollection
uses MapNodePtr from TCollection
is
Create(I : Item; n : MapNodePtr from TCollection) returns StackNode from TCollection;
---C++: inline
Value(me) returns Item;
---C++: return &
---C++: inline
fields
myValue : Item;
end;
class StackIterator from TCollection
---Purpose: Functions used for iterating the contents of a Stack data structure.
-- Note: an iterator class is automatically instantiated from
-- this generic class at the time of instantiation of a Stack structure.
raises NoSuchObject from Standard
is
Create returns StackIterator from TCollection;
---Purpose: Constructs an empty iterator for a Stack data structure.
-- Use the function Initialize to define the stack to explore.
Create(S : Stack from TCollection) returns StackIterator from TCollection;
---Purpose: Constructs an iterator on the stack stack, and positions it
-- on the first item of the stack stack, if it exists.
-- The current position is undefined if the stack stack is empty.
-- Use in a loop:
-- - the function More to know if there is a current item,
-- - then the function Value to read the value of the current item,
-- - then the function Next to position the iterator on the
-- next item, if it exists.
Initialize(me : in out; S : Stack from TCollection)
---Purpose: Sets, or resets this iterator for the stack stack, and
-- positions it on the first item of the stack stack, if it exists.
-- The current position is undefined if the stack stack is empty.
-- Example
-- TColStd_StackOfInteger stack;
-- TColStd_StackIteratorOfStackOfInteger
-- pos;
-- pos.Initialize(stack);
-- Use in a loop:
-- - the function More to know if there is a current item,
-- - then the function Value to read the value of the current item,
-- - then the function Next to position the iterator on the
-- next item, if it exists.
is static;
More(me) returns Boolean from Standard
---Purpose:Returns true if there is a current item in the stack explored
-- with this iterator (i.e. when the current position is defined).
-- More is false if:
-- - the iterator is not initialized, or
-- - the stack is empty, or
-- - the exploration is finished.
-- Use:
-- - the function Value to read the current item,
-- - the function Next to position this iterator on the next item, if it exists.
---C++: inline
is static;
Next(me: in out)
---Purpose: Sets the iterator to the next item in the explored stack.
-- If the current position of this iterator corresponds to the
-- top of the stack, it becomes undefined.
is static;
Value(me) returns any Item
raises NoSuchObject from Standard
---Purpose: Returns the value of the current item of this iterator in the explored stack.
-- Note: Item is the type of element in the explored Stack stack.
-- Example
-- TColStd_StackOfInteger stack;
-- TColStd_StackIteratorOfStackOfInteger
-- pos(stack);
-- stack.Push(1);
-- assert ( pos.Value() == 1 );
-- Exceptions
-- Standard_NoSuchObject if the current position of this
-- iterator is undefined.
---C++: return const &
is static;
fields
current : Address from Standard;
end StackIterator from TCollection;
is
Create returns Stack from TCollection;
---Purpose: Constructs an empty stack.
-- Use:
-- - the function Push to add an item at the top of the stack,
-- - the function Top to read the item at the top of the stack,
-- - the function ChangeTop to assign a new value to the
-- item at the top of the stack,
-- - the function Pop to remove the item at the top of the stack,
-- - and a stack iterator to explore the stack and read all its items.
-- Warning
-- To copy a stack, you must explicitly call the assignment
-- operator (operator=)..
Create(Other : Stack from TCollection)
returns Stack from TCollection
is private;
---Purpose: Creates by copying an existing Stack.
-- Warning: Prints a message when other is not empty. It is
-- recommanded to use Assign (operator =).
Assign(me : in out; Other : Stack from TCollection)
returns Stack from TCollection
---Purpose: Copies in this stack the content of <Other>.
--If this stack is not empty, it is automatically cleared before copying.
-- Note that this method is an alias of the assignment
-- operator operator =.
---C++: alias operator =
---C++: return const &
is static;
IsEmpty(me) returns Boolean
---Purpose: Returns True when the stack is empty.
-- i.e. Depth() == 0
---C++: inline
is static;
Depth(me) returns Integer
---Level: Public
---Purpose: Returns the number of Items in the stack.
-- The depth of this stack is:
-- - incremented by Push, and
-- - decremented by Pop.
-- Example:
-- me = (A B C)
-- returns 3
---C++: inline
is static;
Top(me) returns any Item
---Level: Public
---Purpose: Returns the Item at the top of the stack.
-- Example:
-- before
-- me = (A B C)
-- after
-- me = (A B C)
-- returns
-- A
-- Trigger: Raises an exception when <me> is empty
---C++: return const &
raises NoSuchObject from Standard
is static;
Push(me : in out; I : Item)
---Level: Public
---Purpose: Adds <I> at the top of the stack. Depth is
-- incremented.
-- Example:
-- before
-- me = (A B C) I = D
-- after
-- me = (D A B C)
is static;
Pop(me : in out)
---Level: Public
---Purpose: Removes the Item at the top of the stack. Depth is
-- decremented.
-- Example:
-- before
-- me = (A B C)
-- after
-- me = (B C)
-- Trigger: Raises an exception when <me> is empty
raises NoSuchObject from Standard
is static;
Clear(me : in out)
---Level: Public
---Purpose: Removes all the items from the stack.
---C++: alias ~
is static;
ChangeTop(me : in out) returns any Item
---Level: Public
---Purpose: Returns a modifiable reference of the top of the stack.
-- Example:
-- before
-- me = (A B C)
-- me.ChangeTop() = D
-- after
-- me = (D B C)
-- Trigger: Raises an exception when <me> is empty
raises NoSuchObject from Standard
---C++: return &
is static;
fields
myTop : Address from Standard;
myDepth : Integer from Standard;
friends
class StackIterator from TCollection
end Stack;

View File

@ -1,164 +0,0 @@
// Created on: 1993-01-18
// Created by: Remi LEQUETTE
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_NoSuchObject.hxx>
//=======================================================================
//function : TCollection_Stack
//purpose :
//=======================================================================
TCollection_Stack::TCollection_Stack() :
myTop(NULL),
myDepth(0)
{
}
//=======================================================================
//function : TCollection_Stack
//purpose :
//=======================================================================
TCollection_Stack::TCollection_Stack(const TCollection_Stack& Other)
{
if (!Other.IsEmpty()) {
cout << "WARNING copy constructor of non empty stack !"<<endl;
}
TCollection_StackNode* p = (TCollection_StackNode*) Other.myTop;
TCollection_StackNode* q;
TCollection_StackNode* r = NULL;
myTop = NULL;
while (p) {
q = new TCollection_StackNode(p->Value(),(TCollection_MapNode*)0L);
if (r) r->Next() = q;
else myTop = q;
r = q;
p = (TCollection_StackNode*)p->Next();
}
myDepth = Other.myDepth;
}
//=======================================================================
//function : Assign
//purpose :
//=======================================================================
const TCollection_Stack& TCollection_Stack::Assign
(const TCollection_Stack& Other)
{
if (this == &Other) return *this;
Clear();
TCollection_StackNode* p = (TCollection_StackNode*) Other.myTop;
TCollection_StackNode* q;
TCollection_StackNode* r = NULL;
while (p) {
q = new TCollection_StackNode(p->Value(),(TCollection_MapNode*)0L);
if (r) r->Next() = q;
else myTop = q;
r = q;
p = (TCollection_StackNode*)p->Next();
}
myDepth = Other.myDepth;
return *this;
}
//=======================================================================
//function : Top
//purpose :
//=======================================================================
const Item& TCollection_Stack::Top() const
{
Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_Stack");
return ((TCollection_StackNode*)myTop)->Value();
}
//=======================================================================
//function : Push
//purpose :
//=======================================================================
void TCollection_Stack::Push(const Item& I)
{
myTop = new TCollection_StackNode(I,(TCollection_StackNode*)myTop);
myDepth++;
}
//=======================================================================
//function : Pop
//purpose :
//=======================================================================
void TCollection_Stack::Pop()
{
Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_Stack");
TCollection_StackNode* p = (TCollection_StackNode*) myTop;
myTop = p->Next();
delete p;
myDepth--;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void TCollection_Stack::Clear()
{
TCollection_StackNode* p = (TCollection_StackNode*) myTop;
TCollection_StackNode* q;
while(p) {
q = (TCollection_StackNode*)p->Next();
delete p;
p = q;
}
myDepth = 0;
myTop = NULL;
}
//=======================================================================
//function : ChangeTop
//purpose :
//=======================================================================
Item& TCollection_Stack::ChangeTop()
{
Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_Stack");
return ((TCollection_StackNode*)myTop)->Value();
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
void TCollection_StackIterator::Next()
{
current = ((TCollection_StackNode*)current)->Next();
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
const Item& TCollection_StackIterator::Value() const
{
Standard_NoSuchObject_Raise_if(current == NULL,
"TCollection_StackIterator");
return ((TCollection_StackNode*)current)->Value();
}

View File

@ -1,36 +0,0 @@
// Created on: 1993-01-18
// 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 : IsEmpty
//purpose :
//=======================================================================
inline Standard_Boolean TCollection_Stack::IsEmpty() const
{
return myDepth == 0;
}
//=======================================================================
//function : Depth
//purpose :
//=======================================================================
inline Standard_Integer TCollection_Stack::Depth() const
{
return myDepth;
}

View File

@ -1,50 +0,0 @@
// Created on: 1994-10-26
// Created by: Mireille MERCIEN
// Copyright (c) 1994-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_Stack.gxx
//=======================================================================
//function : TCollection_StackIterator
//purpose :
//=======================================================================
TCollection_StackIterator::TCollection_StackIterator() : current(NULL)
{}
//=======================================================================
//function : TCollection_StackIterator
//purpose :
//=======================================================================
TCollection_StackIterator::TCollection_StackIterator(const TCollection_Stack& L) :
current(L.myTop)
{}
//=======================================================================
//function : Initialize
//purpose :
//=======================================================================
void TCollection_StackIterator::Initialize(const TCollection_Stack& L)
{
current = L.myTop;
}

View File

@ -1,26 +0,0 @@
// Created on: 1994-10-26
// Created by: Mireille MERCIEN
// Copyright (c) 1994-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_StackIterator::More() const
{
return current != 0L;
}

View File

@ -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.

View File

@ -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_StackNode::TCollection_StackNode(const Item& I,const TCollection_MapNodePtr& n)
: TCollection_MapNode(n)
{
myValue = I;
}
inline Item& TCollection_StackNode::Value() const
{
return (Item&)myValue;
}

View File

@ -41,7 +41,7 @@ uses
LabelNodePtr from TDF, LabelNodePtr from TDF,
Delta from TDF, Delta from TDF,
IDFilter from TDF, IDFilter from TDF,
StackOfInteger from TColStd, ListOfInteger from TColStd,
HAllocator from TDF HAllocator from TDF
raises raises
@ -226,7 +226,7 @@ fields
myNbTouchedAtt : Integer from Standard; myNbTouchedAtt : Integer from Standard;
myNotUndoMode : Boolean from Standard; myNotUndoMode : Boolean from Standard;
myTime : Integer from Standard; myTime : Integer from Standard;
myTimes : StackOfInteger from TColStd; myTimes : ListOfInteger from TColStd;
myLabelNodeAllocator: HAllocator from TDF; myLabelNodeAllocator: HAllocator from TDF;
myAllowModification : Boolean from Standard; myAllowModification : Boolean from Standard;

View File

@ -118,7 +118,7 @@ void TDF_Data::Destroy()
Standard_Integer TDF_Data::OpenTransaction() Standard_Integer TDF_Data::OpenTransaction()
{ {
myTimes.Push(myTime); myTimes.Prepend(myTime);
return ++myTransaction; return ++myTransaction;
} }
@ -148,7 +148,7 @@ Handle(TDF_Delta) TDF_Data::CommitTransaction
--myTransaction; --myTransaction;
if (withDelta) { if (withDelta) {
if (!delta->IsEmpty()) { if (!delta->IsEmpty()) {
delta->Validity(myTimes.Top(),myTime); delta->Validity(myTimes.First(),myTime);
#ifdef DEB_DELTA #ifdef DEB_DELTA
if (myTransaction == 0) { if (myTransaction == 0) {
cout<<"TDF_Data::Commit generated this delta in t=0:"<<endl; cout<<"TDF_Data::Commit generated this delta in t=0:"<<endl;
@ -163,7 +163,7 @@ Handle(TDF_Delta) TDF_Data::CommitTransaction
} }
#endif #endif
} }
myTimes.Pop(); myTimes.RemoveFirst();
} }
TDF_Data_DebugModified("COMMIT"); TDF_Data_DebugModified("COMMIT");
return delta; return delta;

View File

@ -38,9 +38,6 @@ uses
is is
private class StackOfIterator instantiates
Stack from TCollection (Iterator from TopoDS);
pointer Stack to Iterator from TopoDS; pointer Stack to Iterator from TopoDS;
class Explorer; class Explorer;