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 | |
42cf5bc1 |
15 | #include <Interface_Check.hxx> |
7fd59977 |
16 | #include <Interface_EntityIterator.hxx> |
42cf5bc1 |
17 | #include <RWStepBasic_RWLengthMeasureWithUnit.hxx> |
7fd59977 |
18 | #include <StepBasic_LengthMeasureWithUnit.hxx> |
42cf5bc1 |
19 | #include <StepBasic_MeasureValueMember.hxx> |
20 | #include <StepBasic_NamedUnit.hxx> |
21 | #include <StepData_StepReaderData.hxx> |
22 | #include <StepData_StepWriter.hxx> |
23 | #include <TCollection_AsciiString.hxx> |
7fd59977 |
24 | |
25 | //======================================================================= |
26 | //function : RWStepBasic_RWLengthMeasureWithUnit |
27 | //purpose : |
28 | //======================================================================= |
7fd59977 |
29 | RWStepBasic_RWLengthMeasureWithUnit::RWStepBasic_RWLengthMeasureWithUnit () {} |
30 | |
31 | //======================================================================= |
32 | //function : ReadStep |
33 | //purpose : |
34 | //======================================================================= |
35 | |
36 | void RWStepBasic_RWLengthMeasureWithUnit::ReadStep (const Handle(StepData_StepReaderData)& data, |
37 | const Standard_Integer num, |
38 | Handle(Interface_Check)& ach, |
39 | const Handle(StepBasic_LengthMeasureWithUnit)& ent) const |
40 | { |
41 | // --- Number of Parameter Control --- |
42 | if (!data->CheckNbParams(num,2,ach,"length_measure_with_unit")) return; |
43 | |
44 | // --- inherited field : valueComponent --- |
45 | // --- Update 12-02-96 by FMA , 31-MARS-1997 by CKY |
46 | Handle(StepBasic_MeasureValueMember) mvc = new StepBasic_MeasureValueMember; |
47 | data->ReadMember (num,1, "value_component", ach, mvc); |
48 | |
49 | // --- inherited 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 | //function : WriteStep |
59 | //purpose : |
60 | //======================================================================= |
61 | |
62 | void RWStepBasic_RWLengthMeasureWithUnit::WriteStep (StepData_StepWriter& SW, |
63 | const Handle(StepBasic_LengthMeasureWithUnit)& ent) const |
64 | { |
65 | |
66 | // --- inherited field valueComponent --- |
67 | SW.Send(ent->ValueComponentMember()); |
68 | |
69 | // --- inherited field unitComponent --- |
70 | SW.Send(ent->UnitComponent().Value()); |
71 | } |
72 | |
73 | |
74 | //======================================================================= |
75 | //function : Share |
76 | //purpose : |
77 | //======================================================================= |
78 | |
79 | void RWStepBasic_RWLengthMeasureWithUnit::Share (const Handle(StepBasic_LengthMeasureWithUnit)& ent, |
80 | Interface_EntityIterator& iter) const |
81 | { |
82 | |
83 | iter.GetOneItem(ent->UnitComponent().Value()); |
84 | } |
85 | |