This file is indexed.

/usr/include/opencascade/PCollection_HDirectedGraph.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
// Copyright: 	Matra-Datavision 1991
// File:	PCollection_HDirectedGraph.gxx
// Created:	Wed May 29 17:06:01 1991
// Author:	Denis PASCAL
//		<dp>
// Revised:     Mireille MERCIEN


#include <Standard_NoSuchObject.hxx>
#include <Standard_NoMoreObject.hxx>

//----------------------------------------------------------------------
PCollection_HDirectedGraph::PCollection_HDirectedGraph () 
{
  MyVertices = new PCollection_SetOfVertex;
  MyEdges = new PCollection_SetOfEdge;
}

//--------------------------------------------------------------------
Integer PCollection_HDirectedGraph::NumberOfVertices () const 
{
  return MyVertices->Extent();
}


//--------------------------------------------------------------------
Integer PCollection_HDirectedGraph::NumberOfEdges () const 
{
  return MyEdges->Extent();
} 

//--------------------------------------------------------------------
Integer PCollection_HDirectedGraph::NumberOfLeaves () const 
{
  Integer nb = 0;
  PCollection_SetIteratorOfSetOfVertex It (MyVertices);
  while (It.More()) {
    Handle(PCollection_Vertex) V = It.Value();
    if (V->IsLeaf()) nb++;
    It.Next();
  }
  return nb;
}


//--------------------------------------------------------------------
Integer PCollection_HDirectedGraph::NumberOfRoots () const 
{
  Integer nb = 0;
  PCollection_SetIteratorOfSetOfVertex It(MyVertices);
  while (It.More()) {
    Handle(PCollection_Vertex) V = It.Value();
    if (V->IsRoot()) nb++;
    It.Next();
  }
  return nb;
}


//--------------------------------------------------------------------
Boolean PCollection_HDirectedGraph::IsEmpty () const 
{
  return (MyVertices->Extent() == 0);
}


//--------------------------------------------------------------------
void PCollection_HDirectedGraph::Clear ()  
{
  MyVertices = new PCollection_SetOfVertex;
  MyEdges = new PCollection_SetOfEdge;
}


//--------------------------------------------------------------------
Boolean PCollection_HDirectedGraph::IsMember 
                              (const Handle(PCollection_Vertex)& V) const 
{
  return MyVertices->Contains(V);
}


//--------------------------------------------------------------------
Boolean PCollection_HDirectedGraph::IsMember 
                              (const Handle(PCollection_Edge)& E) const 
{
  return MyEdges->Contains(E);
}


//--------------------------------------------------------------------
Handle(PCollection_Vertex) PCollection_HDirectedGraph::Add 
                              (const Item& val) 
{
  Handle(PCollection_Vertex) V = new PCollection_Vertex (val,this);
  MyVertices->Add(V);
  return V;
}


//--------------------------------------------------------------------
void PCollection_HDirectedGraph::Remove (const Handle(PCollection_Vertex)& V) 
{
  if (IsMember(V)) {
     PCollection_BackEdgesIterator ItBack(V);
     while (ItBack.More()) {
        Handle(PCollection_Edge) BE = ItBack.Value();
        if (BE->Source() != V) BE->Source()->RemoveFrontEdge(BE);
        MyEdges->Remove(BE);
        ItBack.Next();
     }
     PCollection_FrontEdgesIterator ItFront(V);
     while (ItFront.More()) {
       Handle(PCollection_Edge) FE = ItFront.Value();
       if (FE->Destination() != V) FE->Destination()->RemoveBackEdge(FE);
       if (MyEdges->Contains(FE)) MyEdges->Remove(FE);
       ItFront.Next();
     }
     MyVertices->Remove(V);
//   V->Nullify();  // test Handle nul sur Vertex retire
   }
   else  {
    NoSuchObject::Raise();
   }
}


//--------------------------------------------------------------------
Handle(PCollection_Edge) PCollection_HDirectedGraph::Add 
                    (const Handle(PCollection_Vertex)& source,
                     const Handle(PCollection_Vertex)& destination,
                     const Attribute& A) 
{
  if (IsMember(source) && IsMember(destination)) {
    Handle(PCollection_Edge) E = new PCollection_Edge (source,destination,A);
    source->AddFrontEdge (E);
    destination->AddBackEdge(E);
    MyEdges->Add (E);
    return E;
  }
  else {
    NoSuchObject::Raise();
  }
}

//--------------------------------------------------------------------
void PCollection_HDirectedGraph::Remove (const Handle(PCollection_Edge)& E) 
{
  if (IsMember(E)) {
    (E->Source())->RemoveFrontEdge(E);
    (E->Destination())->RemoveBackEdge(E);
    MyEdges->Remove(E);
//    E->Nullify();  // test Handle nul sur Edge retire
  }
  else {
    NoSuchObject::Raise();
  }
}


//--------------------------------------------------------------------
Handle(PCollection_SetOfVertex) PCollection_HDirectedGraph::GetVertices() const 
{
  return MyVertices;
}


//--------------------------------------------------------------------
Handle(PCollection_SetOfEdge) PCollection_HDirectedGraph::GetEdges() const 
{
  return MyEdges;
}