0024509: Suspect unused variable in TPrsStd_ConstraintTools.cxx
[occt.git] / src / GraphDS / GraphDS_Vertex.gxx
1 // Created on: 1993-03-16
2 // Created by: Denis PASCAL
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <Standard_NoSuchObject.hxx>
18 #include <Standard_NoMoreObject.hxx>
19 #include <Standard_DomainError.hxx>
20 #include <Standard_NotImplemented.hxx>
21
22
23 //=======================================================================
24 //function : GraphDS_Vertex
25 //purpose  : 
26 //=======================================================================
27
28 GraphDS_Vertex::GraphDS_Vertex (const GraphDS_Item& value) : myItem(value)
29 {
30 }
31
32
33 //=======================================================================
34 //function : GetItem
35 //purpose  : 
36 //=======================================================================
37
38 const GraphDS_Item& GraphDS_Vertex::GetItem () const 
39 {
40   return myItem;
41 }
42
43
44 //=======================================================================
45 //function : SetItem
46 //purpose  : 
47 //=======================================================================
48
49 void GraphDS_Vertex::SetItem (const GraphDS_Item& Value) 
50 {
51   myItem = Value;
52 }
53
54 //=======================================================================
55 //function : Contains
56 //purpose  : 
57 //=======================================================================
58
59 Standard_Boolean GraphDS_Vertex::Contains (const Handle(GraphDS_Edge)& E) const 
60 {
61   return myEdges.Contains(E);
62 }
63
64
65 Standard_Boolean GraphDS_Vertex::IsFront (const Handle(GraphDS_Edge)& ) const 
66 {
67   Standard_NotImplemented::Raise();
68   return Standard_False;
69 }
70
71
72 Standard_Boolean GraphDS_Vertex::IsBack (const Handle(GraphDS_Edge)& ) const 
73 {
74   Standard_NotImplemented::Raise();
75   return Standard_False;
76 }
77
78
79
80 //=======================================================================
81 //function : IsRoot
82 //purpose  : never destination of an edge
83 //=======================================================================
84
85 Standard_Boolean GraphDS_Vertex::IsRoot (const Standard_Boolean ignoreselfloop) const 
86 {
87   Handle(GraphDS_Vertex) me = this;
88   Handle(GraphDS_Edge) E;
89   TColStd_MapIteratorOfMapOfTransient it;
90   for (it.Initialize(myEdges); it.More(); it.Next()) {
91     E = Handle(GraphDS_Edge)::DownCast(it.Key());    
92     if (ignoreselfloop && E->IsLoop()) continue;
93     if (E->Destination() == me) return Standard_False;
94   }
95   return Standard_True;
96 }
97
98
99 //=======================================================================
100 //function : IsLeaf
101 //purpose  : never source of an edge
102 //=======================================================================
103
104 Standard_Boolean GraphDS_Vertex::IsLeaf (const Standard_Boolean ignoreselfloop) const 
105 {
106   Handle(GraphDS_Vertex) me = this;
107   Handle(GraphDS_Edge) E;
108   TColStd_MapIteratorOfMapOfTransient it;
109   for (it.Initialize(myEdges); it.More(); it.Next()) {
110     E = Handle(GraphDS_Edge)::DownCast(it.Key());
111     if (ignoreselfloop && E->IsLoop()) continue;
112     if (E->Source() == me) return Standard_False;
113   }
114   return Standard_True;
115 }
116
117 //=======================================================================
118 //function : AddEdge
119 //purpose  : private
120 //=======================================================================
121
122 Standard_Boolean GraphDS_Vertex::AddEdge (const Handle(GraphDS_Edge)& E) 
123 {
124   return myEdges.Add(E);
125 }
126
127
128 //=======================================================================
129 //function : RemoveEdge
130 //purpose  : private 
131 //=======================================================================
132
133 void GraphDS_Vertex::RemoveEdge (const Handle(GraphDS_Edge)& E) 
134 {
135   myEdges.Remove(E);
136 }
137        
138
139
140 //=======================================================================
141 //function : GetEdges
142 //purpose  : private
143 //=======================================================================
144
145 const TColStd_MapOfTransient& GraphDS_Vertex::GetEdges () const 
146 {
147   return myEdges;
148 }
149
150
151
152
153
154
155
156