1 // Created on: 2002-12-12
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.2
17 
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <RWStepFEA_RWNodeWithVector.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepFEA_FeaModel.hxx>
24 #include <StepFEA_NodeWithVector.hxx>
25 #include <StepRepr_HArray1OfRepresentationItem.hxx>
26 #include <StepRepr_RepresentationContext.hxx>
27 #include <StepRepr_RepresentationItem.hxx>
28 
29 //=======================================================================
30 //function : RWStepFEA_RWNodeWithVector
31 //purpose  :
32 //=======================================================================
RWStepFEA_RWNodeWithVector()33 RWStepFEA_RWNodeWithVector::RWStepFEA_RWNodeWithVector ()
34 {
35 }
36 
37 //=======================================================================
38 //function : ReadStep
39 //purpose  :
40 //=======================================================================
41 
ReadStep(const Handle (StepData_StepReaderData)& data,const Standard_Integer num,Handle (Interface_Check)& ach,const Handle (StepFEA_NodeWithVector)& ent) const42 void RWStepFEA_RWNodeWithVector::ReadStep (const Handle(StepData_StepReaderData)& data,
43                                            const Standard_Integer num,
44                                            Handle(Interface_Check)& ach,
45                                            const Handle(StepFEA_NodeWithVector) &ent) const
46 {
47   // Check number of parameters
48   if ( ! data->CheckNbParams(num,4,ach,"node_with_vector") ) return;
49 
50   // Inherited fields of Representation
51 
52   Handle(TCollection_HAsciiString) aRepresentation_Name;
53   data->ReadString (num, 1, "representation.name", ach, aRepresentation_Name);
54 
55   Handle(StepRepr_HArray1OfRepresentationItem) aRepresentation_Items;
56   Standard_Integer sub2 = 0;
57   if ( data->ReadSubList (num, 2, "representation.items", ach, sub2) ) {
58     Standard_Integer nb0 = data->NbParams(sub2);
59     aRepresentation_Items = new StepRepr_HArray1OfRepresentationItem (1, nb0);
60     Standard_Integer num2 = sub2;
61     for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
62       Handle(StepRepr_RepresentationItem) anIt0;
63       data->ReadEntity (num2, i0, "representation_item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anIt0);
64       aRepresentation_Items->SetValue(i0, anIt0);
65     }
66   }
67 
68   Handle(StepRepr_RepresentationContext) aRepresentation_ContextOfItems;
69   data->ReadEntity (num, 3, "representation.context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aRepresentation_ContextOfItems);
70 
71   // Inherited fields of NodeRepresentation
72 
73   Handle(StepFEA_FeaModel) aNodeRepresentation_ModelRef;
74   data->ReadEntity (num, 4, "node_representation.model_ref", ach, STANDARD_TYPE(StepFEA_FeaModel), aNodeRepresentation_ModelRef);
75 
76   // Initialize entity
77   ent->Init(aRepresentation_Name,
78             aRepresentation_Items,
79             aRepresentation_ContextOfItems,
80             aNodeRepresentation_ModelRef);
81 }
82 
83 //=======================================================================
84 //function : WriteStep
85 //purpose  :
86 //=======================================================================
87 
WriteStep(StepData_StepWriter & SW,const Handle (StepFEA_NodeWithVector)& ent) const88 void RWStepFEA_RWNodeWithVector::WriteStep (StepData_StepWriter& SW,
89                                             const Handle(StepFEA_NodeWithVector) &ent) const
90 {
91 
92   // Inherited fields of Representation
93 
94   SW.Send (ent->StepRepr_Representation::Name());
95 
96   SW.OpenSub();
97   for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::NbItems(); i1++ ) {
98     Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
99     SW.Send (Var0);
100   }
101   SW.CloseSub();
102 
103   SW.Send (ent->StepRepr_Representation::ContextOfItems());
104 
105   // Inherited fields of NodeRepresentation
106 
107   SW.Send (ent->StepFEA_NodeRepresentation::ModelRef());
108 }
109 
110 //=======================================================================
111 //function : Share
112 //purpose  :
113 //=======================================================================
114 
Share(const Handle (StepFEA_NodeWithVector)& ent,Interface_EntityIterator & iter) const115 void RWStepFEA_RWNodeWithVector::Share (const Handle(StepFEA_NodeWithVector) &ent,
116                                         Interface_EntityIterator& iter) const
117 {
118 
119   // Inherited fields of Representation
120 
121   for (Standard_Integer i1=1; i1 <= ent->StepRepr_Representation::NbItems(); i1++ ) {
122     Handle(StepRepr_RepresentationItem) Var0 = ent->StepRepr_Representation::Items()->Value(i1);
123     iter.AddItem (Var0);
124   }
125 
126   iter.AddItem (ent->StepRepr_Representation::ContextOfItems());
127 
128   // Inherited fields of NodeRepresentation
129 
130   iter.AddItem (ent->StepFEA_NodeRepresentation::ModelRef());
131 }
132