This file is indexed.

/usr/include/opencascade/PCollection_HSequence.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
#include <Standard_NoSuchObject.hxx>
#include <Standard_OutOfRange.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_ProgramError.hxx>
#include <Standard_OStream.hxx>

// ----------------------------------------------------------------------
// Copyright: 	Matra-Datavision 1992
// File:	PCollection_HSequence.gxx
// Created:	Sep, 24 1992
// Author:      Mireille MERCIEN
// ----------------------------------------------------------------------

// -----------
// constructor :
// -----------
PCollection_HSequence::PCollection_HSequence()
{
   Size = 0;
   FirstItem.Nullify();
   LastItem.Nullify();
}

// ----------------------------------
// Clear : Clear the Current Sequence
// ----------------------------------
void PCollection_HSequence::Clear()
{
   Handle(PCollection_SeqNode) cell;
   Handle(PCollection_SeqNode) pnul;
   pnul.Nullify(); 
   if (Size != 0) {
      while (Size != 1) {
         cell = FirstItem;
         FirstItem = FirstItem->Next();
         FirstItem->SetPrevious(pnul);
#ifndef CSFDB
         cell.Delete();
#endif
         --Size;
      }
      FirstItem.Nullify();
#ifndef CSFDB
      LastItem.Delete();          // free memory
#endif
      Size = 0;
   } 
}

// -------------------------------------------------
// Append : Push an item  at the end of the sequence
// -------------------------------------------------
void PCollection_HSequence::Append(const Item& T)
{
   Handle(PCollection_SeqNode) newcell;
#ifndef OBJS
   newcell = new PCollection_SeqNode(LastItem,T);
#else
   newcell = new (os_segment::of(this)) PCollection_SeqNode(LastItem,T);
#endif
   if (Size == 0) FirstItem = newcell;   
   if (!LastItem.IsNull()) LastItem->SetNext(newcell);
   LastItem = newcell;   
   ++Size;                        
   
}

// ---------------------------------------------------
// Append : Push a sequence at the end of the sequence
// ---------------------------------------------------
void PCollection_HSequence::Append(const Handle(PCollection_HSequence)& S)
{
   for (Standard_Integer i = 1; i <= S->Length(); i++)
      Append (S->Value(i));
}

// ---------------------------------------------------------
// Prepend : Push an element at the begining of the sequence
// ---------------------------------------------------------
void PCollection_HSequence::Prepend(const Item& T)
{
   Handle(PCollection_SeqNode) newcell;
#ifndef OBJS
   newcell = new PCollection_SeqNode(T,FirstItem);
#else
   newcell = new (os_segment::of(this)) PCollection_SeqNode(T,FirstItem);
#endif
   if (Size == 0) LastItem = newcell;   
   if (!FirstItem.IsNull()) FirstItem->SetPrevious(newcell);
   FirstItem = newcell;
   ++Size;   
}

// ---------------------------------------------------------
// Prepend : Push a sequence at the begining of the sequence
// ---------------------------------------------------------
void PCollection_HSequence::Prepend(const Handle (PCollection_HSequence)& S)
{
   for (Standard_Integer i = S->Length(); i >= 1; i--)
      Prepend (S->Value(i));

}

// ---------------------------------------------------------
// Reverse : Reverse the order of a given sequence
// ---------------------------------------------------------
void PCollection_HSequence::Reverse()
{
   if (Size == 0 || Size == 1) return;
   Handle(PCollection_SeqNode) back,next,temp;
   temp = LastItem;
   while (!temp.IsNull())
   {
      back = temp->Previous();
      next = temp->Next();
      temp->SetNext(back);
      temp->SetPrevious(next);
      temp = temp->Next(); 
   }
   temp      = FirstItem;
   FirstItem = LastItem;
   LastItem  = temp;
}

// -------------------------------------------------------------------
// InsertBefore : Insert an item before a given index in the sequence
// --------------------------------------------------------------------
void PCollection_HSequence::InsertBefore(const Standard_Integer Index, 
                                       const Item& T)
{
   if ( Index <= 0 || Index > Length() ) Standard_OutOfRange::Raise();
   if ( Index == 1 )  { 
     Prepend (T);
     return; 
   }

//Index research
   Standard_Integer i = 1;
   Handle(PCollection_SeqNode) cell = FirstItem;
   while (i != Index)  {
     cell = cell->Next();             
     ++i;
   }

// Insertion before Index
   Handle(PCollection_SeqNode) previous = cell->Previous();
#ifndef OBJS
   Handle(PCollection_SeqNode) temp = new PCollection_SeqNode(previous,cell,T);
#else
   Handle(PCollection_SeqNode) temp = new (os_segment::of(this)) PCollection_SeqNode(previous,cell,T);
#endif
   previous->SetNext(temp);
   cell->SetPrevious(temp);
   ++Size;      
}

// ----------------------------------------------------------------------
// InsertBefore : Insert a sequence before a specific index in a sequence
// ----------------------------------------------------------------------
void PCollection_HSequence::InsertBefore(const Standard_Integer Index , 
                                       const Handle(PCollection_HSequence)& S)
{
   if ( Index <= 0 || Index > Size ) Standard_OutOfRange::Raise();
   for (Standard_Integer i = 1, j = Index ; i <= S->Length(); i++,j++)
       InsertBefore(j,S->Value(i));
}

// -----------------------------------------------------------------
// InsertAfter : Insert an element after a given index in a sequence
// -----------------------------------------------------------------
void PCollection_HSequence::InsertAfter(const Standard_Integer Index, 
                                      const Item& T)
{
   if ( Index <= 0 || Index > Length() ) Standard_OutOfRange::Raise();
   if ( Index == Size ) 
      Append (T);
   else 
      InsertBefore (Index+1,T);
}

// -------------------------------------------------------------------
// InsertAfter : Insert a sequence after a given index in the sequence
// -------------------------------------------------------------------
void PCollection_HSequence::InsertAfter(const Standard_Integer Index, 
                                      const Handle(PCollection_HSequence)&S)
{
   if ( Index <= 0 || Index > Length() ) Standard_OutOfRange::Raise();
   for (Standard_Integer i = 1, j = Index ; i <= S->Length(); i++,j++)
      InsertAfter (j,S->Value(i));
}

// ----------------------------------------
// Exchange : Exchange two elements in the sequence
// ----------------------------------------
void PCollection_HSequence::Exchange(const Standard_Integer I, 
                                   const Standard_Integer J)
{
   if ( I <= 0 || J <= 0 || I > Length() || J > Length() ) 
                                           Standard_OutOfRange::Raise();
   Item T = Value(J);
   SetValue(J,Value(I));
   SetValue(I,T);
}

// ----------------------------------------------------
// SubSequence : Returns a sub-sequence from a sequence
// ----------------------------------------------------
Handle(PCollection_HSequence) PCollection_HSequence::SubSequence
      (const Standard_Integer From,const Standard_Integer To) const 
{
   if ( From <= 0 || From > Length() || 
        To <= 0 || To > Length() || To < From ) Standard_OutOfRange::Raise();
#ifndef OBJS
   Handle (PCollection_HSequence) SubSeq = new PCollection_HSequence;
#else
   Handle (PCollection_HSequence) SubSeq = new (os_segment::of(this)) PCollection_HSequence;
#endif
   for(Standard_Integer i = From ; i <= To; i++)
	SubSeq->Append(Value(i));
   return SubSeq;
}

// ---------------------------------------------
// Split : Split a sequence in two sub-sequences
// ---------------------------------------------
Handle (PCollection_HSequence) 
            PCollection_HSequence::Split(const Standard_Integer Index)
{
   Standard_Integer i ;
   if ( Index <= 0 || Index > Length() ) Standard_OutOfRange::Raise();

// construct the new sequence
#ifndef OBJS
   Handle(PCollection_HSequence) Seq = new PCollection_HSequence;
#else
   Handle(PCollection_HSequence) Seq = new (os_segment::of(this)) PCollection_HSequence;
#endif
   for (i = Index ; i<= Size; i++)
	Seq->Append(Value(i));

// Update the old sequence
   if (Index == 1 ) {
     Clear();
     return Seq;
   }
// Index research
   i = 1;
   Handle(PCollection_SeqNode) cell = FirstItem;
   while (i != Index-1)  {
     cell = cell->Next();             
     ++i;
   }
// Re-build the Sequence     
   Handle(PCollection_SeqNode) pnul;
   pnul.Nullify(); 
   LastItem = cell;
   LastItem->SetNext(pnul);
   Size = Index - 1 ;
   return Seq;
}

// ----------------------------------------------------------
// SetValue : Change the element of a given index in a sequence
// ----------------------------------------------------------
void PCollection_HSequence::SetValue(const Standard_Integer Index, 
                                   const Item& T)
{
   if (Index <= 0 || Index > Length()) Standard_OutOfRange::Raise();

// Index research
   Standard_Integer i = 1;
   Handle(PCollection_SeqNode) cell = FirstItem;
   while (i != Index )  {
     cell = cell->Next();
     ++i;
   }
// Change the value of the node
   cell->SetValue(T);
}

// -----------------------------------------
// Value : Return the value of a given index
// -----------------------------------------
Item PCollection_HSequence::Value(const Standard_Integer Index) const 
{
   if (Index <= 0 || Index > Length()) Standard_OutOfRange::Raise();
// Index research
   Standard_Integer i = 1;
   Handle(PCollection_SeqNode) cell = FirstItem;
   while (i != Index )  {
     cell = cell->Next();
     ++i;
   }
// returns the value of the node
   return cell->Value();
}

// ----------------------------------------------------------------
// Contains : Returns True if the sequence contains a given element
// ----------------------------------------------------------------
//Standard_Boolean PCollection_HSequence::Contains(const Item& T) const 
Standard_Boolean PCollection_HSequence::Contains(const Item& ) const 
{
  Standard_ProgramError::Raise("PCollection_HSequence::Contains : Obsolete method...");
  return Standard_False;
}

// -------------------------------------------------------------
// Location : returns the index of the nth occurence of an item.
// -------------------------------------------------------------
//Standard_Integer PCollection_HSequence::Location(const Standard_Integer N,
//                                               const Item& T,
//                                               const Standard_Integer From, 
//                                               const Standard_Integer To) const
Standard_Integer PCollection_HSequence::Location(const Standard_Integer ,
                                               const Item& ,
                                               const Standard_Integer , 
                                               const Standard_Integer ) const
{
  Standard_ProgramError::Raise("PCollection_HSequence::Location : Obsolete method...");
  return 0;
}

// -------------------------------------------------------------
// Location : returns the index of the nth occurence of an item.
// -------------------------------------------------------------
//Standard_Integer PCollection_HSequence::
//              Location(const Standard_Integer N,const Item& T) const 
Standard_Integer PCollection_HSequence::
              Location(const Standard_Integer ,const Item& ) const 
{
  Standard_ProgramError::Raise("PCollection_HSequence::Location : Obsolete method...");
  return 0;
}

// -------------------------------------
// Remove : Remove an item in a sequence
// -------------------------------------
void PCollection_HSequence::Remove(const Standard_Integer Index)
{
   if (Index <= 0 || Index > Size ) Standard_OutOfRange::Raise();
   if (Size == 1)  { 
      Size = 0;
      FirstItem.Nullify();
#ifndef CSFDB
      LastItem.Delete();          // free memory
#endif
   } 
   else {
      Handle(PCollection_SeqNode) pnul,cell,previous,next;
      pnul.Nullify();
      if ( Index == 1 ) {                          // Remove the first Index
         cell = FirstItem;  
         FirstItem = FirstItem->Next();
         FirstItem->SetPrevious(pnul);
#ifndef CSFDB
         cell.Delete();                           // free memory
#endif
         --Size;
      } else if ( Index == Size ) {                // Remove the last Index
         cell = LastItem;
         LastItem = LastItem->Previous();
         LastItem->SetNext(pnul);
#ifndef CSFDB
         cell.Delete();                           // free memory
#endif
         --Size;
      } else {
        Standard_Integer i = 1;
        cell = FirstItem;
        while (i != Index)  {
           cell = cell->Next();             
           ++i;
        } 
        previous = cell->Previous();
        next = cell->Next();
        previous->SetNext(next);
        next->SetPrevious(previous);    
#ifndef CSFDB
        cell.Delete();                           // free memory
#endif
        --Size;
      }
   }
}

// ---------------------
// Remove a set of items
// --------------------- 
void PCollection_HSequence::Remove(const Standard_Integer From,const Standard_Integer To)
{
   if (From <= 0 || From > Size || To <= 0 || To > Size || From > To )
                                       Standard_OutOfRange::Raise(); 
   for (Standard_Integer i = From; i<= To; i++) Remove(From);
}

// ---------------------------------------------------
// First : Returns the first element of the sequence
//         Raises an exeption if the sequence is empty
// ----------------------------------------------------
Item PCollection_HSequence::First() const 
{
   if (Size == 0) Standard_NoSuchObject::Raise();
   return FirstItem->Value();
}

// ----------------------------------------------------
// Last : Returns the last element of the sequence
//         Raises an exeption if the sequence is empty
// ----------------------------------------------------
Item PCollection_HSequence::Last() const 
{
  if (Size == 0) Standard_NoSuchObject::Raise();
  return LastItem->Value();
}


// ----------------------------------------------------
// 
//                              ShallowCopy
// 
// ----------------------------------------------------
Handle(Standard_Persistent) PCollection_HSequence::ShallowCopy() const
{
   Handle (PCollection_HSequence)             TheCopy    ;
   Handle (PCollection_SeqNode)              TheList    ;

#ifndef OBJS
   TheCopy = new PCollection_HSequence;
#else
   TheCopy = new (os_segment::of(this)) PCollection_HSequence;
#endif
   TheList = FirstItem;
   for (Standard_Integer I = 1; I <= Size; I++) {
     TheCopy->Append(TheList->Value());
     TheList = TheList->Next();
   }

   return TheCopy;

}

// ----------------------------------------------------
// 
//                                ShallowDump 
// ----------------------------------------------------
void PCollection_HSequence::ShallowDump(Standard_OStream& S) const
{
   S << "begin class Sequence "<< endl;
   S << "Size          : "<< Size << "element(s)." << endl;
   Standard_Integer i = 1;
   Handle(PCollection_SeqNode) cell = FirstItem;
   while ( !cell.IsNull() ) {
    S << "Index          : "<< i << endl;
//    ::ShallowDump(cell->Value(),S);
    cell = cell->Next();
    ++i;
  }
  S << "end class Sequence" << endl;
}


// IsEmpty : Returns Standard_True if the sequence is empty (i.e. Size = 0)
Standard_Boolean PCollection_HSequence::IsEmpty() const 
{
  return (Size == 0);
}

// Length : Returns the length of the sequence
Standard_Integer PCollection_HSequence::Length() const 
{
  return Size;
}

// GetFirst : Returns the field "FirstItem"
Handle(PCollection_SeqNode) PCollection_HSequence::GetFirst() const 
{
  return FirstItem;
}

// GetLast : Returns the field "LastItem"
Handle(PCollection_SeqNode) PCollection_HSequence::GetLast() const 
{
  return LastItem;
}

void PCollection_HSequence::Destroy()
{
#ifdef CSFDB
  Clear();
#endif
}