Warnings on vc14 were eliminated
[occt.git] / src / RWStepBasic / RWStepBasic_RWConversionBasedUnitAndLengthUnit.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
7fd59977 13
7fd59977 14
42cf5bc1 15#include <Interface_Check.hxx>
7fd59977 16#include <Interface_EntityIterator.hxx>
42cf5bc1 17#include <RWStepBasic_RWConversionBasedUnitAndLengthUnit.hxx>
18#include <StepBasic_ConversionBasedUnit.hxx>
7fd59977 19#include <StepBasic_ConversionBasedUnitAndLengthUnit.hxx>
42cf5bc1 20#include <StepBasic_DimensionalExponents.hxx>
21#include <StepBasic_LengthUnit.hxx>
22#include <StepBasic_MeasureWithUnit.hxx>
23#include <StepData_StepReaderData.hxx>
24#include <StepData_StepWriter.hxx>
7fd59977 25
26RWStepBasic_RWConversionBasedUnitAndLengthUnit::RWStepBasic_RWConversionBasedUnitAndLengthUnit () {}
27
28void RWStepBasic_RWConversionBasedUnitAndLengthUnit::ReadStep
29 (const Handle(StepData_StepReaderData)& data,
30 const Standard_Integer num0,
31 Handle(Interface_Check)& ach,
32 const Handle(StepBasic_ConversionBasedUnitAndLengthUnit)& ent) const
33{
34
35 Standard_Integer num = num0;
36
37
38 // --- Instance of plex componant ConversionBasedUnit ---
39
40 if (!data->CheckNbParams(num,2,ach,"conversion_based_unit")) return;
41
42 // --- field : name ---
43
44 Handle(TCollection_HAsciiString) aName;
45 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
46 data->ReadString (num,1,"name",ach,aName);
47
48 // --- field : conversionFactor ---
49
50 Handle(StepBasic_MeasureWithUnit) aConversionFactor;
51 //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
52 data->ReadEntity(num, 2,"conversion_factor", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aConversionFactor);
53
54 num = data->NextForComplex(num);
55
56 // --- Instance of plex componant LengthUnit ---
57
58 if (!data->CheckNbParams(num,0,ach,"length_unit")) return;
59
60 num = data->NextForComplex(num);
61
62 // --- Instance of common supertype NamedUnit ---
63
64 if (!data->CheckNbParams(num,1,ach,"named_unit")) return;
65 // --- field : dimensions ---
66
67
68 Handle(StepBasic_DimensionalExponents) aDimensions;
69 //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
70 data->ReadEntity(num, 1,"dimensions", ach, STANDARD_TYPE(StepBasic_DimensionalExponents), aDimensions);
71
72 //--- Initialisation of the red entity ---
73
74 ent->Init(aDimensions,aName,aConversionFactor);
75}
76
77
78void RWStepBasic_RWConversionBasedUnitAndLengthUnit::WriteStep
79 (StepData_StepWriter& SW,
80 const Handle(StepBasic_ConversionBasedUnitAndLengthUnit)& ent) const
81{
82
83 // --- Instance of plex componant ConversionBasedUnit ---
84
85 SW.StartEntity("CONVERSION_BASED_UNIT");
86 // --- field : name ---
87
88 SW.Send(ent->Name());
89 // --- field : conversionFactor ---
90
91 SW.Send(ent->ConversionFactor());
92
93 // --- Instance of plex componant LengthUnit ---
94
95 SW.StartEntity("LENGTH_UNIT");
96
97 // --- Instance of common supertype NamedUnit ---
98
99 SW.StartEntity("NAMED_UNIT");
100 // --- field : dimensions ---
101
102 SW.Send(ent->Dimensions());
103}
104
105
106void RWStepBasic_RWConversionBasedUnitAndLengthUnit::Share(const Handle(StepBasic_ConversionBasedUnitAndLengthUnit)& ent, Interface_EntityIterator& iter) const
107{
108
109 iter.GetOneItem(ent->Dimensions());
110
111
112 iter.GetOneItem(ent->ConversionFactor());
113}
114