1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepBasic_RWConversionBasedUnitAndRatioUnit.hxx>
18 #include <StepBasic_ConversionBasedUnit.hxx>
19 #include <StepBasic_ConversionBasedUnitAndRatioUnit.hxx>
20 #include <StepBasic_DimensionalExponents.hxx>
21 #include <StepBasic_MeasureWithUnit.hxx>
22 #include <StepBasic_RatioUnit.hxx>
23 #include <StepData_StepReaderData.hxx>
24 #include <StepData_StepWriter.hxx>
26 RWStepBasic_RWConversionBasedUnitAndRatioUnit::RWStepBasic_RWConversionBasedUnitAndRatioUnit () {}
28 void RWStepBasic_RWConversionBasedUnitAndRatioUnit::ReadStep
29 (const Handle(StepData_StepReaderData)& data,
30 const Standard_Integer num0,
31 Handle(Interface_Check)& ach,
32 const Handle(StepBasic_ConversionBasedUnitAndRatioUnit)& ent) const
35 Standard_Integer num = num0;
38 // --- Instance of plex componant ConversionBasedUnit ---
40 if (!data->CheckNbParams(num,2,ach,"conversion_based_unit")) return;
42 // --- field : name ---
44 Handle(TCollection_HAsciiString) aName;
45 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
46 data->ReadString (num,1,"name",ach,aName);
48 // --- field : conversionFactor ---
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);
54 num = data->NextForComplex(num);
56 // --- Instance of common supertype NamedUnit ---
58 if (!data->CheckNbParams(num,1,ach,"named_unit")) return;
60 // --- field : dimensions ---
62 Handle(StepBasic_DimensionalExponents) aDimensions;
63 //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
64 data->ReadEntity(num, 1,"dimensions", ach, STANDARD_TYPE(StepBasic_DimensionalExponents), aDimensions);
66 num = data->NextForComplex(num);
68 // --- Instance of plex componant RatioUnit ---
70 if (!data->CheckNbParams(num,0,ach,"ratio_unit")) return;
72 //--- Initialisation of the red entity ---
74 ent->Init(aDimensions,aName,aConversionFactor);
78 void RWStepBasic_RWConversionBasedUnitAndRatioUnit::WriteStep
79 (StepData_StepWriter& SW,
80 const Handle(StepBasic_ConversionBasedUnitAndRatioUnit)& ent) const
83 // --- Instance of plex componant ConversionBasedUnit ---
85 SW.StartEntity("CONVERSION_BASED_UNIT");
86 // --- field : name ---
89 // --- field : conversionFactor ---
91 SW.Send(ent->ConversionFactor());
93 // --- Instance of plex componant RatioUnit ---
95 SW.StartEntity("RATIO_UNIT");
97 // --- Instance of common supertype NamedUnit ---
99 SW.StartEntity("NAMED_UNIT");
100 // --- field : dimensions ---
102 SW.Send(ent->Dimensions());
106 void RWStepBasic_RWConversionBasedUnitAndRatioUnit::Share(const Handle(StepBasic_ConversionBasedUnitAndRatioUnit)& ent, Interface_EntityIterator& iter) const
109 iter.GetOneItem(ent->Dimensions());
112 iter.GetOneItem(ent->ConversionFactor());