0024135: Result of reading step file is invalid.
[occt.git] / src / RWStepAP214 / RWStepAP214_RWAppliedGroupAssignment.cxx
1 // Created on: 2000-05-10
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2012 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.1
21
22 #include <RWStepAP214_RWAppliedGroupAssignment.ixx>
23 #include <StepAP214_HArray1OfGroupItem.hxx>
24 #include <StepAP214_GroupItem.hxx>
25
26 //=======================================================================
27 //function : RWStepAP214_RWAppliedGroupAssignment
28 //purpose  : 
29 //=======================================================================
30
31 RWStepAP214_RWAppliedGroupAssignment::RWStepAP214_RWAppliedGroupAssignment ()
32 {
33 }
34
35 //=======================================================================
36 //function : ReadStep
37 //purpose  : 
38 //=======================================================================
39
40 void RWStepAP214_RWAppliedGroupAssignment::ReadStep (const Handle(StepData_StepReaderData)& data,
41                                                      const Standard_Integer num,
42                                                      Handle(Interface_Check)& ach,
43                                                      const Handle(StepAP214_AppliedGroupAssignment) &ent) const
44 {
45   // Check number of parameters
46   if ( ! data->CheckNbParams(num,2,ach,"applied_group_assignment") ) return;
47
48   // Inherited fields of GroupAssignment
49
50   Handle(StepBasic_Group) aGroupAssignment_AssignedGroup;
51   data->ReadEntity (num, 1, "group_assignment.assigned_group", ach, STANDARD_TYPE(StepBasic_Group), aGroupAssignment_AssignedGroup);
52
53   // Own fields of AppliedGroupAssignment
54
55   Handle(StepAP214_HArray1OfGroupItem) anItems;
56   Standard_Integer sub2 = 0;
57   if ( data->ReadSubList (num, 2, "items", ach, sub2) ) {
58     Standard_Integer num2 = sub2;
59     Standard_Integer nb0 = data->NbParams(num2);
60     if (nb0)
61     {
62       anItems = new StepAP214_HArray1OfGroupItem (1, nb0);
63       for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
64         StepAP214_GroupItem anIt0;
65         data->ReadEntity (num2, i0, "items", ach, anIt0);
66         anItems->SetValue(i0, anIt0);
67       }
68     }
69   }
70   // Initialize entity
71   ent->Init(aGroupAssignment_AssignedGroup, anItems);
72 }
73
74 //=======================================================================
75 //function : WriteStep
76 //purpose  : 
77 //=======================================================================
78
79 void RWStepAP214_RWAppliedGroupAssignment::WriteStep (StepData_StepWriter& SW,
80                                                       const Handle(StepAP214_AppliedGroupAssignment) &ent) const
81 {
82
83   // Inherited fields of GroupAssignment
84
85   SW.Send (ent->StepBasic_GroupAssignment::AssignedGroup());
86
87   // Own fields of AppliedGroupAssignment
88
89   SW.OpenSub();
90   for (Standard_Integer i1=1; i1 <= ent->Items()->Length(); i1++ ) {
91     StepAP214_GroupItem Var0 = ent->Items()->Value(i1);
92     SW.Send (Var0.Value());
93   }
94   SW.CloseSub();
95 }
96
97 //=======================================================================
98 //function : Share
99 //purpose  : 
100 //=======================================================================
101
102 void RWStepAP214_RWAppliedGroupAssignment::Share (const Handle(StepAP214_AppliedGroupAssignment) &ent,
103                                                   Interface_EntityIterator& iter) const
104 {
105
106   // Inherited fields of GroupAssignment
107
108   iter.AddItem (ent->StepBasic_GroupAssignment::AssignedGroup());
109
110   // Own fields of AppliedGroupAssignment
111   if (!ent->Items().IsNull())
112   {
113     for (Standard_Integer i2=1; i2 <= ent->Items()->Length(); i2++ ) {
114       StepAP214_GroupItem Var0 = ent->Items()->Value(i2);
115       iter.AddItem (Var0.Value());
116     }
117   }
118 }