7fd59977 |
1 | |
2 | #include <RWStepBasic_RWPerson.ixx> |
3 | #include <Interface_HArray1OfHAsciiString.hxx> |
4 | |
5 | |
6 | RWStepBasic_RWPerson::RWStepBasic_RWPerson () {} |
7 | |
8 | void RWStepBasic_RWPerson::ReadStep |
9 | (const Handle(StepData_StepReaderData)& data, |
10 | const Standard_Integer num, |
11 | Handle(Interface_Check)& ach, |
12 | const Handle(StepBasic_Person)& ent) const |
13 | { |
14 | |
15 | |
16 | // --- Number of Parameter Control --- |
17 | |
18 | if (!data->CheckNbParams(num,6,ach,"person")) return; |
19 | |
20 | // --- own field : id --- |
21 | |
22 | Handle(TCollection_HAsciiString) aId; |
23 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
24 | data->ReadString (num,1,"id",ach,aId); |
25 | |
26 | // --- own field : lastName --- |
27 | |
28 | Handle(TCollection_HAsciiString) aLastName; |
29 | Standard_Boolean hasAlastName = Standard_True; |
30 | if (data->IsParamDefined(num,2)) { |
31 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
32 | data->ReadString (num,2,"last_name",ach,aLastName); |
33 | } |
34 | else { |
35 | hasAlastName = Standard_False; |
36 | aLastName.Nullify(); |
37 | } |
38 | |
39 | // --- own field : firstName --- |
40 | |
41 | Handle(TCollection_HAsciiString) aFirstName; |
42 | Standard_Boolean hasAfirstName = Standard_True; |
43 | if (data->IsParamDefined(num,3)) { |
44 | //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed |
45 | data->ReadString (num,3,"first_name",ach,aFirstName); |
46 | } |
47 | else { |
48 | hasAfirstName = Standard_False; |
49 | aFirstName.Nullify(); |
50 | } |
51 | |
52 | // --- own field : middleNames --- |
53 | |
54 | Handle(Interface_HArray1OfHAsciiString) aMiddleNames; |
55 | Standard_Boolean hasAmiddleNames = Standard_True; |
56 | if (data->IsParamDefined(num,4)) { |
57 | Handle(TCollection_HAsciiString) aMiddleNamesItem; |
58 | Standard_Integer nsub4; |
59 | if (data->ReadSubList (num,4,"middle_names",ach,nsub4)) { |
60 | Standard_Integer nb4 = data->NbParams(nsub4); |
61 | aMiddleNames = new Interface_HArray1OfHAsciiString (1, nb4); |
62 | for (Standard_Integer i4 = 1; i4 <= nb4; i4 ++) { |
63 | //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed |
64 | if (data->ReadString (nsub4,i4,"middle_names",ach,aMiddleNamesItem)) |
65 | aMiddleNames->SetValue(i4,aMiddleNamesItem); |
66 | } |
67 | } |
68 | } |
69 | else { |
70 | hasAmiddleNames = Standard_False; |
71 | aMiddleNames.Nullify(); |
72 | } |
73 | |
74 | // --- own field : prefixTitles --- |
75 | |
76 | Handle(Interface_HArray1OfHAsciiString) aPrefixTitles; |
77 | Standard_Boolean hasAprefixTitles = Standard_True; |
78 | if (data->IsParamDefined(num,5)) { |
79 | Handle(TCollection_HAsciiString) aPrefixTitlesItem; |
80 | Standard_Integer nsub5; |
81 | if (data->ReadSubList (num,5,"prefix_titles",ach,nsub5)) { |
82 | Standard_Integer nb5 = data->NbParams(nsub5); |
83 | aPrefixTitles = new Interface_HArray1OfHAsciiString (1, nb5); |
84 | for (Standard_Integer i5 = 1; i5 <= nb5; i5 ++) { |
85 | //szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed |
86 | if (data->ReadString (nsub5,i5,"prefix_titles",ach,aPrefixTitlesItem)) |
87 | aPrefixTitles->SetValue(i5,aPrefixTitlesItem); |
88 | } |
89 | } |
90 | } |
91 | else { |
92 | hasAprefixTitles = Standard_False; |
93 | aPrefixTitles.Nullify(); |
94 | } |
95 | |
96 | // --- own field : suffixTitles --- |
97 | |
98 | Handle(Interface_HArray1OfHAsciiString) aSuffixTitles; |
99 | Standard_Boolean hasAsuffixTitles = Standard_True; |
100 | if (data->IsParamDefined(num,6)) { |
101 | Handle(TCollection_HAsciiString) aSuffixTitlesItem; |
102 | Standard_Integer nsub6; |
103 | if (data->ReadSubList (num,6,"suffix_titles",ach,nsub6)) { |
104 | Standard_Integer nb6 = data->NbParams(nsub6); |
105 | aSuffixTitles = new Interface_HArray1OfHAsciiString (1, nb6); |
106 | for (Standard_Integer i6 = 1; i6 <= nb6; i6 ++) { |
107 | //szv#4:S4163:12Mar99 `Standard_Boolean stat6 =` not needed |
108 | if (data->ReadString (nsub6,i6,"suffix_titles",ach,aSuffixTitlesItem)) |
109 | aSuffixTitles->SetValue(i6,aSuffixTitlesItem); |
110 | } |
111 | } |
112 | } |
113 | else { |
114 | hasAsuffixTitles = Standard_False; |
115 | aSuffixTitles.Nullify(); |
116 | } |
117 | |
118 | //--- Initialisation of the read entity --- |
119 | |
120 | |
121 | ent->Init(aId, hasAlastName, aLastName, hasAfirstName, aFirstName, hasAmiddleNames, aMiddleNames, hasAprefixTitles, aPrefixTitles, hasAsuffixTitles, aSuffixTitles); |
122 | } |
123 | |
124 | |
125 | void RWStepBasic_RWPerson::WriteStep |
126 | (StepData_StepWriter& SW, |
127 | const Handle(StepBasic_Person)& ent) const |
128 | { |
129 | |
130 | // --- own field : id --- |
131 | |
132 | SW.Send(ent->Id()); |
133 | |
134 | // --- own field : lastName --- |
135 | |
136 | Standard_Boolean hasAlastName = ent->HasLastName(); |
137 | if (hasAlastName) { |
138 | SW.Send(ent->LastName()); |
139 | } |
140 | else { |
141 | SW.SendUndef(); |
142 | } |
143 | |
144 | // --- own field : firstName --- |
145 | |
146 | Standard_Boolean hasAfirstName = ent->HasFirstName(); |
147 | if (hasAfirstName) { |
148 | SW.Send(ent->FirstName()); |
149 | } |
150 | else { |
151 | SW.SendUndef(); |
152 | } |
153 | |
154 | // --- own field : middleNames --- |
155 | |
156 | Standard_Boolean hasAmiddleNames = ent->HasMiddleNames(); |
157 | if (hasAmiddleNames) { |
158 | SW.OpenSub(); |
159 | for (Standard_Integer i4 = 1; i4 <= ent->NbMiddleNames(); i4 ++) { |
160 | SW.Send(ent->MiddleNamesValue(i4)); |
161 | } |
162 | SW.CloseSub(); |
163 | } |
164 | else { |
165 | SW.SendUndef(); |
166 | } |
167 | |
168 | // --- own field : prefixTitles --- |
169 | |
170 | Standard_Boolean hasAprefixTitles = ent->HasPrefixTitles(); |
171 | if (hasAprefixTitles) { |
172 | SW.OpenSub(); |
173 | for (Standard_Integer i5 = 1; i5 <= ent->NbPrefixTitles(); i5 ++) { |
174 | SW.Send(ent->PrefixTitlesValue(i5)); |
175 | } |
176 | SW.CloseSub(); |
177 | } |
178 | else { |
179 | SW.SendUndef(); |
180 | } |
181 | |
182 | // --- own field : suffixTitles --- |
183 | |
184 | Standard_Boolean hasAsuffixTitles = ent->HasSuffixTitles(); |
185 | if (hasAsuffixTitles) { |
186 | SW.OpenSub(); |
187 | for (Standard_Integer i6 = 1; i6 <= ent->NbSuffixTitles(); i6 ++) { |
188 | SW.Send(ent->SuffixTitlesValue(i6)); |
189 | } |
190 | SW.CloseSub(); |
191 | } |
192 | else { |
193 | SW.SendUndef(); |
194 | } |
195 | } |