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