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