1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepAP214_RWAppliedDateAssignment.hxx>
18 #include <StepAP214_AppliedDateAssignment.hxx>
19 #include <StepAP214_DateItem.hxx>
20 #include <StepAP214_HArray1OfDateItem.hxx>
21 #include <StepBasic_Date.hxx>
22 #include <StepBasic_DateRole.hxx>
23 #include <StepData_StepReaderData.hxx>
24 #include <StepData_StepWriter.hxx>
25
RWStepAP214_RWAppliedDateAssignment()26 RWStepAP214_RWAppliedDateAssignment::RWStepAP214_RWAppliedDateAssignment () {}
27
ReadStep(const Handle (StepData_StepReaderData)& data,const Standard_Integer num,Handle (Interface_Check)& ach,const Handle (StepAP214_AppliedDateAssignment)& ent) const28 void RWStepAP214_RWAppliedDateAssignment::ReadStep
29 (const Handle(StepData_StepReaderData)& data,
30 const Standard_Integer num,
31 Handle(Interface_Check)& ach,
32 const Handle(StepAP214_AppliedDateAssignment)& ent) const
33 {
34
35
36 // --- Number of Parameter Control ---
37
38 if (!data->CheckNbParams(num,3,ach,"applied_date_assignment")) return;
39
40 // --- inherited field : assignedDate ---
41
42 Handle(StepBasic_Date) aAssignedDate;
43 data->ReadEntity(num, 1,"assigned_date", ach, STANDARD_TYPE(StepBasic_Date), aAssignedDate);
44
45 // --- inherited field : role ---
46
47 Handle(StepBasic_DateRole) aRole;
48 data->ReadEntity(num, 2,"role", ach, STANDARD_TYPE(StepBasic_DateRole), aRole);
49
50 // --- own field : items ---
51
52 Handle(StepAP214_HArray1OfDateItem) aItems;
53 StepAP214_DateItem aItemsItem;
54 Standard_Integer nsub3;
55 if (data->ReadSubList(num,3,"items",ach,nsub3)) {
56 Standard_Integer nb3 = data->NbParams(nsub3);
57 aItems = new StepAP214_HArray1OfDateItem (1, nb3);
58 for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
59 Standard_Boolean stat3 = data->ReadEntity
60 (nsub3,i3,"items",ach,aItemsItem);
61 if (stat3) aItems->SetValue(i3,aItemsItem);
62 }
63 }
64
65 //--- Initialisation of the read entity ---
66
67
68 ent->Init(aAssignedDate, aRole, aItems);
69 }
70
71
WriteStep(StepData_StepWriter & SW,const Handle (StepAP214_AppliedDateAssignment)& ent) const72 void RWStepAP214_RWAppliedDateAssignment::WriteStep
73 (StepData_StepWriter& SW,
74 const Handle(StepAP214_AppliedDateAssignment)& ent) const
75 {
76
77 // --- inherited field assignedDate ---
78
79 SW.Send(ent->AssignedDate());
80
81 // --- inherited field role ---
82
83 SW.Send(ent->Role());
84
85 // --- own field : items ---
86
87 SW.OpenSub();
88 for (Standard_Integer i3 = 1; i3 <= ent->NbItems(); i3 ++) {
89 SW.Send(ent->ItemsValue(i3).Value());
90 }
91 SW.CloseSub();
92 }
93
94
Share(const Handle (StepAP214_AppliedDateAssignment)& ent,Interface_EntityIterator & iter) const95 void RWStepAP214_RWAppliedDateAssignment::Share(const Handle(StepAP214_AppliedDateAssignment)& ent, Interface_EntityIterator& iter) const
96 {
97
98 iter.GetOneItem(ent->AssignedDate());
99 iter.GetOneItem(ent->Role());
100 Standard_Integer nbElem3 = ent->NbItems();
101 for (Standard_Integer is3=1; is3<=nbElem3; is3 ++) {
102 iter.GetOneItem(ent->ItemsValue(is3).Value());
103 }
104
105 }
106
107