0024947: Redesign OCCT legacy type system -- automatic
[occt.git] / src / RWStepDimTol / RWStepDimTol_RWGeometricToleranceWithDatumReference.cxx
CommitLineData
b311480e 1// Created on: 2003-06-04
2// Created by: Galina KULIKOVA
973c2be1 3// Copyright (c) 2003-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
7fd59977 16// Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.2
7fd59977 17
18#include <RWStepDimTol_RWGeometricToleranceWithDatumReference.ixx>
19#include <StepDimTol_HArray1OfDatumReference.hxx>
20#include <StepDimTol_DatumReference.hxx>
ec357c5c 21#include <StepBasic_MeasureWithUnit.hxx>
22#include <StepRepr_ShapeAspect.hxx>
7fd59977 23
24//=======================================================================
25//function : RWStepDimTol_RWGeometricToleranceWithDatumReference
26//purpose :
27//=======================================================================
28
29RWStepDimTol_RWGeometricToleranceWithDatumReference::RWStepDimTol_RWGeometricToleranceWithDatumReference ()
30{
31}
32
33//=======================================================================
34//function : ReadStep
35//purpose :
36//=======================================================================
37
38void RWStepDimTol_RWGeometricToleranceWithDatumReference::ReadStep (const Handle(StepData_StepReaderData)& data,
39 const Standard_Integer num,
40 Handle(Interface_Check)& ach,
41 const Handle(StepDimTol_GeometricToleranceWithDatumReference) &ent) const
42{
43 // Check number of parameters
44 if ( ! data->CheckNbParams(num,5,ach,"geometric_tolerance_with_datum_reference") ) return;
45
46 // Inherited fields of GeometricTolerance
47
48 Handle(TCollection_HAsciiString) aGeometricTolerance_Name;
49 data->ReadString (num, 1, "geometric_tolerance.name", ach, aGeometricTolerance_Name);
50
51 Handle(TCollection_HAsciiString) aGeometricTolerance_Description;
52 data->ReadString (num, 2, "geometric_tolerance.description", ach, aGeometricTolerance_Description);
53
54 Handle(StepBasic_MeasureWithUnit) aGeometricTolerance_Magnitude;
55 data->ReadEntity (num, 3, "geometric_tolerance.magnitude", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aGeometricTolerance_Magnitude);
56
57 Handle(StepRepr_ShapeAspect) aGeometricTolerance_TolerancedShapeAspect;
58 data->ReadEntity (num, 4, "geometric_tolerance.toleranced_shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aGeometricTolerance_TolerancedShapeAspect);
59
60 // Own fields of GeometricToleranceWithDatumReference
61
62 Handle(StepDimTol_HArray1OfDatumReference) aDatumSystem;
63 Standard_Integer sub5 = 0;
64 if ( data->ReadSubList (num, 5, "datum_system", ach, sub5) ) {
65 Standard_Integer nb0 = data->NbParams(sub5);
66 aDatumSystem = new StepDimTol_HArray1OfDatumReference (1, nb0);
67 Standard_Integer num2 = sub5;
68 for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
69 Handle(StepDimTol_DatumReference) anIt0;
70 data->ReadEntity (num2, i0, "datum_reference", ach, STANDARD_TYPE(StepDimTol_DatumReference), anIt0);
71 aDatumSystem->SetValue(i0, anIt0);
72 }
73 }
74
75 // Initialize entity
76 ent->Init(aGeometricTolerance_Name,
77 aGeometricTolerance_Description,
78 aGeometricTolerance_Magnitude,
79 aGeometricTolerance_TolerancedShapeAspect,
80 aDatumSystem);
81}
82
83//=======================================================================
84//function : WriteStep
85//purpose :
86//=======================================================================
87
88void RWStepDimTol_RWGeometricToleranceWithDatumReference::WriteStep (StepData_StepWriter& SW,
89 const Handle(StepDimTol_GeometricToleranceWithDatumReference) &ent) const
90{
91
92 // Inherited fields of GeometricTolerance
93
94 SW.Send (ent->StepDimTol_GeometricTolerance::Name());
95
96 SW.Send (ent->StepDimTol_GeometricTolerance::Description());
97
98 SW.Send (ent->StepDimTol_GeometricTolerance::Magnitude());
99
100 SW.Send (ent->StepDimTol_GeometricTolerance::TolerancedShapeAspect());
101
102 // Own fields of GeometricToleranceWithDatumReference
103
104 SW.OpenSub();
105 for (Standard_Integer i4=1; i4 <= ent->DatumSystem()->Length(); i4++ ) {
106 Handle(StepDimTol_DatumReference) Var0 = ent->DatumSystem()->Value(i4);
107 SW.Send (Var0);
108 }
109 SW.CloseSub();
110}
111
112//=======================================================================
113//function : Share
114//purpose :
115//=======================================================================
116
117void RWStepDimTol_RWGeometricToleranceWithDatumReference::Share (const Handle(StepDimTol_GeometricToleranceWithDatumReference) &ent,
118 Interface_EntityIterator& iter) const
119{
120
121 // Inherited fields of GeometricTolerance
122
123 iter.AddItem (ent->StepDimTol_GeometricTolerance::Magnitude());
124
125 iter.AddItem (ent->StepDimTol_GeometricTolerance::TolerancedShapeAspect());
126
127 // Own fields of GeometricToleranceWithDatumReference
128
129 for (Standard_Integer i3=1; i3 <= ent->DatumSystem()->Length(); i3++ ) {
130 Handle(StepDimTol_DatumReference) Var0 = ent->DatumSystem()->Value(i3);
131 iter.AddItem (Var0);
132 }
133}