7fd59977 |
1 | #include <RWStepAP214_RWAppliedDocumentReference.ixx> |
2 | |
3 | #include <StepBasic_Document.hxx> |
4 | #include <TCollection_HAsciiString.hxx> |
5 | #include <StepAP214_HArray1OfDocumentReferenceItem.hxx> |
6 | #include <StepAP214_DocumentReferenceItem.hxx> |
7 | |
8 | |
9 | RWStepAP214_RWAppliedDocumentReference::RWStepAP214_RWAppliedDocumentReference () { } |
10 | |
11 | void RWStepAP214_RWAppliedDocumentReference::ReadStep |
12 | (const Handle(StepData_StepReaderData)& data, |
13 | const Standard_Integer num, |
14 | Handle(Interface_Check)& ach, |
15 | const Handle(StepAP214_AppliedDocumentReference)& ent) const |
16 | { |
17 | // --- Number of Parameter Control --- |
18 | |
19 | if (!data->CheckNbParams(num,3,ach,"applied_document_reference")) return; |
20 | |
21 | // --- inherited field : assigned_document |
22 | |
23 | Handle(StepBasic_Document) adoc; |
24 | #ifdef DEB |
25 | Standard_Boolean stat1 = |
26 | #endif |
27 | data->ReadEntity |
28 | (num, 1,"assigned_document", ach, STANDARD_TYPE(StepBasic_Document), adoc); |
29 | |
30 | // --- inherited field : source --- |
31 | |
32 | Handle(TCollection_HAsciiString) asource; |
33 | Standard_Boolean stat2; |
34 | stat2 = data->ReadString (num,2,"source",ach,asource); |
35 | |
36 | |
37 | // --- own field : items --- |
38 | |
39 | Handle(StepAP214_HArray1OfDocumentReferenceItem) aItems; |
40 | StepAP214_DocumentReferenceItem anItem; |
41 | Standard_Integer nsub3; |
42 | if (data->ReadSubList (num,3,"items",ach,nsub3)) { |
43 | Standard_Integer nb3 = data->NbParams(nsub3); |
44 | aItems = new StepAP214_HArray1OfDocumentReferenceItem (1, nb3); |
45 | for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) { |
46 | Standard_Boolean stat3 = data->ReadEntity |
47 | (nsub3, i3,"item", ach, anItem); |
48 | if (stat3) aItems->SetValue(i3, anItem); |
49 | } |
50 | } |
51 | |
52 | //--- Initialisation of the read entity --- |
53 | |
54 | ent->Init (adoc,asource,aItems); |
55 | } |
56 | |
57 | void RWStepAP214_RWAppliedDocumentReference::WriteStep |
58 | (StepData_StepWriter& SW, |
59 | const Handle(StepAP214_AppliedDocumentReference)& ent) const |
60 | { |
61 | |
62 | // --- inherited field : assigned_document --- |
63 | |
64 | SW.Send(ent->AssignedDocument()); |
65 | |
66 | // --- inherited field : source --- |
67 | |
68 | SW.Send(ent->Source()); |
69 | |
70 | // --- own field : items --- |
71 | |
72 | SW.OpenSub(); |
73 | for (Standard_Integer i3 = 1; i3 <= ent->NbItems(); i3 ++) { |
74 | SW.Send(ent->ItemsValue(i3).Value()); |
75 | } |
76 | SW.CloseSub(); |
77 | } |
78 | |
79 | |
80 | void RWStepAP214_RWAppliedDocumentReference::Share(const Handle(StepAP214_AppliedDocumentReference)& ent, Interface_EntityIterator& iter) const |
81 | { |
82 | iter.AddItem (ent->AssignedDocument()); |
83 | for (Standard_Integer i3 = 1; i3 <= ent->NbItems(); i3 ++) |
84 | iter.AddItem (ent->ItemsValue(i3).Value()); |
85 | } |