0023258: Missing parenthesis
[occt.git] / src / IGESGeom / IGESGeom_ReadWriteModule.cxx
CommitLineData
b311480e 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
7fd59977 18#include <IGESGeom_ReadWriteModule.ixx>
19#include <Interface_Macros.hxx>
20
21#include <IGESGeom_BSplineCurve.hxx>
22#include <IGESGeom_BSplineSurface.hxx>
23#include <IGESGeom_Boundary.hxx>
24#include <IGESGeom_BoundedSurface.hxx>
25#include <IGESGeom_CircularArc.hxx>
26#include <IGESGeom_CompositeCurve.hxx>
27#include <IGESGeom_ConicArc.hxx>
28#include <IGESGeom_CopiousData.hxx>
29#include <IGESGeom_CurveOnSurface.hxx>
30#include <IGESGeom_Direction.hxx>
31#include <IGESGeom_Flash.hxx>
32#include <IGESGeom_Line.hxx>
33#include <IGESGeom_OffsetCurve.hxx>
34#include <IGESGeom_OffsetSurface.hxx>
35#include <IGESGeom_Plane.hxx>
36#include <IGESGeom_Point.hxx>
37#include <IGESGeom_RuledSurface.hxx>
38#include <IGESGeom_SplineCurve.hxx>
39#include <IGESGeom_SplineSurface.hxx>
40#include <IGESGeom_SurfaceOfRevolution.hxx>
41#include <IGESGeom_TabulatedCylinder.hxx>
42#include <IGESGeom_TransformationMatrix.hxx>
43#include <IGESGeom_TrimmedSurface.hxx>
44
45#include <IGESGeom_ToolBSplineCurve.hxx>
46#include <IGESGeom_ToolBSplineSurface.hxx>
47#include <IGESGeom_ToolBoundary.hxx>
48#include <IGESGeom_ToolBoundedSurface.hxx>
49#include <IGESGeom_ToolCircularArc.hxx>
50#include <IGESGeom_ToolCompositeCurve.hxx>
51#include <IGESGeom_ToolConicArc.hxx>
52#include <IGESGeom_ToolCopiousData.hxx>
53#include <IGESGeom_ToolCurveOnSurface.hxx>
54#include <IGESGeom_ToolDirection.hxx>
55#include <IGESGeom_ToolFlash.hxx>
56#include <IGESGeom_ToolLine.hxx>
57#include <IGESGeom_ToolOffsetCurve.hxx>
58#include <IGESGeom_ToolOffsetSurface.hxx>
59#include <IGESGeom_ToolPlane.hxx>
60#include <IGESGeom_ToolPoint.hxx>
61#include <IGESGeom_ToolRuledSurface.hxx>
62#include <IGESGeom_ToolSplineCurve.hxx>
63#include <IGESGeom_ToolSplineSurface.hxx>
64#include <IGESGeom_ToolSurfaceOfRevolution.hxx>
65#include <IGESGeom_ToolTabulatedCylinder.hxx>
66#include <IGESGeom_ToolTransformationMatrix.hxx>
67#include <IGESGeom_ToolTrimmedSurface.hxx>
68
69
70
71// Each Module is attached to a Protocol : it must interprete Case Numbers
72// (arguments <CN> of various methods) in accordance to values returned by
73// the method TypeNumber from this Protocol
74
75
b311480e 76IGESGeom_ReadWriteModule::IGESGeom_ReadWriteModule () { }
7fd59977 77
78
79 Standard_Integer IGESGeom_ReadWriteModule::CaseIGES
80 (const Standard_Integer typenum, const Standard_Integer formnum) const
81{
82 switch (typenum) {
83 case 100 : return 5;
84 case 102 : return 6;
85 case 104 : return 7;
86 case 106 : if (formnum < 20 || formnum > 40) return 8;
87 break;
88 case 108 : return 15;
89 case 110 : return 12;
90 case 112 : return 18;
91 case 114 : return 19;
92 case 116 : return 16;
93 case 118 : return 17;
94 case 120 : return 20;
95 case 122 : return 21;
96 case 123 : return 10;
97 case 124 : return 22;
98 case 125 : return 11;
99 case 126 : return 1;
100 case 128 : return 2;
101 case 130 : return 13;
102 case 140 : return 14;
103 case 141 : return 3;
104 case 142 : return 9;
105 case 143 : return 4;
106 case 144 : return 23;
107 default : break;
108 }
109 return 0;
110}
111
112
113 void IGESGeom_ReadWriteModule::ReadOwnParams
114 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
115 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
116{
117 switch (CN) {
118 case 1 : {
119 DeclareAndCast(IGESGeom_BSplineCurve,anent,ent);
120 if (anent.IsNull()) return;
121 IGESGeom_ToolBSplineCurve tool;
122 tool.ReadOwnParams(anent,IR,PR);
123 }
124 break;
125 case 2 : {
126 DeclareAndCast(IGESGeom_BSplineSurface,anent,ent);
127 if (anent.IsNull()) return;
128 IGESGeom_ToolBSplineSurface tool;
129 tool.ReadOwnParams(anent,IR,PR);
130 }
131 break;
132 case 3 : {
133 DeclareAndCast(IGESGeom_Boundary,anent,ent);
134 if (anent.IsNull()) return;
135 IGESGeom_ToolBoundary tool;
136 tool.ReadOwnParams(anent,IR,PR);
137 }
138 break;
139 case 4 : {
140 DeclareAndCast(IGESGeom_BoundedSurface,anent,ent);
141 if (anent.IsNull()) return;
142 IGESGeom_ToolBoundedSurface tool;
143 tool.ReadOwnParams(anent,IR,PR);
144 }
145 break;
146 case 5 : {
147 DeclareAndCast(IGESGeom_CircularArc,anent,ent);
148 if (anent.IsNull()) return;
149 IGESGeom_ToolCircularArc tool;
150 tool.ReadOwnParams(anent,IR,PR);
151 }
152 break;
153 case 6 : {
154 DeclareAndCast(IGESGeom_CompositeCurve,anent,ent);
155 if (anent.IsNull()) return;
156 IGESGeom_ToolCompositeCurve tool;
157 tool.ReadOwnParams(anent,IR,PR);
158 }
159 break;
160 case 7 : {
161 DeclareAndCast(IGESGeom_ConicArc,anent,ent);
162 if (anent.IsNull()) return;
163 IGESGeom_ToolConicArc tool;
164 tool.ReadOwnParams(anent,IR,PR);
165 }
166 break;
167 case 8 : {
168 DeclareAndCast(IGESGeom_CopiousData,anent,ent);
169 if (anent.IsNull()) return;
170 IGESGeom_ToolCopiousData tool;
171 tool.ReadOwnParams(anent,IR,PR);
172 }
173 break;
174 case 9 : {
175 DeclareAndCast(IGESGeom_CurveOnSurface,anent,ent);
176 if (anent.IsNull()) return;
177 IGESGeom_ToolCurveOnSurface tool;
178 tool.ReadOwnParams(anent,IR,PR);
179 }
180 break;
181 case 10 : {
182 DeclareAndCast(IGESGeom_Direction,anent,ent);
183 if (anent.IsNull()) return;
184 IGESGeom_ToolDirection tool;
185 tool.ReadOwnParams(anent,IR,PR);
186 }
187 break;
188 case 11 : {
189 DeclareAndCast(IGESGeom_Flash,anent,ent);
190 if (anent.IsNull()) return;
191 IGESGeom_ToolFlash tool;
192 tool.ReadOwnParams(anent,IR,PR);
193 }
194 break;
195 case 12 : {
196 DeclareAndCast(IGESGeom_Line,anent,ent);
197 if (anent.IsNull()) return;
198 IGESGeom_ToolLine tool;
199 tool.ReadOwnParams(anent,IR,PR);
200 }
201 break;
202 case 13 : {
203 DeclareAndCast(IGESGeom_OffsetCurve,anent,ent);
204 if (anent.IsNull()) return;
205 IGESGeom_ToolOffsetCurve tool;
206 tool.ReadOwnParams(anent,IR,PR);
207 }
208 break;
209 case 14 : {
210 DeclareAndCast(IGESGeom_OffsetSurface,anent,ent);
211 if (anent.IsNull()) return;
212 IGESGeom_ToolOffsetSurface tool;
213 tool.ReadOwnParams(anent,IR,PR);
214 }
215 break;
216 case 15 : {
217 DeclareAndCast(IGESGeom_Plane,anent,ent);
218 if (anent.IsNull()) return;
219 IGESGeom_ToolPlane tool;
220 tool.ReadOwnParams(anent,IR,PR);
221 }
222 break;
223 case 16 : {
224 DeclareAndCast(IGESGeom_Point,anent,ent);
225 if (anent.IsNull()) return;
226 IGESGeom_ToolPoint tool;
227 tool.ReadOwnParams(anent,IR,PR);
228 }
229 break;
230 case 17 : {
231 DeclareAndCast(IGESGeom_RuledSurface,anent,ent);
232 if (anent.IsNull()) return;
233 IGESGeom_ToolRuledSurface tool;
234 tool.ReadOwnParams(anent,IR,PR);
235 }
236 break;
237 case 18 : {
238 DeclareAndCast(IGESGeom_SplineCurve,anent,ent);
239 if (anent.IsNull()) return;
240 IGESGeom_ToolSplineCurve tool;
241 tool.ReadOwnParams(anent,IR,PR);
242 }
243 break;
244 case 19 : {
245 DeclareAndCast(IGESGeom_SplineSurface,anent,ent);
246 if (anent.IsNull()) return;
247 IGESGeom_ToolSplineSurface tool;
248 tool.ReadOwnParams(anent,IR,PR);
249 }
250 break;
251 case 20 : {
252 DeclareAndCast(IGESGeom_SurfaceOfRevolution,anent,ent);
253 if (anent.IsNull()) return;
254 IGESGeom_ToolSurfaceOfRevolution tool;
255 tool.ReadOwnParams(anent,IR,PR);
256 }
257 break;
258 case 21 : {
259 DeclareAndCast(IGESGeom_TabulatedCylinder,anent,ent);
260 if (anent.IsNull()) return;
261 IGESGeom_ToolTabulatedCylinder tool;
262 tool.ReadOwnParams(anent,IR,PR);
263 }
264 break;
265 case 22 : {
266 DeclareAndCast(IGESGeom_TransformationMatrix,anent,ent);
267 if (anent.IsNull()) return;
268 IGESGeom_ToolTransformationMatrix tool;
269 tool.ReadOwnParams(anent,IR,PR);
270 }
271 break;
272 case 23 : {
273 DeclareAndCast(IGESGeom_TrimmedSurface,anent,ent);
274 if (anent.IsNull()) return;
275 IGESGeom_ToolTrimmedSurface tool;
276 tool.ReadOwnParams(anent,IR,PR);
277 }
278 break;
279 default : break;
280 }
281}
282
283
284 void IGESGeom_ReadWriteModule::WriteOwnParams
285 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
286 IGESData_IGESWriter& IW) const
287{
288 switch (CN) {
289 case 1 : {
290 DeclareAndCast(IGESGeom_BSplineCurve,anent,ent);
291 if (anent.IsNull()) return;
292 IGESGeom_ToolBSplineCurve tool;
293 tool.WriteOwnParams(anent,IW);
294 }
295 break;
296 case 2 : {
297 DeclareAndCast(IGESGeom_BSplineSurface,anent,ent);
298 if (anent.IsNull()) return;
299 IGESGeom_ToolBSplineSurface tool;
300 tool.WriteOwnParams(anent,IW);
301 }
302 break;
303 case 3 : {
304 DeclareAndCast(IGESGeom_Boundary,anent,ent);
305 if (anent.IsNull()) return;
306 IGESGeom_ToolBoundary tool;
307 tool.WriteOwnParams(anent,IW);
308 }
309 break;
310 case 4 : {
311 DeclareAndCast(IGESGeom_BoundedSurface,anent,ent);
312 if (anent.IsNull()) return;
313 IGESGeom_ToolBoundedSurface tool;
314 tool.WriteOwnParams(anent,IW);
315 }
316 break;
317 case 5 : {
318 DeclareAndCast(IGESGeom_CircularArc,anent,ent);
319 if (anent.IsNull()) return;
320 IGESGeom_ToolCircularArc tool;
321 tool.WriteOwnParams(anent,IW);
322 }
323 break;
324 case 6 : {
325 DeclareAndCast(IGESGeom_CompositeCurve,anent,ent);
326 if (anent.IsNull()) return;
327 IGESGeom_ToolCompositeCurve tool;
328 tool.WriteOwnParams(anent,IW);
329 }
330 break;
331 case 7 : {
332 DeclareAndCast(IGESGeom_ConicArc,anent,ent);
333 if (anent.IsNull()) return;
334 IGESGeom_ToolConicArc tool;
335 tool.WriteOwnParams(anent,IW);
336 }
337 break;
338 case 8 : {
339 DeclareAndCast(IGESGeom_CopiousData,anent,ent);
340 if (anent.IsNull()) return;
341 IGESGeom_ToolCopiousData tool;
342 tool.WriteOwnParams(anent,IW);
343 }
344 break;
345 case 9 : {
346 DeclareAndCast(IGESGeom_CurveOnSurface,anent,ent);
347 if (anent.IsNull()) return;
348 IGESGeom_ToolCurveOnSurface tool;
349 tool.WriteOwnParams(anent,IW);
350 }
351 break;
352 case 10 : {
353 DeclareAndCast(IGESGeom_Direction,anent,ent);
354 if (anent.IsNull()) return;
355 IGESGeom_ToolDirection tool;
356 tool.WriteOwnParams(anent,IW);
357 }
358 break;
359 case 11 : {
360 DeclareAndCast(IGESGeom_Flash,anent,ent);
361 if (anent.IsNull()) return;
362 IGESGeom_ToolFlash tool;
363 tool.WriteOwnParams(anent,IW);
364 }
365 break;
366 case 12 : {
367 DeclareAndCast(IGESGeom_Line,anent,ent);
368 if (anent.IsNull()) return;
369 IGESGeom_ToolLine tool;
370 tool.WriteOwnParams(anent,IW);
371 }
372 break;
373 case 13 : {
374 DeclareAndCast(IGESGeom_OffsetCurve,anent,ent);
375 if (anent.IsNull()) return;
376 IGESGeom_ToolOffsetCurve tool;
377 tool.WriteOwnParams(anent,IW);
378 }
379 break;
380 case 14 : {
381 DeclareAndCast(IGESGeom_OffsetSurface,anent,ent);
382 if (anent.IsNull()) return;
383 IGESGeom_ToolOffsetSurface tool;
384 tool.WriteOwnParams(anent,IW);
385 }
386 break;
387 case 15 : {
388 DeclareAndCast(IGESGeom_Plane,anent,ent);
389 if (anent.IsNull()) return;
390 IGESGeom_ToolPlane tool;
391 tool.WriteOwnParams(anent,IW);
392 }
393 break;
394 case 16 : {
395 DeclareAndCast(IGESGeom_Point,anent,ent);
396 if (anent.IsNull()) return;
397 IGESGeom_ToolPoint tool;
398 tool.WriteOwnParams(anent,IW);
399 }
400 break;
401 case 17 : {
402 DeclareAndCast(IGESGeom_RuledSurface,anent,ent);
403 if (anent.IsNull()) return;
404 IGESGeom_ToolRuledSurface tool;
405 tool.WriteOwnParams(anent,IW);
406 }
407 break;
408 case 18 : {
409 DeclareAndCast(IGESGeom_SplineCurve,anent,ent);
410 if (anent.IsNull()) return;
411 IGESGeom_ToolSplineCurve tool;
412 tool.WriteOwnParams(anent,IW);
413 }
414 break;
415 case 19 : {
416 DeclareAndCast(IGESGeom_SplineSurface,anent,ent);
417 if (anent.IsNull()) return;
418 IGESGeom_ToolSplineSurface tool;
419 tool.WriteOwnParams(anent,IW);
420 }
421 break;
422 case 20 : {
423 DeclareAndCast(IGESGeom_SurfaceOfRevolution,anent,ent);
424 if (anent.IsNull()) return;
425 IGESGeom_ToolSurfaceOfRevolution tool;
426 tool.WriteOwnParams(anent,IW);
427 }
428 break;
429 case 21 : {
430 DeclareAndCast(IGESGeom_TabulatedCylinder,anent,ent);
431 if (anent.IsNull()) return;
432 IGESGeom_ToolTabulatedCylinder tool;
433 tool.WriteOwnParams(anent,IW);
434 }
435 break;
436 case 22 : {
437 DeclareAndCast(IGESGeom_TransformationMatrix,anent,ent);
438 if (anent.IsNull()) return;
439 IGESGeom_ToolTransformationMatrix tool;
440 tool.WriteOwnParams(anent,IW);
441 }
442 break;
443 case 23 : {
444 DeclareAndCast(IGESGeom_TrimmedSurface,anent,ent);
445 if (anent.IsNull()) return;
446 IGESGeom_ToolTrimmedSurface tool;
447 tool.WriteOwnParams(anent,IW);
448 }
449 break;
450 default : break;
451 }
452}