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 | |
15 | #include <Interface_EntityIterator.hxx> |
42cf5bc1 |
16 | #include <RWStepBasic_RWConversionBasedUnitAndTimeUnit.hxx> |
7fd59977 |
17 | #include <StepBasic_ConversionBasedUnitAndTimeUnit.hxx> |
42cf5bc1 |
18 | #include <StepBasic_DimensionalExponents.hxx> |
19 | #include <StepBasic_MeasureWithUnit.hxx> |
20 | #include <StepBasic_TimeUnit.hxx> |
21 | #include <StepData_StepReaderData.hxx> |
22 | #include <StepData_StepWriter.hxx> |
7fd59977 |
23 | |
24 | RWStepBasic_RWConversionBasedUnitAndTimeUnit::RWStepBasic_RWConversionBasedUnitAndTimeUnit () {} |
25 | |
26 | void RWStepBasic_RWConversionBasedUnitAndTimeUnit::ReadStep |
27 | (const Handle(StepData_StepReaderData)& data, |
28 | const Standard_Integer num0, |
29 | Handle(Interface_Check)& ach, |
30 | const Handle(StepBasic_ConversionBasedUnitAndTimeUnit)& ent) const |
31 | { |
32 | |
33 | Standard_Integer num = num0; |
34 | |
35 | |
316ea293 |
36 | // --- Instance of plex component ConversionBasedUnit --- |
7fd59977 |
37 | |
38 | if (!data->CheckNbParams(num,2,ach,"conversion_based_unit")) return; |
39 | |
40 | // --- field : name --- |
41 | |
42 | Handle(TCollection_HAsciiString) aName; |
43 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
44 | data->ReadString (num,1,"name",ach,aName); |
45 | |
46 | // --- field : conversionFactor --- |
47 | |
48 | Handle(StepBasic_MeasureWithUnit) aConversionFactor; |
49 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
50 | data->ReadEntity(num, 2,"conversion_factor", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aConversionFactor); |
51 | |
52 | num = data->NextForComplex(num); |
53 | |
54 | // --- Instance of common supertype NamedUnit --- |
55 | |
56 | if (!data->CheckNbParams(num,1,ach,"named_unit")) return; |
57 | // --- field : dimensions --- |
58 | |
59 | |
60 | Handle(StepBasic_DimensionalExponents) aDimensions; |
61 | //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed |
62 | data->ReadEntity(num, 1,"dimensions", ach, STANDARD_TYPE(StepBasic_DimensionalExponents), aDimensions); |
63 | |
64 | num = data->NextForComplex(num); |
65 | |
316ea293 |
66 | // --- Instance of plex component TimeUnit --- |
7fd59977 |
67 | |
68 | if (!data->CheckNbParams(num,0,ach,"time_unit")) return; |
69 | |
70 | //--- Initialisation of the red entity --- |
71 | |
72 | ent->Init(aDimensions,aName,aConversionFactor); |
73 | } |
74 | |
75 | |
76 | void RWStepBasic_RWConversionBasedUnitAndTimeUnit::WriteStep |
77 | (StepData_StepWriter& SW, |
78 | const Handle(StepBasic_ConversionBasedUnitAndTimeUnit)& ent) const |
79 | { |
80 | |
316ea293 |
81 | // --- Instance of plex component ConversionBasedUnit --- |
7fd59977 |
82 | |
83 | SW.StartEntity("CONVERSION_BASED_UNIT"); |
84 | // --- field : name --- |
85 | |
86 | SW.Send(ent->Name()); |
87 | // --- field : conversionFactor --- |
88 | |
89 | SW.Send(ent->ConversionFactor()); |
90 | |
316ea293 |
91 | // --- Instance of plex component TimeUnit --- |
7fd59977 |
92 | |
93 | SW.StartEntity("TIME_UNIT"); |
94 | |
95 | // --- Instance of common supertype NamedUnit --- |
96 | |
97 | SW.StartEntity("NAMED_UNIT"); |
98 | // --- field : dimensions --- |
99 | |
100 | SW.Send(ent->Dimensions()); |
101 | } |
102 | |
103 | |
104 | void RWStepBasic_RWConversionBasedUnitAndTimeUnit::Share(const Handle(StepBasic_ConversionBasedUnitAndTimeUnit)& ent, Interface_EntityIterator& iter) const |
105 | { |
106 | |
107 | iter.GetOneItem(ent->Dimensions()); |
108 | |
109 | |
110 | iter.GetOneItem(ent->ConversionFactor()); |
111 | } |
112 | |