973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | //gka 05.03.99 S4134 upgrade from CD to DIS |
7fd59977 |
15 | |
42cf5bc1 |
16 | #include <Interface_Check.hxx> |
7fd59977 |
17 | #include <Interface_EntityIterator.hxx> |
42cf5bc1 |
18 | #include <RWStepBasic_RWOrganizationalAddress.hxx> |
19 | #include <StepBasic_HArray1OfOrganization.hxx> |
20 | #include <StepBasic_Organization.hxx> |
7fd59977 |
21 | #include <StepBasic_OrganizationalAddress.hxx> |
42cf5bc1 |
22 | #include <StepData_StepReaderData.hxx> |
23 | #include <StepData_StepWriter.hxx> |
7fd59977 |
24 | |
25 | RWStepBasic_RWOrganizationalAddress::RWStepBasic_RWOrganizationalAddress () {} |
26 | |
27 | void RWStepBasic_RWOrganizationalAddress::ReadStep |
28 | (const Handle(StepData_StepReaderData)& data, |
29 | const Standard_Integer num, |
30 | Handle(Interface_Check)& ach, |
31 | const Handle(StepBasic_OrganizationalAddress)& ent) const |
32 | { |
33 | |
34 | |
35 | // --- Number of Parameter Control --- |
36 | |
37 | if (!data->CheckNbParams(num,14,ach,"organizational_address")) return; |
38 | |
39 | // --- inherited field : internalLocation --- |
40 | |
41 | Handle(TCollection_HAsciiString) aInternalLocation; |
42 | Standard_Boolean hasAinternalLocation = Standard_True; |
43 | if (data->IsParamDefined(num,1)) { |
44 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
45 | data->ReadString (num,1,"internal_location",ach,aInternalLocation); |
46 | } |
47 | else { |
48 | hasAinternalLocation = Standard_False; |
49 | aInternalLocation.Nullify(); |
50 | } |
51 | |
52 | // --- inherited field : streetNumber --- |
53 | |
54 | Handle(TCollection_HAsciiString) aStreetNumber; |
55 | Standard_Boolean hasAstreetNumber = Standard_True; |
56 | if (data->IsParamDefined(num,2)) { |
57 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
58 | data->ReadString (num,2,"street_number",ach,aStreetNumber); |
59 | } |
60 | else { |
61 | hasAstreetNumber = Standard_False; |
62 | aStreetNumber.Nullify(); |
63 | } |
64 | |
65 | // --- inherited field : street --- |
66 | |
67 | Handle(TCollection_HAsciiString) aStreet; |
68 | Standard_Boolean hasAstreet = Standard_True; |
69 | if (data->IsParamDefined(num,3)) { |
70 | //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed |
71 | data->ReadString (num,3,"street",ach,aStreet); |
72 | } |
73 | else { |
74 | hasAstreet = Standard_False; |
75 | aStreet.Nullify(); |
76 | } |
77 | |
78 | // --- inherited field : postalBox --- |
79 | |
80 | Handle(TCollection_HAsciiString) aPostalBox; |
81 | Standard_Boolean hasApostalBox = Standard_True; |
82 | if (data->IsParamDefined(num,4)) { |
83 | //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed |
84 | data->ReadString (num,4,"postal_box",ach,aPostalBox); |
85 | } |
86 | else { |
87 | hasApostalBox = Standard_False; |
88 | aPostalBox.Nullify(); |
89 | } |
90 | |
91 | // --- inherited field : town --- |
92 | |
93 | Handle(TCollection_HAsciiString) aTown; |
94 | Standard_Boolean hasAtown = Standard_True; |
95 | if (data->IsParamDefined(num,5)) { |
96 | //szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed |
97 | data->ReadString (num,5,"town",ach,aTown); |
98 | } |
99 | else { |
100 | hasAtown = Standard_False; |
101 | aTown.Nullify(); |
102 | } |
103 | |
104 | // --- inherited field : region --- |
105 | |
106 | Handle(TCollection_HAsciiString) aRegion; |
107 | Standard_Boolean hasAregion = Standard_True; |
108 | if (data->IsParamDefined(num,6)) { |
109 | //szv#4:S4163:12Mar99 `Standard_Boolean stat6 =` not needed |
110 | data->ReadString (num,6,"region",ach,aRegion); |
111 | } |
112 | else { |
113 | hasAregion = Standard_False; |
114 | aRegion.Nullify(); |
115 | } |
116 | |
117 | // --- inherited field : postalCode --- |
118 | |
119 | Handle(TCollection_HAsciiString) aPostalCode; |
120 | Standard_Boolean hasApostalCode = Standard_True; |
121 | if (data->IsParamDefined(num,7)) { |
122 | //szv#4:S4163:12Mar99 `Standard_Boolean stat7 =` not needed |
123 | data->ReadString (num,7,"postal_code",ach,aPostalCode); |
124 | } |
125 | else { |
126 | hasApostalCode = Standard_False; |
127 | aPostalCode.Nullify(); |
128 | } |
129 | |
130 | // --- inherited field : country --- |
131 | |
132 | Handle(TCollection_HAsciiString) aCountry; |
133 | Standard_Boolean hasAcountry = Standard_True; |
134 | if (data->IsParamDefined(num,8)) { |
135 | //szv#4:S4163:12Mar99 `Standard_Boolean stat8 =` not needed |
136 | data->ReadString (num,8,"country",ach,aCountry); |
137 | } |
138 | else { |
139 | hasAcountry = Standard_False; |
140 | aCountry.Nullify(); |
141 | } |
142 | |
143 | // --- inherited field : facsimileNumber --- |
144 | |
145 | Handle(TCollection_HAsciiString) aFacsimileNumber; |
146 | Standard_Boolean hasAfacsimileNumber = Standard_True; |
147 | if (data->IsParamDefined(num,9)) { |
148 | //szv#4:S4163:12Mar99 `Standard_Boolean stat9 =` not needed |
149 | data->ReadString (num,9,"facsimile_number",ach,aFacsimileNumber); |
150 | } |
151 | else { |
152 | hasAfacsimileNumber = Standard_False; |
153 | aFacsimileNumber.Nullify(); |
154 | } |
155 | |
156 | // --- inherited field : telephoneNumber --- |
157 | |
158 | Handle(TCollection_HAsciiString) aTelephoneNumber; |
159 | Standard_Boolean hasAtelephoneNumber = Standard_True; |
160 | if (data->IsParamDefined(num,10)) { |
161 | //szv#4:S4163:12Mar99 `Standard_Boolean stat10 =` not needed |
162 | data->ReadString (num,10,"telephone_number",ach,aTelephoneNumber); |
163 | } |
164 | else { |
165 | hasAtelephoneNumber = Standard_False; |
166 | aTelephoneNumber.Nullify(); |
167 | } |
168 | |
169 | // --- inherited field : electronicMailAddress --- |
170 | |
171 | Handle(TCollection_HAsciiString) aElectronicMailAddress; |
172 | Standard_Boolean hasAelectronicMailAddress = Standard_True; |
173 | if (data->IsParamDefined(num,11)) { |
174 | //szv#4:S4163:12Mar99 `Standard_Boolean stat11 =` not needed |
175 | data->ReadString (num,11,"electronic_mail_address",ach,aElectronicMailAddress); |
176 | } |
177 | else { |
178 | hasAelectronicMailAddress = Standard_False; |
179 | aElectronicMailAddress.Nullify(); |
180 | } |
181 | |
182 | // --- inherited field : telexNumber --- |
183 | |
184 | Handle(TCollection_HAsciiString) aTelexNumber; |
185 | Standard_Boolean hasAtelexNumber = Standard_True; |
186 | if (data->IsParamDefined(num,12)) { |
187 | //szv#4:S4163:12Mar99 `Standard_Boolean stat12 =` not needed |
188 | data->ReadString (num,12,"telex_number",ach,aTelexNumber); |
189 | } |
190 | else { |
191 | hasAtelexNumber = Standard_False; |
192 | aTelexNumber.Nullify(); |
193 | } |
194 | |
195 | // --- own field : organizations --- |
196 | |
197 | Handle(StepBasic_HArray1OfOrganization) aOrganizations; |
198 | Handle(StepBasic_Organization) anent13; |
199 | Standard_Integer nsub13; |
200 | if (data->ReadSubList (num,13,"organizations",ach,nsub13)) { |
201 | Standard_Integer nb13 = data->NbParams(nsub13); |
202 | aOrganizations = new StepBasic_HArray1OfOrganization (1, nb13); |
203 | for (Standard_Integer i13 = 1; i13 <= nb13; i13 ++) { |
204 | //szv#4:S4163:12Mar99 `Standard_Boolean stat13 =` not needed |
205 | if (data->ReadEntity (nsub13, i13,"organization", ach, STANDARD_TYPE(StepBasic_Organization), anent13)) |
206 | aOrganizations->SetValue(i13, anent13); |
207 | } |
208 | } |
209 | |
210 | // --- own field : description --- |
211 | |
212 | Handle(TCollection_HAsciiString) aDescription; |
213 | if (data->IsParamDefined (num,14)) { //gka 05.03.99 S4134 upgrade from CD to DIS |
214 | //szv#4:S4163:12Mar99 `Standard_Boolean stat14 =` not needed |
215 | data->ReadString (num,14,"description",ach,aDescription); |
216 | } |
217 | //--- Initialisation of the read entity --- |
218 | |
219 | |
220 | ent->Init(hasAinternalLocation, aInternalLocation, hasAstreetNumber, aStreetNumber, hasAstreet, aStreet, hasApostalBox, aPostalBox, hasAtown, aTown, hasAregion, aRegion, hasApostalCode, aPostalCode, hasAcountry, aCountry, hasAfacsimileNumber, aFacsimileNumber, hasAtelephoneNumber, aTelephoneNumber, hasAelectronicMailAddress, aElectronicMailAddress, hasAtelexNumber, aTelexNumber, aOrganizations, aDescription); |
221 | } |
222 | |
223 | |
224 | void RWStepBasic_RWOrganizationalAddress::WriteStep |
225 | (StepData_StepWriter& SW, |
226 | const Handle(StepBasic_OrganizationalAddress)& ent) const |
227 | { |
228 | |
229 | // --- inherited field internalLocation --- |
230 | |
231 | Standard_Boolean hasAinternalLocation = ent->HasInternalLocation(); |
232 | if (hasAinternalLocation) { |
233 | SW.Send(ent->InternalLocation()); |
234 | } |
235 | else { |
236 | SW.SendUndef(); |
237 | } |
238 | |
239 | // --- inherited field streetNumber --- |
240 | |
241 | Standard_Boolean hasAstreetNumber = ent->HasStreetNumber(); |
242 | if (hasAstreetNumber) { |
243 | SW.Send(ent->StreetNumber()); |
244 | } |
245 | else { |
246 | SW.SendUndef(); |
247 | } |
248 | |
249 | // --- inherited field street --- |
250 | |
251 | Standard_Boolean hasAstreet = ent->HasStreet(); |
252 | if (hasAstreet) { |
253 | SW.Send(ent->Street()); |
254 | } |
255 | else { |
256 | SW.SendUndef(); |
257 | } |
258 | |
259 | // --- inherited field postalBox --- |
260 | |
261 | Standard_Boolean hasApostalBox = ent->HasPostalBox(); |
262 | if (hasApostalBox) { |
263 | SW.Send(ent->PostalBox()); |
264 | } |
265 | else { |
266 | SW.SendUndef(); |
267 | } |
268 | |
269 | // --- inherited field town --- |
270 | |
271 | Standard_Boolean hasAtown = ent->HasTown(); |
272 | if (hasAtown) { |
273 | SW.Send(ent->Town()); |
274 | } |
275 | else { |
276 | SW.SendUndef(); |
277 | } |
278 | |
279 | // --- inherited field region --- |
280 | |
281 | Standard_Boolean hasAregion = ent->HasRegion(); |
282 | if (hasAregion) { |
283 | SW.Send(ent->Region()); |
284 | } |
285 | else { |
286 | SW.SendUndef(); |
287 | } |
288 | |
289 | // --- inherited field postalCode --- |
290 | |
291 | Standard_Boolean hasApostalCode = ent->HasPostalCode(); |
292 | if (hasApostalCode) { |
293 | SW.Send(ent->PostalCode()); |
294 | } |
295 | else { |
296 | SW.SendUndef(); |
297 | } |
298 | |
299 | // --- inherited field country --- |
300 | |
301 | Standard_Boolean hasAcountry = ent->HasCountry(); |
302 | if (hasAcountry) { |
303 | SW.Send(ent->Country()); |
304 | } |
305 | else { |
306 | SW.SendUndef(); |
307 | } |
308 | |
309 | // --- inherited field facsimileNumber --- |
310 | |
311 | Standard_Boolean hasAfacsimileNumber = ent->HasFacsimileNumber(); |
312 | if (hasAfacsimileNumber) { |
313 | SW.Send(ent->FacsimileNumber()); |
314 | } |
315 | else { |
316 | SW.SendUndef(); |
317 | } |
318 | |
319 | // --- inherited field telephoneNumber --- |
320 | |
321 | Standard_Boolean hasAtelephoneNumber = ent->HasTelephoneNumber(); |
322 | if (hasAtelephoneNumber) { |
323 | SW.Send(ent->TelephoneNumber()); |
324 | } |
325 | else { |
326 | SW.SendUndef(); |
327 | } |
328 | |
329 | // --- inherited field electronicMailAddress --- |
330 | |
331 | Standard_Boolean hasAelectronicMailAddress = ent->HasElectronicMailAddress(); |
332 | if (hasAelectronicMailAddress) { |
333 | SW.Send(ent->ElectronicMailAddress()); |
334 | } |
335 | else { |
336 | SW.SendUndef(); |
337 | } |
338 | |
339 | // --- inherited field telexNumber --- |
340 | |
341 | Standard_Boolean hasAtelexNumber = ent->HasTelexNumber(); |
342 | if (hasAtelexNumber) { |
343 | SW.Send(ent->TelexNumber()); |
344 | } |
345 | else { |
346 | SW.SendUndef(); |
347 | } |
348 | |
349 | // --- own field : organizations --- |
350 | |
351 | SW.OpenSub(); |
352 | for (Standard_Integer i13 = 1; i13 <= ent->NbOrganizations(); i13 ++) { |
353 | SW.Send(ent->OrganizationsValue(i13)); |
354 | } |
355 | SW.CloseSub(); |
356 | |
357 | // --- own field : description --- |
358 | |
359 | SW.Send(ent->Description()); |
360 | } |
361 | |
362 | |
363 | void RWStepBasic_RWOrganizationalAddress::Share(const Handle(StepBasic_OrganizationalAddress)& ent, Interface_EntityIterator& iter) const |
364 | { |
365 | |
366 | Standard_Integer nbElem1 = ent->NbOrganizations(); |
367 | for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) { |
368 | iter.GetOneItem(ent->OrganizationsValue(is1)); |
369 | } |
370 | |
371 | } |
372 | |