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. |
b311480e |
13 | |
42cf5bc1 |
14 | |
15 | #include <Interface_Check.hxx> |
16 | #include <Interface_EntityIterator.hxx> |
17 | #include <RWStepShape_RWMeasureQualification.hxx> |
7fd59977 |
18 | #include <StepBasic_MeasureWithUnit.hxx> |
42cf5bc1 |
19 | #include <StepData_StepReaderData.hxx> |
20 | #include <StepData_StepWriter.hxx> |
7fd59977 |
21 | #include <StepShape_HArray1OfValueQualifier.hxx> |
42cf5bc1 |
22 | #include <StepShape_MeasureQualification.hxx> |
23 | #include <StepShape_ValueQualifier.hxx> |
24 | #include <TCollection_HAsciiString.hxx> |
7fd59977 |
25 | |
26 | RWStepShape_RWMeasureQualification::RWStepShape_RWMeasureQualification () {} |
27 | |
28 | void RWStepShape_RWMeasureQualification::ReadStep |
29 | (const Handle(StepData_StepReaderData)& data, |
30 | const Standard_Integer num, |
31 | Handle(Interface_Check)& ach, |
32 | const Handle(StepShape_MeasureQualification)& ent) const |
33 | { |
34 | |
35 | |
36 | // --- Number of Parameter Control --- |
37 | |
38 | if (!data->CheckNbParams(num,4,ach,"measure_qualification")) return; |
39 | |
40 | // --- own field : name --- |
41 | |
42 | Handle(TCollection_HAsciiString) aName; |
43 | data->ReadString (num,1,"name",ach,aName); |
44 | |
45 | // --- own field : description --- |
46 | |
47 | Handle(TCollection_HAsciiString) aDescr; |
48 | data->ReadString (num,2,"description",ach,aDescr); |
49 | |
50 | // --- own field : qualified_measure --- |
51 | |
52 | Handle(StepBasic_MeasureWithUnit) aQM; |
53 | data->ReadEntity (num,3,"qualified_measure",ach, |
54 | STANDARD_TYPE(StepBasic_MeasureWithUnit),aQM); |
55 | |
56 | // --- own field : qualifiers --- |
57 | |
58 | Handle(StepShape_HArray1OfValueQualifier) quals; |
59 | Standard_Integer nsub4; |
60 | if (data->ReadSubList (num,4,"qualifiers",ach,nsub4)) { |
61 | Standard_Integer nb4 = data->NbParams(nsub4); |
62 | quals = new StepShape_HArray1OfValueQualifier (1,nb4); |
63 | for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) { |
64 | StepShape_ValueQualifier VQ; |
65 | if (data->ReadEntity (nsub4,i4,"qualifier",ach,VQ)) |
66 | quals->SetValue (i4,VQ); |
67 | } |
68 | } |
69 | |
70 | //--- Initialisation of the read entity --- |
71 | |
72 | ent->Init(aName, aDescr, aQM, quals); |
73 | } |
74 | |
75 | |
76 | void RWStepShape_RWMeasureQualification::WriteStep |
77 | (StepData_StepWriter& SW, |
78 | const Handle(StepShape_MeasureQualification)& ent) const |
79 | { |
80 | SW.Send(ent->Name()); |
81 | SW.Send(ent->Description()); |
82 | SW.Send(ent->QualifiedMeasure()); |
83 | Standard_Integer i, nbq = ent->NbQualifiers(); |
84 | SW.OpenSub(); |
85 | for (i = 1; i <= nbq; i ++) SW.Send (ent->QualifiersValue(i).Value()); |
86 | SW.CloseSub(); |
87 | } |
88 | |
89 | |
90 | void RWStepShape_RWMeasureQualification::Share(const Handle(StepShape_MeasureQualification)& ent, Interface_EntityIterator& iter) const |
91 | { |
92 | Standard_Integer i, nbq = ent->NbQualifiers(); |
93 | for (i = 1; i <= nbq; i ++) iter.AddItem (ent->QualifiersValue(i).Value()); |
94 | } |
95 | |