0023024: Update headers of OCCT files
[occt.git] / src / IGESAppli / IGESAppli_ReadWriteModule.cxx
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
18 #include <IGESAppli_ReadWriteModule.ixx>
19 #include <Interface_Macros.hxx>
20
21 #include <IGESAppli_DrilledHole.hxx>
22 #include <IGESAppli_ElementResults.hxx>
23 #include <IGESAppli_FiniteElement.hxx>
24 #include <IGESAppli_Flow.hxx>
25 #include <IGESAppli_FlowLineSpec.hxx>
26 #include <IGESAppli_LevelFunction.hxx>
27 #include <IGESAppli_LevelToPWBLayerMap.hxx>
28 #include <IGESAppli_LineWidening.hxx>
29 #include <IGESAppli_NodalConstraint.hxx>
30 #include <IGESAppli_NodalDisplAndRot.hxx>
31 #include <IGESAppli_NodalResults.hxx>
32 #include <IGESAppli_Node.hxx>
33 #include <IGESAppli_PWBArtworkStackup.hxx>
34 #include <IGESAppli_PWBDrilledHole.hxx>
35 #include <IGESAppli_PartNumber.hxx>
36 #include <IGESAppli_PinNumber.hxx>
37 #include <IGESAppli_PipingFlow.hxx>
38 #include <IGESAppli_ReferenceDesignator.hxx>
39 #include <IGESAppli_RegionRestriction.hxx>
40
41 #include <IGESAppli_ToolDrilledHole.hxx>
42 #include <IGESAppli_ToolElementResults.hxx>
43 #include <IGESAppli_ToolFiniteElement.hxx>
44 #include <IGESAppli_ToolFlow.hxx>
45 #include <IGESAppli_ToolFlowLineSpec.hxx>
46 #include <IGESAppli_ToolLevelFunction.hxx>
47 #include <IGESAppli_ToolLevelToPWBLayerMap.hxx>
48 #include <IGESAppli_ToolLineWidening.hxx>
49 #include <IGESAppli_ToolNodalConstraint.hxx>
50 #include <IGESAppli_ToolNodalDisplAndRot.hxx>
51 #include <IGESAppli_ToolNodalResults.hxx>
52 #include <IGESAppli_ToolNode.hxx>
53 #include <IGESAppli_ToolPWBArtworkStackup.hxx>
54 #include <IGESAppli_ToolPWBDrilledHole.hxx>
55 #include <IGESAppli_ToolPartNumber.hxx>
56 #include <IGESAppli_ToolPinNumber.hxx>
57 #include <IGESAppli_ToolPipingFlow.hxx>
58 #include <IGESAppli_ToolReferenceDesignator.hxx>
59 #include <IGESAppli_ToolRegionRestriction.hxx>
60
61
62
63 //  Each Module is attached to a Protocol : it must interprete Case Numbers
64 //  (arguments <CN> of various methods) in accordance to values returned by
65 //  the method TypeNumber from this Protocol
66
67
68 IGESAppli_ReadWriteModule::IGESAppli_ReadWriteModule ()    {  }
69
70
71     Standard_Integer  IGESAppli_ReadWriteModule::CaseIGES
72   (const Standard_Integer typenum, const Standard_Integer formnum) const 
73 {
74   switch (typenum) {
75     case 134 : return 12;
76     case 136 : return  3;
77     case 138 : return 10;
78     case 146 : return 11;
79     case 148 : return  2;
80     case 402 :
81       switch (formnum) {
82         case 18 : return  4;
83         case 20 : return 17;
84         default : break;
85       }
86       break;
87     case 406 :
88       switch (formnum) {
89         case  2 : return 19;
90         case  3 : return  6;
91         case  5 : return  8;
92         case  6 : return  1;
93         case  7 : return 18;
94         case  8 : return 16;
95         case  9 : return 15;
96         case 14 : return  5;
97         case 24 : return  7;
98         case 25 : return 13;
99         case 26 : return 14;
100         default : break;
101       }
102       break;
103     case 418 : return  9;
104     default : break;
105   }
106   return 0;
107 }
108
109
110     void  IGESAppli_ReadWriteModule::ReadOwnParams
111   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
112    const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const 
113 {
114   switch (CN) {
115     case  1 : {
116       DeclareAndCast(IGESAppli_DrilledHole,anent,ent);
117       if (anent.IsNull()) return;
118       IGESAppli_ToolDrilledHole tool;
119       tool.ReadOwnParams(anent,IR,PR);
120     }
121       break;
122     case  2 : {
123       DeclareAndCast(IGESAppli_ElementResults,anent,ent);
124       if (anent.IsNull()) return;
125       IGESAppli_ToolElementResults tool;
126       tool.ReadOwnParams(anent,IR,PR);
127     }
128       break;
129     case  3 : {
130       DeclareAndCast(IGESAppli_FiniteElement,anent,ent);
131       if (anent.IsNull()) return;
132       IGESAppli_ToolFiniteElement tool;
133       tool.ReadOwnParams(anent,IR,PR);
134     }
135       break;
136     case  4 : {
137       DeclareAndCast(IGESAppli_Flow,anent,ent);
138       if (anent.IsNull()) return;
139       IGESAppli_ToolFlow tool;
140       tool.ReadOwnParams(anent,IR,PR);
141     }
142       break;
143     case  5 : {
144       DeclareAndCast(IGESAppli_FlowLineSpec,anent,ent);
145       if (anent.IsNull()) return;
146       IGESAppli_ToolFlowLineSpec tool;
147       tool.ReadOwnParams(anent,IR,PR);
148     }
149       break;
150     case  6 : {
151       DeclareAndCast(IGESAppli_LevelFunction,anent,ent);
152       if (anent.IsNull()) return;
153       IGESAppli_ToolLevelFunction tool;
154       tool.ReadOwnParams(anent,IR,PR);
155     }
156       break;
157     case  7 : {
158       DeclareAndCast(IGESAppli_LevelToPWBLayerMap,anent,ent);
159       if (anent.IsNull()) return;
160       IGESAppli_ToolLevelToPWBLayerMap tool;
161       tool.ReadOwnParams(anent,IR,PR);
162     }
163       break;
164     case  8 : {
165       DeclareAndCast(IGESAppli_LineWidening,anent,ent);
166       if (anent.IsNull()) return;
167       IGESAppli_ToolLineWidening tool;
168       tool.ReadOwnParams(anent,IR,PR);
169     }
170       break;
171     case  9 : {
172       DeclareAndCast(IGESAppli_NodalConstraint,anent,ent);
173       if (anent.IsNull()) return;
174       IGESAppli_ToolNodalConstraint tool;
175       tool.ReadOwnParams(anent,IR,PR);
176     }
177       break;
178     case 10 : {
179       DeclareAndCast(IGESAppli_NodalDisplAndRot,anent,ent);
180       if (anent.IsNull()) return;
181       IGESAppli_ToolNodalDisplAndRot tool;
182       tool.ReadOwnParams(anent,IR,PR);
183     }
184       break;
185     case 11 : {
186       DeclareAndCast(IGESAppli_NodalResults,anent,ent);
187       if (anent.IsNull()) return;
188       IGESAppli_ToolNodalResults tool;
189       tool.ReadOwnParams(anent,IR,PR);
190     }
191       break;
192     case 12 : {
193       DeclareAndCast(IGESAppli_Node,anent,ent);
194       if (anent.IsNull()) return;
195       IGESAppli_ToolNode tool;
196       tool.ReadOwnParams(anent,IR,PR);
197     }
198       break;
199     case 13 : {
200       DeclareAndCast(IGESAppli_PWBArtworkStackup,anent,ent);
201       if (anent.IsNull()) return;
202       IGESAppli_ToolPWBArtworkStackup tool;
203       tool.ReadOwnParams(anent,IR,PR);
204     }
205       break;
206     case 14 : {
207       DeclareAndCast(IGESAppli_PWBDrilledHole,anent,ent);
208       if (anent.IsNull()) return;
209       IGESAppli_ToolPWBDrilledHole tool;
210       tool.ReadOwnParams(anent,IR,PR);
211     }
212       break;
213     case 15 : {
214       DeclareAndCast(IGESAppli_PartNumber,anent,ent);
215       if (anent.IsNull()) return;
216       IGESAppli_ToolPartNumber tool;
217       tool.ReadOwnParams(anent,IR,PR);
218     }
219       break;
220     case 16 : {
221       DeclareAndCast(IGESAppli_PinNumber,anent,ent);
222       if (anent.IsNull()) return;
223       IGESAppli_ToolPinNumber tool;
224       tool.ReadOwnParams(anent,IR,PR);
225     }
226       break;
227     case 17 : {
228       DeclareAndCast(IGESAppli_PipingFlow,anent,ent);
229       if (anent.IsNull()) return;
230       IGESAppli_ToolPipingFlow tool;
231       tool.ReadOwnParams(anent,IR,PR);
232     }
233       break;
234     case 18 : {
235       DeclareAndCast(IGESAppli_ReferenceDesignator,anent,ent);
236       if (anent.IsNull()) return;
237       IGESAppli_ToolReferenceDesignator tool;
238       tool.ReadOwnParams(anent,IR,PR);
239     }
240       break;
241     case 19 : {
242       DeclareAndCast(IGESAppli_RegionRestriction,anent,ent);
243       if (anent.IsNull()) return;
244       IGESAppli_ToolRegionRestriction tool;
245       tool.ReadOwnParams(anent,IR,PR);
246     }
247       break;
248     default : break;
249   }
250 }
251
252
253     void  IGESAppli_ReadWriteModule::WriteOwnParams
254   (const Standard_Integer CN,  const Handle(IGESData_IGESEntity)& ent,
255    IGESData_IGESWriter& IW) const
256 {
257   switch (CN) {
258     case  1 : {
259       DeclareAndCast(IGESAppli_DrilledHole,anent,ent);
260       if (anent.IsNull()) return;
261       IGESAppli_ToolDrilledHole tool;
262       tool.WriteOwnParams(anent,IW);
263     }
264       break;
265     case  2 : {
266       DeclareAndCast(IGESAppli_ElementResults,anent,ent);
267       if (anent.IsNull()) return;
268       IGESAppli_ToolElementResults tool;
269       tool.WriteOwnParams(anent,IW);
270     }
271       break;
272     case  3 : {
273       DeclareAndCast(IGESAppli_FiniteElement,anent,ent);
274       if (anent.IsNull()) return;
275       IGESAppli_ToolFiniteElement tool;
276       tool.WriteOwnParams(anent,IW);
277     }
278       break;
279     case  4 : {
280       DeclareAndCast(IGESAppli_Flow,anent,ent);
281       if (anent.IsNull()) return;
282       IGESAppli_ToolFlow tool;
283       tool.WriteOwnParams(anent,IW);
284     }
285       break;
286     case  5 : {
287       DeclareAndCast(IGESAppli_FlowLineSpec,anent,ent);
288       if (anent.IsNull()) return;
289       IGESAppli_ToolFlowLineSpec tool;
290       tool.WriteOwnParams(anent,IW);
291     }
292       break;
293     case  6 : {
294       DeclareAndCast(IGESAppli_LevelFunction,anent,ent);
295       if (anent.IsNull()) return;
296       IGESAppli_ToolLevelFunction tool;
297       tool.WriteOwnParams(anent,IW);
298     }
299       break;
300     case  7 : {
301       DeclareAndCast(IGESAppli_LevelToPWBLayerMap,anent,ent);
302       if (anent.IsNull()) return;
303       IGESAppli_ToolLevelToPWBLayerMap tool;
304       tool.WriteOwnParams(anent,IW);
305     }
306       break;
307     case  8 : {
308       DeclareAndCast(IGESAppli_LineWidening,anent,ent);
309       if (anent.IsNull()) return;
310       IGESAppli_ToolLineWidening tool;
311       tool.WriteOwnParams(anent,IW);
312     }
313       break;
314     case  9 : {
315       DeclareAndCast(IGESAppli_NodalConstraint,anent,ent);
316       if (anent.IsNull()) return;
317       IGESAppli_ToolNodalConstraint tool;
318       tool.WriteOwnParams(anent,IW);
319     }
320       break;
321     case 10 : {
322       DeclareAndCast(IGESAppli_NodalDisplAndRot,anent,ent);
323       if (anent.IsNull()) return;
324       IGESAppli_ToolNodalDisplAndRot tool;
325       tool.WriteOwnParams(anent,IW);
326     }
327       break;
328     case 11 : {
329       DeclareAndCast(IGESAppli_NodalResults,anent,ent);
330       if (anent.IsNull()) return;
331       IGESAppli_ToolNodalResults tool;
332       tool.WriteOwnParams(anent,IW);
333     }
334       break;
335     case 12 : {
336       DeclareAndCast(IGESAppli_Node,anent,ent);
337       if (anent.IsNull()) return;
338       IGESAppli_ToolNode tool;
339       tool.WriteOwnParams(anent,IW);
340     }
341       break;
342     case 13 : {
343       DeclareAndCast(IGESAppli_PWBArtworkStackup,anent,ent);
344       if (anent.IsNull()) return;
345       IGESAppli_ToolPWBArtworkStackup tool;
346       tool.WriteOwnParams(anent,IW);
347     }
348       break;
349     case 14 : {
350       DeclareAndCast(IGESAppli_PWBDrilledHole,anent,ent);
351       if (anent.IsNull()) return;
352       IGESAppli_ToolPWBDrilledHole tool;
353       tool.WriteOwnParams(anent,IW);
354     }
355       break;
356     case 15 : {
357       DeclareAndCast(IGESAppli_PartNumber,anent,ent);
358       if (anent.IsNull()) return;
359       IGESAppli_ToolPartNumber tool;
360       tool.WriteOwnParams(anent,IW);
361     }
362       break;
363     case 16 : {
364       DeclareAndCast(IGESAppli_PinNumber,anent,ent);
365       if (anent.IsNull()) return;
366       IGESAppli_ToolPinNumber tool;
367       tool.WriteOwnParams(anent,IW);
368     }
369       break;
370     case 17 : {
371       DeclareAndCast(IGESAppli_PipingFlow,anent,ent);
372       if (anent.IsNull()) return;
373       IGESAppli_ToolPipingFlow tool;
374       tool.WriteOwnParams(anent,IW);
375     }
376       break;
377     case 18 : {
378       DeclareAndCast(IGESAppli_ReferenceDesignator,anent,ent);
379       if (anent.IsNull()) return;
380       IGESAppli_ToolReferenceDesignator tool;
381       tool.WriteOwnParams(anent,IW);
382     }
383       break;
384     case 19 : {
385       DeclareAndCast(IGESAppli_RegionRestriction,anent,ent);
386       if (anent.IsNull()) return;
387       IGESAppli_ToolRegionRestriction tool;
388       tool.WriteOwnParams(anent,IW);
389     }
390       break;
391     default : break;
392   }
393 }