Warnings on vc14 were eliminated
[occt.git] / src / IGESSolid / IGESSolid_ReadWriteModule.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <IGESData_IGESEntity.hxx>
16 #include <IGESData_IGESReaderData.hxx>
17 #include <IGESData_IGESWriter.hxx>
18 #include <IGESData_ParamReader.hxx>
19 #include <IGESSolid_Block.hxx>
20 #include <IGESSolid_BooleanTree.hxx>
21 #include <IGESSolid_ConeFrustum.hxx>
22 #include <IGESSolid_ConicalSurface.hxx>
23 #include <IGESSolid_Cylinder.hxx>
24 #include <IGESSolid_CylindricalSurface.hxx>
25 #include <IGESSolid_EdgeList.hxx>
26 #include <IGESSolid_Ellipsoid.hxx>
27 #include <IGESSolid_Face.hxx>
28 #include <IGESSolid_Loop.hxx>
29 #include <IGESSolid_ManifoldSolid.hxx>
30 #include <IGESSolid_PlaneSurface.hxx>
31 #include <IGESSolid_ReadWriteModule.hxx>
32 #include <IGESSolid_RightAngularWedge.hxx>
33 #include <IGESSolid_SelectedComponent.hxx>
34 #include <IGESSolid_Shell.hxx>
35 #include <IGESSolid_SolidAssembly.hxx>
36 #include <IGESSolid_SolidInstance.hxx>
37 #include <IGESSolid_SolidOfLinearExtrusion.hxx>
38 #include <IGESSolid_SolidOfRevolution.hxx>
39 #include <IGESSolid_Sphere.hxx>
40 #include <IGESSolid_SphericalSurface.hxx>
41 #include <IGESSolid_ToolBlock.hxx>
42 #include <IGESSolid_ToolBooleanTree.hxx>
43 #include <IGESSolid_ToolConeFrustum.hxx>
44 #include <IGESSolid_ToolConicalSurface.hxx>
45 #include <IGESSolid_ToolCylinder.hxx>
46 #include <IGESSolid_ToolCylindricalSurface.hxx>
47 #include <IGESSolid_ToolEdgeList.hxx>
48 #include <IGESSolid_ToolEllipsoid.hxx>
49 #include <IGESSolid_ToolFace.hxx>
50 #include <IGESSolid_ToolLoop.hxx>
51 #include <IGESSolid_ToolManifoldSolid.hxx>
52 #include <IGESSolid_ToolPlaneSurface.hxx>
53 #include <IGESSolid_ToolRightAngularWedge.hxx>
54 #include <IGESSolid_ToolSelectedComponent.hxx>
55 #include <IGESSolid_ToolShell.hxx>
56 #include <IGESSolid_ToolSolidAssembly.hxx>
57 #include <IGESSolid_ToolSolidInstance.hxx>
58 #include <IGESSolid_ToolSolidOfLinearExtrusion.hxx>
59 #include <IGESSolid_ToolSolidOfRevolution.hxx>
60 #include <IGESSolid_ToolSphere.hxx>
61 #include <IGESSolid_ToolSphericalSurface.hxx>
62 #include <IGESSolid_ToolToroidalSurface.hxx>
63 #include <IGESSolid_ToolTorus.hxx>
64 #include <IGESSolid_ToolVertexList.hxx>
65 #include <IGESSolid_ToroidalSurface.hxx>
66 #include <IGESSolid_Torus.hxx>
67 #include <IGESSolid_VertexList.hxx>
68 #include <Interface_Macros.hxx>
69 #include <Standard_DomainError.hxx>
70 #include <Standard_Type.hxx>
71
72 IMPLEMENT_STANDARD_RTTIEXT(IGESSolid_ReadWriteModule,IGESData_ReadWriteModule)
73
74 //  Each Module is attached to a Protocol : it must interprete Case Numbers
75 //  (arguments <CN> of various methods) in accordance to values returned by
76 //  the method TypeNumber from this Protocol
77 IGESSolid_ReadWriteModule::IGESSolid_ReadWriteModule ()    {  }
78
79
80     Standard_Integer  IGESSolid_ReadWriteModule::CaseIGES
81   (const Standard_Integer typenum, const Standard_Integer /*formnum*/) const 
82 {
83   switch (typenum) {
84     case 150 : return  1;
85     case 152 : return 13;
86     case 154 : return  5;
87     case 156 : return  3;
88     case 158 : return 20;
89     case 160 : return 23;
90     case 162 : return 19;
91     case 164 : return 18;
92     case 168 : return  8;
93     case 180 : return  2;
94     case 182 : return 14;
95     case 184 : return 16;
96     case 186 : return 11;
97     case 190 : return 12;
98     case 192 : return  6;
99     case 194 : return  4;
100     case 196 : return 21;
101     case 198 : return 22;
102     case 430 : return 17;
103     case 502 : return 24;
104     case 504 : return  7;
105     case 508 : return 10;
106     case 510 : return  9;
107     case 514 : return 15;
108     default : break;
109   }
110   return 0;
111 }
112
113
114     void  IGESSolid_ReadWriteModule::ReadOwnParams
115   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
116    const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const 
117 {
118   switch (CN) {
119     case  1 : {
120       DeclareAndCast(IGESSolid_Block,anent,ent);
121       if (anent.IsNull()) return;
122       IGESSolid_ToolBlock tool;
123       tool.ReadOwnParams(anent,IR,PR);
124     }
125       break;
126     case  2 : {
127       DeclareAndCast(IGESSolid_BooleanTree,anent,ent);
128       if (anent.IsNull()) return;
129       IGESSolid_ToolBooleanTree tool;
130       tool.ReadOwnParams(anent,IR,PR);
131     }
132       break;
133     case  3 : {
134       DeclareAndCast(IGESSolid_ConeFrustum,anent,ent);
135       if (anent.IsNull()) return;
136       IGESSolid_ToolConeFrustum tool;
137       tool.ReadOwnParams(anent,IR,PR);
138     }
139       break;
140     case  4 : {
141       DeclareAndCast(IGESSolid_ConicalSurface,anent,ent);
142       if (anent.IsNull()) return;
143       IGESSolid_ToolConicalSurface tool;
144       tool.ReadOwnParams(anent,IR,PR);
145     }
146       break;
147     case  5 : {
148       DeclareAndCast(IGESSolid_Cylinder,anent,ent);
149       if (anent.IsNull()) return;
150       IGESSolid_ToolCylinder tool;
151       tool.ReadOwnParams(anent,IR,PR);
152     }
153       break;
154     case  6 : {
155       DeclareAndCast(IGESSolid_CylindricalSurface,anent,ent);
156       if (anent.IsNull()) return;
157       IGESSolid_ToolCylindricalSurface tool;
158       tool.ReadOwnParams(anent,IR,PR);
159     }
160       break;
161     case  7 : {
162       DeclareAndCast(IGESSolid_EdgeList,anent,ent);
163       if (anent.IsNull()) return;
164       IGESSolid_ToolEdgeList tool;
165       tool.ReadOwnParams(anent,IR,PR);
166     }
167       break;
168     case  8 : {
169       DeclareAndCast(IGESSolid_Ellipsoid,anent,ent);
170       if (anent.IsNull()) return;
171       IGESSolid_ToolEllipsoid tool;
172       tool.ReadOwnParams(anent,IR,PR);
173     }
174       break;
175     case  9 : {
176       DeclareAndCast(IGESSolid_Face,anent,ent);
177       if (anent.IsNull()) return;
178       IGESSolid_ToolFace tool;
179       tool.ReadOwnParams(anent,IR,PR);
180     }
181       break;
182     case 10 : {
183       DeclareAndCast(IGESSolid_Loop,anent,ent);
184       if (anent.IsNull()) return;
185       IGESSolid_ToolLoop tool;
186       tool.ReadOwnParams(anent,IR,PR);
187     }
188       break;
189     case 11 : {
190       DeclareAndCast(IGESSolid_ManifoldSolid,anent,ent);
191       if (anent.IsNull()) return;
192       IGESSolid_ToolManifoldSolid tool;
193       tool.ReadOwnParams(anent,IR,PR);
194     }
195       break;
196     case 12 : {
197       DeclareAndCast(IGESSolid_PlaneSurface,anent,ent);
198       if (anent.IsNull()) return;
199       IGESSolid_ToolPlaneSurface tool;
200       tool.ReadOwnParams(anent,IR,PR);
201     }
202       break;
203     case 13 : {
204       DeclareAndCast(IGESSolid_RightAngularWedge,anent,ent);
205       if (anent.IsNull()) return;
206       IGESSolid_ToolRightAngularWedge tool;
207       tool.ReadOwnParams(anent,IR,PR);
208     }
209       break;
210     case 14 : {
211       DeclareAndCast(IGESSolid_SelectedComponent,anent,ent);
212       if (anent.IsNull()) return;
213       IGESSolid_ToolSelectedComponent tool;
214       tool.ReadOwnParams(anent,IR,PR);
215     }
216       break;
217     case 15 : {
218       DeclareAndCast(IGESSolid_Shell,anent,ent);
219       if (anent.IsNull()) return;
220       IGESSolid_ToolShell tool;
221       tool.ReadOwnParams(anent,IR,PR);
222     }
223       break;
224     case 16 : {
225       DeclareAndCast(IGESSolid_SolidAssembly,anent,ent);
226       if (anent.IsNull()) return;
227       IGESSolid_ToolSolidAssembly tool;
228       tool.ReadOwnParams(anent,IR,PR);
229     }
230       break;
231     case 17 : {
232       DeclareAndCast(IGESSolid_SolidInstance,anent,ent);
233       if (anent.IsNull()) return;
234       IGESSolid_ToolSolidInstance tool;
235       tool.ReadOwnParams(anent,IR,PR);
236     }
237       break;
238     case 18 : {
239       DeclareAndCast(IGESSolid_SolidOfLinearExtrusion,anent,ent);
240       if (anent.IsNull()) return;
241       IGESSolid_ToolSolidOfLinearExtrusion tool;
242       tool.ReadOwnParams(anent,IR,PR);
243     }
244       break;
245     case 19 : {
246       DeclareAndCast(IGESSolid_SolidOfRevolution,anent,ent);
247       if (anent.IsNull()) return;
248       IGESSolid_ToolSolidOfRevolution tool;
249       tool.ReadOwnParams(anent,IR,PR);
250     }
251       break;
252     case 20 : {
253       DeclareAndCast(IGESSolid_Sphere,anent,ent);
254       if (anent.IsNull()) return;
255       IGESSolid_ToolSphere tool;
256       tool.ReadOwnParams(anent,IR,PR);
257     }
258       break;
259     case 21 : {
260       DeclareAndCast(IGESSolid_SphericalSurface,anent,ent);
261       if (anent.IsNull()) return;
262       IGESSolid_ToolSphericalSurface tool;
263       tool.ReadOwnParams(anent,IR,PR);
264     }
265       break;
266     case 22 : {
267       DeclareAndCast(IGESSolid_ToroidalSurface,anent,ent);
268       if (anent.IsNull()) return;
269       IGESSolid_ToolToroidalSurface tool;
270       tool.ReadOwnParams(anent,IR,PR);
271     }
272       break;
273     case 23 : {
274       DeclareAndCast(IGESSolid_Torus,anent,ent);
275       if (anent.IsNull()) return;
276       IGESSolid_ToolTorus tool;
277       tool.ReadOwnParams(anent,IR,PR);
278     }
279       break;
280     case 24 : {
281       DeclareAndCast(IGESSolid_VertexList,anent,ent);
282       if (anent.IsNull()) return;
283       IGESSolid_ToolVertexList tool;
284       tool.ReadOwnParams(anent,IR,PR);
285     }
286       break;
287     default : break;
288   }
289 }
290
291
292     void  IGESSolid_ReadWriteModule::WriteOwnParams
293   (const Standard_Integer CN,  const Handle(IGESData_IGESEntity)& ent,
294    IGESData_IGESWriter& IW) const
295 {
296   switch (CN) {
297     case  1 : {
298       DeclareAndCast(IGESSolid_Block,anent,ent);
299       if (anent.IsNull()) return;
300       IGESSolid_ToolBlock tool;
301       tool.WriteOwnParams(anent,IW);
302     }
303       break;
304     case  2 : {
305       DeclareAndCast(IGESSolid_BooleanTree,anent,ent);
306       if (anent.IsNull()) return;
307       IGESSolid_ToolBooleanTree tool;
308       tool.WriteOwnParams(anent,IW);
309     }
310       break;
311     case  3 : {
312       DeclareAndCast(IGESSolid_ConeFrustum,anent,ent);
313       if (anent.IsNull()) return;
314       IGESSolid_ToolConeFrustum tool;
315       tool.WriteOwnParams(anent,IW);
316     }
317       break;
318     case  4 : {
319       DeclareAndCast(IGESSolid_ConicalSurface,anent,ent);
320       if (anent.IsNull()) return;
321       IGESSolid_ToolConicalSurface tool;
322       tool.WriteOwnParams(anent,IW);
323     }
324       break;
325     case  5 : {
326       DeclareAndCast(IGESSolid_Cylinder,anent,ent);
327       if (anent.IsNull()) return;
328       IGESSolid_ToolCylinder tool;
329       tool.WriteOwnParams(anent,IW);
330     }
331       break;
332     case  6 : {
333       DeclareAndCast(IGESSolid_CylindricalSurface,anent,ent);
334       if (anent.IsNull()) return;
335       IGESSolid_ToolCylindricalSurface tool;
336       tool.WriteOwnParams(anent,IW);
337     }
338       break;
339     case  7 : {
340       DeclareAndCast(IGESSolid_EdgeList,anent,ent);
341       if (anent.IsNull()) return;
342       IGESSolid_ToolEdgeList tool;
343       tool.WriteOwnParams(anent,IW);
344     }
345       break;
346     case  8 : {
347       DeclareAndCast(IGESSolid_Ellipsoid,anent,ent);
348       if (anent.IsNull()) return;
349       IGESSolid_ToolEllipsoid tool;
350       tool.WriteOwnParams(anent,IW);
351     }
352       break;
353     case  9 : {
354       DeclareAndCast(IGESSolid_Face,anent,ent);
355       if (anent.IsNull()) return;
356       IGESSolid_ToolFace tool;
357       tool.WriteOwnParams(anent,IW);
358     }
359       break;
360     case 10 : {
361       DeclareAndCast(IGESSolid_Loop,anent,ent);
362       if (anent.IsNull()) return;
363       IGESSolid_ToolLoop tool;
364       tool.WriteOwnParams(anent,IW);
365     }
366       break;
367     case 11 : {
368       DeclareAndCast(IGESSolid_ManifoldSolid,anent,ent);
369       if (anent.IsNull()) return;
370       IGESSolid_ToolManifoldSolid tool;
371       tool.WriteOwnParams(anent,IW);
372     }
373       break;
374     case 12 : {
375       DeclareAndCast(IGESSolid_PlaneSurface,anent,ent);
376       if (anent.IsNull()) return;
377       IGESSolid_ToolPlaneSurface tool;
378       tool.WriteOwnParams(anent,IW);
379     }
380       break;
381     case 13 : {
382       DeclareAndCast(IGESSolid_RightAngularWedge,anent,ent);
383       if (anent.IsNull()) return;
384       IGESSolid_ToolRightAngularWedge tool;
385       tool.WriteOwnParams(anent,IW);
386     }
387       break;
388     case 14 : {
389       DeclareAndCast(IGESSolid_SelectedComponent,anent,ent);
390       if (anent.IsNull()) return;
391       IGESSolid_ToolSelectedComponent tool;
392       tool.WriteOwnParams(anent,IW);
393     }
394       break;
395     case 15 : {
396       DeclareAndCast(IGESSolid_Shell,anent,ent);
397       if (anent.IsNull()) return;
398       IGESSolid_ToolShell tool;
399       tool.WriteOwnParams(anent,IW);
400     }
401       break;
402     case 16 : {
403       DeclareAndCast(IGESSolid_SolidAssembly,anent,ent);
404       if (anent.IsNull()) return;
405       IGESSolid_ToolSolidAssembly tool;
406       tool.WriteOwnParams(anent,IW);
407     }
408       break;
409     case 17 : {
410       DeclareAndCast(IGESSolid_SolidInstance,anent,ent);
411       if (anent.IsNull()) return;
412       IGESSolid_ToolSolidInstance tool;
413       tool.WriteOwnParams(anent,IW);
414     }
415       break;
416     case 18 : {
417       DeclareAndCast(IGESSolid_SolidOfLinearExtrusion,anent,ent);
418       if (anent.IsNull()) return;
419       IGESSolid_ToolSolidOfLinearExtrusion tool;
420       tool.WriteOwnParams(anent,IW);
421     }
422       break;
423     case 19 : {
424       DeclareAndCast(IGESSolid_SolidOfRevolution,anent,ent);
425       if (anent.IsNull()) return;
426       IGESSolid_ToolSolidOfRevolution tool;
427       tool.WriteOwnParams(anent,IW);
428     }
429       break;
430     case 20 : {
431       DeclareAndCast(IGESSolid_Sphere,anent,ent);
432       if (anent.IsNull()) return;
433       IGESSolid_ToolSphere tool;
434       tool.WriteOwnParams(anent,IW);
435     }
436       break;
437     case 21 : {
438       DeclareAndCast(IGESSolid_SphericalSurface,anent,ent);
439       if (anent.IsNull()) return;
440       IGESSolid_ToolSphericalSurface tool;
441       tool.WriteOwnParams(anent,IW);
442     }
443       break;
444     case 22 : {
445       DeclareAndCast(IGESSolid_ToroidalSurface,anent,ent);
446       if (anent.IsNull()) return;
447       IGESSolid_ToolToroidalSurface tool;
448       tool.WriteOwnParams(anent,IW);
449     }
450       break;
451     case 23 : {
452       DeclareAndCast(IGESSolid_Torus,anent,ent);
453       if (anent.IsNull()) return;
454       IGESSolid_ToolTorus tool;
455       tool.WriteOwnParams(anent,IW);
456     }
457       break;
458     case 24 : {
459       DeclareAndCast(IGESSolid_VertexList,anent,ent);
460       if (anent.IsNull()) return;
461       IGESSolid_ToolVertexList tool;
462       tool.WriteOwnParams(anent,IW);
463     }
464       break;
465     default : break;
466   }
467 }