/usr/include/opencascade/TCollection_Queue.gxx is in libopencascade-foundation-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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | // File: TCollection_Queue.gxx
// Created: Mon Jan 18 14:55:37 1993
// Author: Remi LEQUETTE
// <rle@phylox>
#include <Standard_NoSuchObject.hxx>
//=======================================================================
//function : TCollection_Queue
//purpose :
//=======================================================================
TCollection_Queue::TCollection_Queue() :
myFront(NULL),
myEnd(NULL),
myLength(0)
{
}
//=======================================================================
//function : TCollection_Queue
//purpose :
//=======================================================================
TCollection_Queue::TCollection_Queue(const TCollection_Queue& Other)
{
if (!Other.IsEmpty()) {
cout << "WARNING copy constructor of non empty Queue !"<<endl;
}
TCollection_QueueNode* p = (TCollection_QueueNode*) Other.myFront;
TCollection_QueueNode* q = NULL;
TCollection_QueueNode* r = NULL;
myFront = NULL;
while (p) {
q = new TCollection_QueueNode(p->Value(),(TCollection_MapNode*)0L);
if (r) r->Next() = q;
else myFront = q;
r = q;
p = (TCollection_QueueNode*)p->Next();
}
myEnd = q;
myLength = Other.myLength;
}
//=======================================================================
//function : Assign
//purpose :
//=======================================================================
const TCollection_Queue& TCollection_Queue::Assign
(const TCollection_Queue& Other)
{
if (this == &Other) return *this;
Clear();
TCollection_QueueNode* p = (TCollection_QueueNode*) Other.myFront;
TCollection_QueueNode* q=NULL;
TCollection_QueueNode* r = NULL;
while (p) {
q = new TCollection_QueueNode(p->Value(),(TCollection_MapNode*)0L);
if (r) r->Next() = q;
else myFront = q;
r = q;
p = (TCollection_QueueNode*)p->Next();
}
myEnd = q;
myLength = Other.myLength;
return *this;
}
//=======================================================================
//function : Front
//purpose :
//=======================================================================
const Item& TCollection_Queue::Front() const
{
Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_Queue");
return ((TCollection_QueueNode*)myFront)->Value();
}
//=======================================================================
//function : Push
//purpose :
//=======================================================================
void TCollection_Queue::Push(const Item& I)
{
TCollection_QueueNode* p = new TCollection_QueueNode(I,(TCollection_MapNode*)0L);
if (myLength) ((TCollection_QueueNode*)myEnd)->Next() = p;
else myFront = p;
myEnd = p;
myLength++;
}
//=======================================================================
//function : Pop
//purpose :
//=======================================================================
void TCollection_Queue::Pop()
{
Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_Queue");
TCollection_QueueNode* p = (TCollection_QueueNode*) myFront;
myFront = p->Next();
delete p;
myLength--;
if (myLength == 0) myEnd = NULL;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void TCollection_Queue::Clear()
{
TCollection_QueueNode* p = (TCollection_QueueNode*) myFront;
TCollection_QueueNode* q = 0L;
while(p) {
q = (TCollection_QueueNode*)p->Next();
delete p;
p = q;
}
myLength = 0;
myFront = myEnd = NULL;
}
//=======================================================================
//function : ChangeFront
//purpose :
//=======================================================================
Item& TCollection_Queue::ChangeFront()
{
Standard_NoSuchObject_Raise_if(IsEmpty(),"TCollection_Queue");
return ((TCollection_QueueNode*)myFront)->Value();
}
|