0022627: Change OCCT memory management defaults
[occt.git] / src / RWStepBasic / RWStepBasic_RWDocumentRelationship.cxx
1 //gka 05.03.99 S4134 upgrade from CD to DIS
2 #include <RWStepBasic_RWDocumentRelationship.ixx>
3
4 #include <Interface_EntityIterator.hxx>
5
6
7 #include <StepBasic_DocumentRelationship.hxx>
8 #include <StepBasic_Document.hxx>
9 #include <TCollection_HAsciiString.hxx>
10
11
12 RWStepBasic_RWDocumentRelationship::RWStepBasic_RWDocumentRelationship () {}
13
14 void RWStepBasic_RWDocumentRelationship::ReadStep
15         (const Handle(StepData_StepReaderData)& data,
16          const Standard_Integer num,
17          Handle(Interface_Check)& ach,
18          const Handle(StepBasic_DocumentRelationship)& ent) const
19 {
20
21
22         // --- Number of Parameter Control ---
23
24         if (!data->CheckNbParams(num,4,ach,"document_relationship")) return;
25
26         // --- own field : name ---
27
28         Handle(TCollection_HAsciiString) aName;
29         //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
30         data->ReadString (num,1,"name",ach,aName);
31
32         // --- own field : description ---
33
34         Handle(TCollection_HAsciiString) aDescr;
35         if (data->IsParamDefined (num,2)) { //gka 05.03.99 S4134 upgrade from CD to DIS
36           //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
37           data->ReadString (num,2,"description",ach,aDescr);
38         }
39         // --- own field : relating ---
40
41         Handle(StepBasic_Document) aRelating;
42         //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
43         data->ReadEntity (num, 3,"relating_document", ach, STANDARD_TYPE(StepBasic_Document), aRelating);
44
45         // --- own field : related ---
46
47         Handle(StepBasic_Document) aRelated;
48         //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed
49         data->ReadEntity (num, 4,"related_document", ach, STANDARD_TYPE(StepBasic_Document), aRelated);
50
51         //--- Initialisation of the read entity ---
52
53
54         ent->Init(aName, aDescr, aRelating,aRelated);
55 }
56
57
58 void RWStepBasic_RWDocumentRelationship::WriteStep
59         (StepData_StepWriter& SW,
60          const Handle(StepBasic_DocumentRelationship)& ent) const
61 {
62
63         // --- own field : name ---
64
65         SW.Send(ent->Name());
66
67         // --- own field : description ---
68
69         SW.Send(ent->Description());
70
71         // --- own field : kind ---
72
73         SW.Send(ent->RelatingDocument());
74         SW.Send(ent->RelatedDocument());
75 }
76
77
78 void RWStepBasic_RWDocumentRelationship::Share(const Handle(StepBasic_DocumentRelationship)& ent, Interface_EntityIterator& iter) const
79 {
80
81         iter.AddItem(ent->RelatingDocument());
82         iter.AddItem(ent->RelatedDocument());
83
84 }
85