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

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

View File

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