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