0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / RWStepBasic / RWStepBasic_RWMeasureWithUnit.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepBasic_RWMeasureWithUnit.hxx>
18 #include <StepBasic_MeasureValueMember.hxx>
19 #include <StepBasic_MeasureWithUnit.hxx>
20 #include <StepBasic_NamedUnit.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23
24 //=======================================================================
25 //function : RWStepBasic_RWMeasureWithUnit
26 //purpose  : 
27 //=======================================================================
28 RWStepBasic_RWMeasureWithUnit::RWStepBasic_RWMeasureWithUnit () {}
29
30 //=======================================================================
31 //function : ReadStep
32 //purpose  : 
33 //=======================================================================
34
35 void RWStepBasic_RWMeasureWithUnit::ReadStep (const Handle(StepData_StepReaderData)& data,
36                                               const Standard_Integer num,
37                                               Handle(Interface_Check)& ach,
38                                               const Handle(StepBasic_MeasureWithUnit)& ent) const
39 {
40   // --- Number of Parameter Control ---
41   if (!data->CheckNbParams(num,2,ach,"measure_with_unit")) return;
42
43   // --- own field : valueComponent ---
44   Handle(StepBasic_MeasureValueMember) mvc = new StepBasic_MeasureValueMember;
45   data->ReadMember (num,1, "value_component", ach, mvc);
46
47   // --- own field : unitComponent ---
48   StepBasic_Unit aUnitComponent;
49   data->ReadEntity(num, 2,"unit_component", ach, aUnitComponent);
50
51   //--- Initialisation of the read entity ---
52   ent->Init(mvc, aUnitComponent);
53 }
54
55
56 //=======================================================================
57 //function : WriteStep
58 //purpose  : 
59 //=======================================================================
60
61 void RWStepBasic_RWMeasureWithUnit::WriteStep (StepData_StepWriter& SW,
62                                                const Handle(StepBasic_MeasureWithUnit)& ent) const
63 {
64   // --- own field : valueComponent ---
65   SW.Send(ent->ValueComponentMember());
66
67   // --- own field : unitComponent ---
68   SW.Send(ent->UnitComponent().Value());
69 }
70
71 //=======================================================================
72 //function : Share
73 //purpose  : 
74 //=======================================================================
75
76 void RWStepBasic_RWMeasureWithUnit::Share (const Handle(StepBasic_MeasureWithUnit)& ent, 
77                                            Interface_EntityIterator& iter) const
78 {
79
80   iter.AddItem(ent->UnitComponent().Value());
81 }
82