0024509: Suspect unused variable in TPrsStd_ConstraintTools.cxx
[occt.git] / src / GraphDS / GraphDS_IncidentRelationsIterator.gxx
1 // Created on: 1991-09-10
2 // Created by: Denis PASCAL
3 // Copyright (c) 1991-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 //              <dp>
18
19 #include <Standard_NoMoreObject.hxx>
20 #include <Standard_NoSuchObject.hxx>
21 #include <GraphDS_DataMapIteratorOfEntityRoleMap.hxx>
22
23 //=======================================================================
24 //function : GraphDS_IncidentRelationsIterator
25 //purpose  : 
26 //=======================================================================
27
28 GraphDS_IncidentRelationsIterator::GraphDS_IncidentRelationsIterator ()
29 {
30 }
31
32
33 //=======================================================================
34 //function : GraphDS_IncidentRelationsIterator
35 //purpose  : 
36 //=======================================================================
37
38 GraphDS_IncidentRelationsIterator::GraphDS_IncidentRelationsIterator 
39   (const GraphDS_RelationGraph& G,
40    const Handle(GraphDS_Relation)& R)
41 {
42   Initialize (G,R);
43 }
44
45
46 //=======================================================================
47 //function : GraphDS_Initialize
48 //purpose  : 
49 //=======================================================================
50
51 void GraphDS_IncidentRelationsIterator::Initialize
52   (const GraphDS_RelationGraph&,
53    const Handle(GraphDS_Relation)& R)
54 {
55
56   myMap.Clear();
57
58   Handle(GraphDS_Entity) ENT;  
59   Handle(GraphDS_Relation) REL;
60   GraphDS_DataMapIteratorOfEntityRoleMap itv; 
61   TColStd_MapIteratorOfMapOfTransient itr;
62
63   for (itv.Initialize(R->GetEntities());itv.More();itv.Next()) {
64     ENT = Handle(GraphDS_Entity)::DownCast(itv.Key());
65     if (itv.Value() != GraphDS_OnlyOutput) {
66       for (itr.Initialize(ENT->GetRelations()); itr.More(); itr.Next()) {
67         REL = Handle(GraphDS_Relation)::DownCast(itr.Key());
68         if (REL->IsOutput(ENT)) myMap.Add(REL);
69       }
70     }
71   }
72   myRelations.Initialize(myMap);
73 }
74
75
76 //=======================================================================
77 //function : More
78 //purpose  : 
79 //=======================================================================
80
81 Standard_Boolean GraphDS_IncidentRelationsIterator::More () const
82 {
83   return myRelations.More();
84 }
85
86
87 //=======================================================================
88 //function : Next
89 //purpose  : 
90 //=======================================================================
91
92 void GraphDS_IncidentRelationsIterator::Next () 
93 {
94    myRelations.Next();
95 }
96         
97
98 //=======================================================================
99 //function : Value
100 //purpose  : 
101 //=======================================================================
102
103 const Handle(GraphDS_Relation)& GraphDS_IncidentRelationsIterator::Value () const 
104 {  
105   return  *((Handle(GraphDS_Relation)*)& myRelations.Key());
106   //return Handle(GraphDS_Relation)::DownCast(myRelations.Key());
107 }
108
109
110
111
112
113
114
115