0023024: Update headers of OCCT files
[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-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21 //              <dp>
22
23 #include <Standard_NoMoreObject.hxx>
24 #include <Standard_NoSuchObject.hxx>
25 #include <GraphDS_DataMapIteratorOfEntityRoleMap.hxx>
26
27 //=======================================================================
28 //function : GraphDS_IncidentRelationsIterator
29 //purpose  : 
30 //=======================================================================
31
32 GraphDS_IncidentRelationsIterator::GraphDS_IncidentRelationsIterator ()
33 {
34 }
35
36
37 //=======================================================================
38 //function : GraphDS_IncidentRelationsIterator
39 //purpose  : 
40 //=======================================================================
41
42 GraphDS_IncidentRelationsIterator::GraphDS_IncidentRelationsIterator 
43   (const GraphDS_RelationGraph& G,
44    const Handle(GraphDS_Relation)& R)
45 {
46   Initialize (G,R);
47 }
48
49
50 //=======================================================================
51 //function : GraphDS_Initialize
52 //purpose  : 
53 //=======================================================================
54
55 void GraphDS_IncidentRelationsIterator::Initialize
56   (const GraphDS_RelationGraph&,
57    const Handle(GraphDS_Relation)& R)
58 {
59
60   myMap.Clear();
61
62   Handle(GraphDS_Entity) ENT;  
63   Handle(GraphDS_Relation) REL;
64   GraphDS_DataMapIteratorOfEntityRoleMap itv; 
65   TColStd_MapIteratorOfMapOfTransient itr;
66
67   for (itv.Initialize(R->GetEntities());itv.More();itv.Next()) {
68     ENT = Handle(GraphDS_Entity)::DownCast(itv.Key());
69     if (itv.Value() != GraphDS_OnlyOutput) {
70       for (itr.Initialize(ENT->GetRelations()); itr.More(); itr.Next()) {
71         REL = Handle(GraphDS_Relation)::DownCast(itr.Key());
72         if (REL->IsOutput(ENT)) myMap.Add(REL);
73       }
74     }
75   }
76   myRelations.Initialize(myMap);
77 }
78
79
80 //=======================================================================
81 //function : More
82 //purpose  : 
83 //=======================================================================
84
85 Standard_Boolean GraphDS_IncidentRelationsIterator::More () const
86 {
87   return myRelations.More();
88 }
89
90
91 //=======================================================================
92 //function : Next
93 //purpose  : 
94 //=======================================================================
95
96 void GraphDS_IncidentRelationsIterator::Next () 
97 {
98    myRelations.Next();
99 }
100         
101
102 //=======================================================================
103 //function : Value
104 //purpose  : 
105 //=======================================================================
106
107 const Handle(GraphDS_Relation)& GraphDS_IncidentRelationsIterator::Value () const 
108 {  
109   return  *((Handle(GraphDS_Relation)*)& myRelations.Key());
110   //return Handle(GraphDS_Relation)::DownCast(myRelations.Key());
111 }
112
113
114
115
116
117
118
119