3aa2513b4ece527c221b50ca461b5e2dff4bf088
[occt.git] / src / RWStepAP214 / RWStepAP214_RWAutoDesignActualDateAssignment.cxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18
19 #include <RWStepAP214_RWAutoDesignActualDateAssignment.ixx>
20 #include <StepAP214_HArray1OfAutoDesignDatedItem.hxx>
21 #include <StepAP214_AutoDesignDatedItem.hxx>
22 #include <StepBasic_Date.hxx>
23 #include <StepBasic_DateRole.hxx>
24
25
26 #include <Interface_EntityIterator.hxx>
27
28
29 #include <StepAP214_AutoDesignActualDateAssignment.hxx>
30
31
32 RWStepAP214_RWAutoDesignActualDateAssignment::RWStepAP214_RWAutoDesignActualDateAssignment () {}
33
34 void RWStepAP214_RWAutoDesignActualDateAssignment::ReadStep
35         (const Handle(StepData_StepReaderData)& data,
36          const Standard_Integer num,
37          Handle(Interface_Check)& ach,
38          const Handle(StepAP214_AutoDesignActualDateAssignment)& ent) const
39 {
40
41
42         // --- Number of Parameter Control ---
43
44         if (!data->CheckNbParams(num,3,ach,"auto_design_actual_date_assignment")) return;
45
46         // --- inherited field : assignedDate ---
47
48         Handle(StepBasic_Date) aAssignedDate;
49 #ifdef DEB
50         Standard_Boolean stat1 = 
51 #endif
52           data->ReadEntity(num, 1,"assigned_date", ach, STANDARD_TYPE(StepBasic_Date), aAssignedDate);
53
54         // --- inherited field : role ---
55
56         Handle(StepBasic_DateRole) aRole;
57 #ifdef DEB
58         Standard_Boolean stat2 = 
59 #endif
60           data->ReadEntity(num, 2,"role", ach, STANDARD_TYPE(StepBasic_DateRole), aRole);
61
62         // --- own field : items ---
63
64         Handle(StepAP214_HArray1OfAutoDesignDatedItem) aItems;
65         StepAP214_AutoDesignDatedItem aItemsItem;
66         Standard_Integer nsub3;
67         if (data->ReadSubList(num,3,"items",ach,nsub3)) {
68           Standard_Integer nb3 = data->NbParams(nsub3);
69           aItems = new StepAP214_HArray1OfAutoDesignDatedItem (1, nb3);
70           for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
71             Standard_Boolean stat3 = data->ReadEntity
72                  (nsub3,i3,"items",ach,aItemsItem);
73             if (stat3) aItems->SetValue(i3,aItemsItem);
74           }
75         }
76
77         //--- Initialisation of the read entity ---
78
79
80         ent->Init(aAssignedDate, aRole, aItems);
81 }
82
83
84 void RWStepAP214_RWAutoDesignActualDateAssignment::WriteStep
85         (StepData_StepWriter& SW,
86          const Handle(StepAP214_AutoDesignActualDateAssignment)& ent) const
87 {
88
89         // --- inherited field assignedDate ---
90
91         SW.Send(ent->AssignedDate());
92
93         // --- inherited field role ---
94
95         SW.Send(ent->Role());
96
97         // --- own field : items ---
98
99         SW.OpenSub();
100         for (Standard_Integer i3 = 1;  i3 <= ent->NbItems();  i3 ++) {
101           SW.Send(ent->ItemsValue(i3).Value());
102         }
103         SW.CloseSub();
104 }
105
106
107 void RWStepAP214_RWAutoDesignActualDateAssignment::Share(const Handle(StepAP214_AutoDesignActualDateAssignment)& ent, Interface_EntityIterator& iter) const
108 {
109
110         iter.GetOneItem(ent->AssignedDate());
111
112
113         iter.GetOneItem(ent->Role());
114
115
116         Standard_Integer nbElem3 = ent->NbItems();
117         for (Standard_Integer is3=1; is3<=nbElem3; is3 ++) {
118           iter.GetOneItem(ent->ItemsValue(is3).Value());
119         }
120
121 }
122