b311480e |
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 | |
7fd59977 |
18 | |
19 | #include <RWStepBasic_RWConversionBasedUnitAndRatioUnit.ixx> |
20 | #include <StepBasic_ConversionBasedUnit.hxx> |
21 | #include <StepBasic_RatioUnit.hxx> |
22 | #include <StepBasic_DimensionalExponents.hxx> |
23 | #include <StepBasic_MeasureWithUnit.hxx> |
24 | |
25 | |
26 | #include <Interface_EntityIterator.hxx> |
27 | |
28 | |
29 | #include <StepBasic_ConversionBasedUnitAndRatioUnit.hxx> |
30 | |
31 | |
32 | RWStepBasic_RWConversionBasedUnitAndRatioUnit::RWStepBasic_RWConversionBasedUnitAndRatioUnit () {} |
33 | |
34 | void RWStepBasic_RWConversionBasedUnitAndRatioUnit::ReadStep |
35 | (const Handle(StepData_StepReaderData)& data, |
36 | const Standard_Integer num0, |
37 | Handle(Interface_Check)& ach, |
38 | const Handle(StepBasic_ConversionBasedUnitAndRatioUnit)& ent) const |
39 | { |
40 | |
41 | Standard_Integer num = num0; |
42 | |
43 | |
44 | // --- Instance of plex componant ConversionBasedUnit --- |
45 | |
46 | if (!data->CheckNbParams(num,2,ach,"conversion_based_unit")) return; |
47 | |
48 | // --- field : name --- |
49 | |
50 | Handle(TCollection_HAsciiString) aName; |
51 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
52 | data->ReadString (num,1,"name",ach,aName); |
53 | |
54 | // --- field : conversionFactor --- |
55 | |
56 | Handle(StepBasic_MeasureWithUnit) aConversionFactor; |
57 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
58 | data->ReadEntity(num, 2,"conversion_factor", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aConversionFactor); |
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 | |
66 | // --- field : dimensions --- |
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 | num = data->NextForComplex(num); |
73 | |
74 | // --- Instance of plex componant RatioUnit --- |
75 | |
76 | if (!data->CheckNbParams(num,0,ach,"ratio_unit")) return; |
77 | |
78 | //--- Initialisation of the red entity --- |
79 | |
80 | ent->Init(aDimensions,aName,aConversionFactor); |
81 | } |
82 | |
83 | |
84 | void RWStepBasic_RWConversionBasedUnitAndRatioUnit::WriteStep |
85 | (StepData_StepWriter& SW, |
86 | const Handle(StepBasic_ConversionBasedUnitAndRatioUnit)& ent) const |
87 | { |
88 | |
89 | // --- Instance of plex componant ConversionBasedUnit --- |
90 | |
91 | SW.StartEntity("CONVERSION_BASED_UNIT"); |
92 | // --- field : name --- |
93 | |
94 | SW.Send(ent->Name()); |
95 | // --- field : conversionFactor --- |
96 | |
97 | SW.Send(ent->ConversionFactor()); |
98 | |
99 | // --- Instance of plex componant RatioUnit --- |
100 | |
101 | SW.StartEntity("RATIO_UNIT"); |
102 | |
103 | // --- Instance of common supertype NamedUnit --- |
104 | |
105 | SW.StartEntity("NAMED_UNIT"); |
106 | // --- field : dimensions --- |
107 | |
108 | SW.Send(ent->Dimensions()); |
109 | } |
110 | |
111 | |
112 | void RWStepBasic_RWConversionBasedUnitAndRatioUnit::Share(const Handle(StepBasic_ConversionBasedUnitAndRatioUnit)& ent, Interface_EntityIterator& iter) const |
113 | { |
114 | |
115 | iter.GetOneItem(ent->Dimensions()); |
116 | |
117 | |
118 | iter.GetOneItem(ent->ConversionFactor()); |
119 | } |
120 | |