0022627: Change OCCT memory management defaults
[occt.git] / src / RWStepBasic / RWStepBasic_RWConversionBasedUnitAndLengthUnit.cxx
CommitLineData
7fd59977 1
2#include <RWStepBasic_RWConversionBasedUnitAndLengthUnit.ixx>
3#include <StepBasic_ConversionBasedUnit.hxx>
4#include <StepBasic_LengthUnit.hxx>
5#include <StepBasic_DimensionalExponents.hxx>
6#include <StepBasic_MeasureWithUnit.hxx>
7
8
9#include <Interface_EntityIterator.hxx>
10
11
12#include <StepBasic_ConversionBasedUnitAndLengthUnit.hxx>
13
14
15RWStepBasic_RWConversionBasedUnitAndLengthUnit::RWStepBasic_RWConversionBasedUnitAndLengthUnit () {}
16
17void RWStepBasic_RWConversionBasedUnitAndLengthUnit::ReadStep
18 (const Handle(StepData_StepReaderData)& data,
19 const Standard_Integer num0,
20 Handle(Interface_Check)& ach,
21 const Handle(StepBasic_ConversionBasedUnitAndLengthUnit)& ent) const
22{
23
24 Standard_Integer num = num0;
25
26
27 // --- Instance of plex componant ConversionBasedUnit ---
28
29 if (!data->CheckNbParams(num,2,ach,"conversion_based_unit")) return;
30
31 // --- field : name ---
32
33 Handle(TCollection_HAsciiString) aName;
34 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
35 data->ReadString (num,1,"name",ach,aName);
36
37 // --- field : conversionFactor ---
38
39 Handle(StepBasic_MeasureWithUnit) aConversionFactor;
40 //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
41 data->ReadEntity(num, 2,"conversion_factor", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aConversionFactor);
42
43 num = data->NextForComplex(num);
44
45 // --- Instance of plex componant LengthUnit ---
46
47 if (!data->CheckNbParams(num,0,ach,"length_unit")) return;
48
49 num = data->NextForComplex(num);
50
51 // --- Instance of common supertype NamedUnit ---
52
53 if (!data->CheckNbParams(num,1,ach,"named_unit")) return;
54 // --- field : dimensions ---
55
56
57 Handle(StepBasic_DimensionalExponents) aDimensions;
58 //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
59 data->ReadEntity(num, 1,"dimensions", ach, STANDARD_TYPE(StepBasic_DimensionalExponents), aDimensions);
60
61 //--- Initialisation of the red entity ---
62
63 ent->Init(aDimensions,aName,aConversionFactor);
64}
65
66
67void RWStepBasic_RWConversionBasedUnitAndLengthUnit::WriteStep
68 (StepData_StepWriter& SW,
69 const Handle(StepBasic_ConversionBasedUnitAndLengthUnit)& ent) const
70{
71
72 // --- Instance of plex componant ConversionBasedUnit ---
73
74 SW.StartEntity("CONVERSION_BASED_UNIT");
75 // --- field : name ---
76
77 SW.Send(ent->Name());
78 // --- field : conversionFactor ---
79
80 SW.Send(ent->ConversionFactor());
81
82 // --- Instance of plex componant LengthUnit ---
83
84 SW.StartEntity("LENGTH_UNIT");
85
86 // --- Instance of common supertype NamedUnit ---
87
88 SW.StartEntity("NAMED_UNIT");
89 // --- field : dimensions ---
90
91 SW.Send(ent->Dimensions());
92}
93
94
95void RWStepBasic_RWConversionBasedUnitAndLengthUnit::Share(const Handle(StepBasic_ConversionBasedUnitAndLengthUnit)& ent, Interface_EntityIterator& iter) const
96{
97
98 iter.GetOneItem(ent->Dimensions());
99
100
101 iter.GetOneItem(ent->ConversionFactor());
102}
103