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 | |
14 | #include <RWStepBasic_RWMeasureWithUnit.ixx> |
15 | #include <StepBasic_NamedUnit.hxx> |
16 | #include <StepBasic_MeasureValueMember.hxx> |
17 | |
18 | |
19 | #include <Interface_EntityIterator.hxx> |
20 | |
21 | |
22 | #include <StepBasic_MeasureWithUnit.hxx> |
23 | |
24 | |
25 | //======================================================================= |
26 | //function : RWStepBasic_RWMeasureWithUnit |
27 | //purpose : |
28 | //======================================================================= |
29 | |
30 | RWStepBasic_RWMeasureWithUnit::RWStepBasic_RWMeasureWithUnit () {} |
31 | |
32 | //======================================================================= |
33 | //function : ReadStep |
34 | //purpose : |
35 | //======================================================================= |
36 | |
37 | void RWStepBasic_RWMeasureWithUnit::ReadStep (const Handle(StepData_StepReaderData)& data, |
38 | const Standard_Integer num, |
39 | Handle(Interface_Check)& ach, |
40 | const Handle(StepBasic_MeasureWithUnit)& ent) const |
41 | { |
42 | // --- Number of Parameter Control --- |
43 | if (!data->CheckNbParams(num,2,ach,"measure_with_unit")) return; |
44 | |
45 | // --- own field : valueComponent --- |
46 | Handle(StepBasic_MeasureValueMember) mvc = new StepBasic_MeasureValueMember; |
47 | data->ReadMember (num,1, "value_component", ach, mvc); |
48 | |
49 | // --- own field : unitComponent --- |
50 | StepBasic_Unit aUnitComponent; |
51 | data->ReadEntity(num, 2,"unit_component", ach, aUnitComponent); |
52 | |
53 | //--- Initialisation of the read entity --- |
54 | ent->Init(mvc, aUnitComponent); |
55 | } |
56 | |
57 | |
58 | //======================================================================= |
59 | //function : WriteStep |
60 | //purpose : |
61 | //======================================================================= |
62 | |
63 | void RWStepBasic_RWMeasureWithUnit::WriteStep (StepData_StepWriter& SW, |
64 | const Handle(StepBasic_MeasureWithUnit)& ent) const |
65 | { |
66 | // --- own field : valueComponent --- |
67 | SW.Send(ent->ValueComponentMember()); |
68 | |
69 | // --- own field : unitComponent --- |
70 | SW.Send(ent->UnitComponent().Value()); |
71 | } |
72 | |
73 | //======================================================================= |
74 | //function : Share |
75 | //purpose : |
76 | //======================================================================= |
77 | |
78 | void RWStepBasic_RWMeasureWithUnit::Share (const Handle(StepBasic_MeasureWithUnit)& ent, |
79 | Interface_EntityIterator& iter) const |
80 | { |
81 | |
82 | iter.AddItem(ent->UnitComponent().Value()); |
83 | } |
84 | |