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