0026371: Implementation of new entities for GD&T
[occt.git] / src / RWStepDimTol / RWStepDimTol_RWCommonDatum.cxx
1 // Created on: 2003-06-04
2 // Created by: Galina KULIKOVA
3 // Copyright (c) 2003-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 <RWStepDimTol_RWCommonDatum.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepDimTol_CommonDatum.hxx>
24 #include <StepDimTol_Datum.hxx>
25 #include <StepRepr_ProductDefinitionShape.hxx>
26
27 //=======================================================================
28 //function : RWStepDimTol_RWCommonDatum
29 //purpose  : 
30 //=======================================================================
31 RWStepDimTol_RWCommonDatum::RWStepDimTol_RWCommonDatum ()
32 {
33 }
34
35 //=======================================================================
36 //function : ReadStep
37 //purpose  : 
38 //=======================================================================
39
40 void RWStepDimTol_RWCommonDatum::ReadStep (const Handle(StepData_StepReaderData)& data,
41                                            const Standard_Integer num,
42                                            Handle(Interface_Check)& ach,
43                                            const Handle(StepDimTol_CommonDatum) &ent) const
44 {
45   // Check number of parameters
46   if ( ! data->CheckNbParams(num,9,ach,"common_datum") ) return;
47
48   // Inherited fields of ShapeAspect
49
50   Handle(TCollection_HAsciiString) aShapeAspect_Name;
51   data->ReadString (num, 1, "shape_aspect.name", ach, aShapeAspect_Name);
52
53   Handle(TCollection_HAsciiString) aShapeAspect_Description;
54   if ( data->IsParamDefined (num,2) ) {
55     data->ReadString (num, 2, "shape_aspect.description", ach, aShapeAspect_Description);
56   }
57
58   Handle(StepRepr_ProductDefinitionShape) aShapeAspect_OfShape;
59   data->ReadEntity (num, 3, "shape_aspect.of_shape", ach, STANDARD_TYPE(StepRepr_ProductDefinitionShape), aShapeAspect_OfShape);
60
61   StepData_Logical aShapeAspect_ProductDefinitional;
62   data->ReadLogical (num, 4, "shape_aspect.product_definitional", ach, aShapeAspect_ProductDefinitional);
63
64   // Inherited fields of Datum
65
66   Handle(TCollection_HAsciiString) aDatum_Name;
67   data->ReadString (num, 5, "shape_aspect.name", ach,aDatum_Name);
68
69   Handle(TCollection_HAsciiString) aDatum_Description;
70   if ( data->IsParamDefined (num,6) ) {
71     data->ReadString (num, 6, "shape_aspect.description", ach,aDatum_Description);
72   }
73
74   Handle(StepRepr_ProductDefinitionShape) aDatum_OfShape;
75   data->ReadEntity (num, 7, "shape_aspect.of_shape", ach, STANDARD_TYPE(StepRepr_ProductDefinitionShape),aDatum_OfShape);
76
77   StepData_Logical aDatum_ProductDefinitional;
78   data->ReadLogical (num, 8, "shape_aspect.product_definitional", ach,aDatum_ProductDefinitional);
79
80   // Inherited fields of Datum
81
82   Handle(TCollection_HAsciiString) aDatum_Identification;
83   data->ReadString (num, 9, "datum.identification", ach, aDatum_Identification);
84
85   // Initialize entity
86   ent->Init(aShapeAspect_Name,
87            aShapeAspect_Description,
88            aShapeAspect_OfShape,
89             aShapeAspect_ProductDefinitional,
90             aDatum_Name,
91             aDatum_Description,
92             aDatum_OfShape,
93             aDatum_ProductDefinitional,
94             aDatum_Identification);
95 }
96
97 //=======================================================================
98 //function : WriteStep
99 //purpose  : 
100 //=======================================================================
101
102 void RWStepDimTol_RWCommonDatum::WriteStep (StepData_StepWriter& SW,
103                                             const Handle(StepDimTol_CommonDatum) &ent) const
104 {
105
106   // Inherited fields of ShapeAspect
107
108   SW.Send (ent->StepRepr_ShapeAspect::Name());
109
110   SW.Send (ent->StepRepr_ShapeAspect::Description());
111
112   SW.Send (ent->StepRepr_ShapeAspect::OfShape());
113
114   SW.SendLogical (ent->StepRepr_ShapeAspect::ProductDefinitional());
115
116   // Inherited fields of Datum->ShapeAspect
117
118   SW.Send (ent->Datum()->StepRepr_ShapeAspect::Name());
119
120   SW.Send (ent->Datum()->StepRepr_ShapeAspect::Description());
121
122   SW.Send (ent->Datum()->StepRepr_ShapeAspect::OfShape());
123
124   SW.SendLogical (ent->Datum()->StepRepr_ShapeAspect::ProductDefinitional());
125
126   // Inherited fields of Datum
127
128   SW.Send (ent->Datum()->Identification());
129 }
130
131 //=======================================================================
132 //function : Share
133 //purpose  : 
134 //=======================================================================
135
136 void RWStepDimTol_RWCommonDatum::Share (const Handle(StepDimTol_CommonDatum) &ent,
137                                         Interface_EntityIterator& iter) const
138 {
139
140   // Inherited fields of ShapeAspect
141
142   iter.AddItem (ent->StepRepr_ShapeAspect::OfShape());
143
144   // Inherited fields of Datum
145
146   iter.AddItem (ent->Datum()->StepRepr_ShapeAspect::OfShape());
147
148 }