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_RWProductDefinitionWithAssociatedDocuments.hxx> |
18 | #include <StepBasic_Document.hxx> |
19 | #include <StepBasic_HArray1OfDocument.hxx> |
20 | #include <StepBasic_ProductDefinitionContext.hxx> |
ec357c5c |
21 | #include <StepBasic_ProductDefinitionFormation.hxx> |
42cf5bc1 |
22 | #include <StepBasic_ProductDefinitionWithAssociatedDocuments.hxx> |
23 | #include <StepData_StepReaderData.hxx> |
24 | #include <StepData_StepWriter.hxx> |
7fd59977 |
25 | |
26 | RWStepBasic_RWProductDefinitionWithAssociatedDocuments::RWStepBasic_RWProductDefinitionWithAssociatedDocuments () {} |
27 | |
28 | void RWStepBasic_RWProductDefinitionWithAssociatedDocuments::ReadStep |
29 | (const Handle(StepData_StepReaderData)& data, |
30 | const Standard_Integer num, |
31 | Handle(Interface_Check)& ach, |
32 | const Handle(StepBasic_ProductDefinitionWithAssociatedDocuments)& ent) const |
33 | { |
34 | |
35 | |
36 | // --- Number of Parameter Control --- |
37 | |
38 | if (!data->CheckNbParams(num,5,ach,"product_definition")) return; |
39 | |
40 | // --- inherited field : id --- |
41 | |
42 | Handle(TCollection_HAsciiString) aId; |
43 | //szv#4:S4163:12Mar `99Standard_Boolean stat1 =` not needed |
44 | data->ReadString (num,1,"id",ach,aId); |
45 | |
46 | // --- inherited field : description --- |
47 | |
48 | Handle(TCollection_HAsciiString) aDescription; |
49 | //szv#4:S4163:12Mar `99Standard_Boolean stat2 =` not needed |
50 | data->ReadString (num,2,"description",ach,aDescription); |
51 | |
52 | // --- inherited field : formation --- |
53 | |
54 | Handle(StepBasic_ProductDefinitionFormation) aFormation; |
55 | //szv#4:S4163:12Mar `99Standard_Boolean stat3 =` not needed |
56 | data->ReadEntity(num, 3,"formation", ach, STANDARD_TYPE(StepBasic_ProductDefinitionFormation), aFormation); |
57 | |
58 | // --- inherited field : frameOfReference --- |
59 | |
60 | Handle(StepBasic_ProductDefinitionContext) aFrameOfReference; |
61 | //szv#4:S4163:12Mar `99Standard_Boolean stat4 =` not needed |
62 | data->ReadEntity(num, 4,"frame_of_reference", ach, STANDARD_TYPE(StepBasic_ProductDefinitionContext), aFrameOfReference); |
63 | |
64 | // --- own field : doc_ids --- |
65 | |
66 | Handle(StepBasic_HArray1OfDocument) aDocIds; |
67 | Handle(StepBasic_Document) anent5; |
68 | Standard_Integer nsub5; |
69 | if (data->ReadSubList (num,5,"frame_of_reference",ach,nsub5)) { |
70 | Standard_Integer nb5 = data->NbParams(nsub5); |
71 | if (nb5 > 0) aDocIds = new StepBasic_HArray1OfDocument (1, nb5); |
72 | for (Standard_Integer i5 = 1; i5 <= nb5; i5 ++) { |
73 | //szv#4:S4163:12Mar `99Standard_Boolean stat5 =` not needed |
74 | if (data->ReadEntity (nsub5, i5,"product_context", ach, STANDARD_TYPE(StepBasic_Document), anent5)) |
75 | aDocIds->SetValue(i5, anent5); |
76 | } |
77 | } |
78 | |
79 | //--- Initialisation of the read entity --- |
80 | |
81 | ent->Init(aId, aDescription, aFormation, aFrameOfReference, aDocIds); |
82 | } |
83 | |
84 | |
85 | void RWStepBasic_RWProductDefinitionWithAssociatedDocuments::WriteStep |
86 | (StepData_StepWriter& SW, |
87 | const Handle(StepBasic_ProductDefinitionWithAssociatedDocuments)& ent) const |
88 | { |
89 | |
90 | // --- inherited field : id --- |
91 | |
92 | SW.Send(ent->Id()); |
93 | |
94 | // --- inherited field : description --- |
95 | |
96 | SW.Send(ent->Description()); |
97 | |
98 | // --- inherited field : formation --- |
99 | |
100 | SW.Send(ent->Formation()); |
101 | |
102 | // --- inherited field : DocIds --- |
103 | |
104 | SW.Send(ent->FrameOfReference()); |
105 | |
106 | // -- own : list |
107 | |
108 | SW.OpenSub(); |
109 | Standard_Integer i,nb = ent->NbDocIds(); |
110 | for (i = 1; i <= nb; i ++) SW.Send (ent->DocIdsValue(i)); |
111 | SW.CloseSub(); |
112 | |
113 | } |
114 | |
115 | |
116 | void RWStepBasic_RWProductDefinitionWithAssociatedDocuments::Share(const Handle(StepBasic_ProductDefinitionWithAssociatedDocuments)& ent, Interface_EntityIterator& iter) const |
117 | { |
118 | |
119 | iter.GetOneItem(ent->Formation()); |
120 | |
121 | |
122 | iter.GetOneItem(ent->FrameOfReference()); |
123 | |
124 | Standard_Integer i,nb = ent->NbDocIds(); |
125 | for (i = 1; i <= nb; i ++) iter.AddItem (ent->DocIdsValue(i)); |
126 | } |