0024947: Redesign OCCT legacy type system -- automatic
[occt.git] / src / RWStepShape / RWStepShape_RWSubface.cxx
1 // Created on: 2002-01-04
2 // Created by: data exchange team
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.1
17
18 #include <RWStepShape_RWSubface.ixx>
19 #include <StepShape_HArray1OfFaceBound.hxx>
20 #include <StepShape_FaceBound.hxx>
21 #include <StepShape_Face.hxx>
22
23 //=======================================================================
24 //function : RWStepShape_RWSubface
25 //purpose  : 
26 //=======================================================================
27
28 RWStepShape_RWSubface::RWStepShape_RWSubface ()
29 {
30 }
31
32 //=======================================================================
33 //function : ReadStep
34 //purpose  : 
35 //=======================================================================
36
37 void RWStepShape_RWSubface::ReadStep (const Handle(StepData_StepReaderData)& data,
38                                       const Standard_Integer num,
39                                       Handle(Interface_Check)& ach,
40                                       const Handle(StepShape_Subface) &ent) const
41 {
42   // Check number of parameters
43   if ( ! data->CheckNbParams(num,3,ach,"subface") ) return;
44
45   // Inherited fields of RepresentationItem
46
47   Handle(TCollection_HAsciiString) aRepresentationItem_Name;
48   data->ReadString (num, 1, "representation_item.name", ach, aRepresentationItem_Name);
49
50   // Inherited fields of Face
51
52   Handle(StepShape_HArray1OfFaceBound) aFace_Bounds;
53   Standard_Integer sub2 = 0;
54   if ( data->ReadSubList (num, 2, "face.bounds", ach, sub2) ) {
55     Standard_Integer num2 = sub2;
56     Standard_Integer nb0 = data->NbParams(num2);
57     aFace_Bounds = new StepShape_HArray1OfFaceBound (1, nb0);
58     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
59       Handle(StepShape_FaceBound) anIt0;
60       data->ReadEntity (num2, i0, "face.bounds", ach, STANDARD_TYPE(StepShape_FaceBound), anIt0);
61       aFace_Bounds->SetValue(i0, anIt0);
62     }
63   }
64
65   // Own fields of Subface
66
67   Handle(StepShape_Face) aParentFace;
68   data->ReadEntity (num, 3, "parent_face", ach, STANDARD_TYPE(StepShape_Face), aParentFace);
69
70   // Initialize entity
71   ent->Init(aRepresentationItem_Name,
72             aFace_Bounds,
73             aParentFace);
74 }
75
76 //=======================================================================
77 //function : WriteStep
78 //purpose  : 
79 //=======================================================================
80
81 void RWStepShape_RWSubface::WriteStep (StepData_StepWriter& SW,
82                                        const Handle(StepShape_Subface) &ent) const
83 {
84
85   // Inherited fields of RepresentationItem
86
87   SW.Send (ent->StepRepr_RepresentationItem::Name());
88
89   // Inherited fields of Face
90
91   SW.OpenSub();
92   for (Standard_Integer i1=1; i1 <= ent->StepShape_Face::Bounds()->Length(); i1++ ) {
93     Handle(StepShape_FaceBound) Var0 = ent->StepShape_Face::Bounds()->Value(i1);
94     SW.Send (Var0);
95   }
96   SW.CloseSub();
97
98   // Own fields of Subface
99
100   SW.Send (ent->ParentFace());
101 }
102
103 //=======================================================================
104 //function : Share
105 //purpose  : 
106 //=======================================================================
107
108 void RWStepShape_RWSubface::Share (const Handle(StepShape_Subface) &ent,
109                                    Interface_EntityIterator& iter) const
110 {
111
112   // Inherited fields of RepresentationItem
113
114   // Inherited fields of Face
115
116   for (Standard_Integer i1=1; i1 <= ent->StepShape_Face::Bounds()->Length(); i1++ ) {
117     Handle(StepShape_FaceBound) Var0 = ent->StepShape_Face::Bounds()->Value(i1);
118     iter.AddItem (Var0);
119   }
120
121   // Own fields of Subface
122
123   iter.AddItem (ent->ParentFace());
124 }