/usr/include/opencascade/PCollection_HStack.gxx is in libopencascade-ocaf-lite-dev 6.5.0.dfsg-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #include <Standard_NoSuchObject.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_NoMoreObject.hxx>
// ------------
// constructor
// -----------
PCollection_HStack::PCollection_HStack()
{
TheDepth = 0;
TheTop = new PCollection_StackNode;
}
// ------------------------------------
// Push : insert an item on the top
// ------------------------------------
void PCollection_HStack::Push(const Item& T)
{
TheTop = TheTop->Construct(T);
TheDepth = TheDepth + 1;
}
// ------------------------------------
// Pop : remove an item from the top
// ------------------------------------
void PCollection_HStack::Pop()
{
if (TheTop->IsEmpty()) Standard_NoSuchObject::Raise();
Handle(PCollection_StackNode) temp = TheTop;
TheTop = TheTop->Tail();
temp.Delete();
TheDepth = TheDepth - 1;
}
// -----------------------------
// IsEmpty : is the stack empty ?
// -----------------------------
Standard_Boolean PCollection_HStack::IsEmpty() const
{
return TheTop->IsEmpty();
}
// ------------------------------------
// Clear : remove all items
// ------------------------------------
void PCollection_HStack::Clear()
{
Handle(PCollection_StackNode) temp;
while (TheDepth != 0) {
temp = TheTop;
TheTop = TheTop->Tail();
temp.Delete();
--TheDepth;
}
}
// ------------------------------------
// ChangeTop : replace the top by T
// ------------------------------------
void PCollection_HStack::ChangeTop(const Item& T)
{
if (TheTop->IsEmpty()) Standard_NoSuchObject::Raise();
TheTop->SetValue(T);
}
// -----------------------------
// Top : item on the Top
// -----------------------------
Item PCollection_HStack::Top() const
{
if (TheTop->IsEmpty()) Standard_NoSuchObject::Raise();
return TheTop->Value();
}
// ------------------------------------
// ShallowCopy redefinition
// ------------------------------------
Handle(Standard_Persistent) PCollection_HStack::ShallowCopy() const
{
PCollection_HStack* TheCopy = new PCollection_HStack (*this);
TheCopy->TheTop =
Handle(PCollection_StackNode)::DownCast(::ShallowCopy(TheTop));
return TheCopy;
}
// ------------------------------------
// ShallowDump redefinition
// ------------------------------------
void PCollection_HStack::ShallowDump(Standard_OStream& S) const
{
S << "begin class Stack "<< endl;
S << "Length of Stack : "<< TheDepth << endl;
TheTop->ShallowDump(S);
S << "end of class Stack." << endl;
}
// -----------------------------
// Depth : numbers of items
// -----------------------------
Standard_Integer PCollection_HStack::Depth() const {
return TheDepth;
}
// -----------------------------
// FTop : Top of the Stack
// -----------------------------
Handle(PCollection_StackNode) PCollection_HStack::FTop() const {
return TheTop;
}
|