0024157: Parallelization of assembly part of BO
[occt.git] / src / RWStepBasic / RWStepBasic_RWConversionBasedUnitAndMassUnit.cxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18 #include <RWStepBasic_RWConversionBasedUnitAndMassUnit.ixx>
19
20 #include <StepBasic_ConversionBasedUnit.hxx>
21 #include <StepBasic_MassUnit.hxx>
22 #include <StepBasic_DimensionalExponents.hxx>
23 #include <StepBasic_MeasureWithUnit.hxx>
24 #include <Interface_EntityIterator.hxx>
25 #include <StepBasic_ConversionBasedUnitAndMassUnit.hxx>
26
27
28 //=======================================================================
29 //function : RWStepBasic_RWConversionBasedUnitAndMassUnit
30 //purpose  : 
31 //=======================================================================
32
33 RWStepBasic_RWConversionBasedUnitAndMassUnit::RWStepBasic_RWConversionBasedUnitAndMassUnit()
34 {
35 }
36
37
38 //=======================================================================
39 //function : ReadStep
40 //purpose  : 
41 //=======================================================================
42
43 void RWStepBasic_RWConversionBasedUnitAndMassUnit::ReadStep
44         (const Handle(StepData_StepReaderData)& data,
45          const Standard_Integer num0,
46          Handle(Interface_Check)& ach,
47          const Handle(StepBasic_ConversionBasedUnitAndMassUnit)& ent) const
48 {
49
50   Standard_Integer num = num0;
51
52   // --- Instance of plex componant ConversionBasedUnit ---
53   if (!data->CheckNbParams(num,2,ach,"conversion_based_unit")) return;
54   // --- field : name ---
55   Handle(TCollection_HAsciiString) aName;
56   //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
57   data->ReadString (num,1,"name",ach,aName);
58   // --- field : conversionFactor ---
59   Handle(StepBasic_MeasureWithUnit) aConversionFactor;
60   //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
61   data->ReadEntity(num, 2,"conversion_factor", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aConversionFactor);
62
63   num = data->NextForComplex(num);
64
65   // --- Instance of plex componant MassUnit ---
66   if (!data->CheckNbParams(num,0,ach,"Mass_unit")) return;
67
68   num = data->NextForComplex(num);
69
70   // --- Instance of common supertype NamedUnit ---
71   if (!data->CheckNbParams(num,1,ach,"named_unit")) return;
72   // --- field : dimensions ---
73   Handle(StepBasic_DimensionalExponents) aDimensions;
74   //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
75   data->ReadEntity(num, 1,"dimensions", ach, STANDARD_TYPE(StepBasic_DimensionalExponents), aDimensions);
76
77   //--- Initialisation of the red entity ---
78   ent->Init(aDimensions,aName,aConversionFactor);
79 }
80
81
82 //=======================================================================
83 //function : WriteStep
84 //purpose  : 
85 //=======================================================================
86
87 void RWStepBasic_RWConversionBasedUnitAndMassUnit::WriteStep
88         (StepData_StepWriter& SW,
89          const Handle(StepBasic_ConversionBasedUnitAndMassUnit)& ent) const
90 {
91   // --- Instance of plex componant ConversionBasedUnit ---
92   SW.StartEntity("CONVERSION_BASED_UNIT");
93   // --- field : name ---
94   SW.Send(ent->Name());
95   // --- field : conversionFactor ---
96   SW.Send(ent->ConversionFactor());
97   // --- Instance of plex componant MassUnit ---
98   SW.StartEntity("Mass_UNIT");
99   // --- Instance of common supertype NamedUnit ---
100   SW.StartEntity("NAMED_UNIT");
101   // --- field : dimensions ---
102   SW.Send(ent->Dimensions());
103 }
104
105
106 //=======================================================================
107 //function : Share
108 //purpose  : 
109 //=======================================================================
110
111 void RWStepBasic_RWConversionBasedUnitAndMassUnit::Share
112   (const Handle(StepBasic_ConversionBasedUnitAndMassUnit)& ent,
113    Interface_EntityIterator& iter) const
114 {
115   iter.GetOneItem(ent->Dimensions());
116   iter.GetOneItem(ent->ConversionFactor());
117 }
118