0024784: Move documentation in CDL files to proper location
[occt.git] / src / IGESDefs / IGESDefs_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 #include <IGESDefs_ReadWriteModule.ixx>
15 #include <Interface_Macros.hxx>
16
17 #include <IGESDefs_AssociativityDef.hxx>
18 #include <IGESDefs_AttributeDef.hxx>
19 #include <IGESDefs_AttributeTable.hxx>
20 #include <IGESDefs_GenericData.hxx>
21 #include <IGESDefs_MacroDef.hxx>
22 #include <IGESDefs_TabularData.hxx>
23 #include <IGESDefs_UnitsData.hxx>
24
25 #include <IGESDefs_ToolAssociativityDef.hxx>
26 #include <IGESDefs_ToolAttributeDef.hxx>
27 #include <IGESDefs_ToolAttributeTable.hxx>
28 #include <IGESDefs_ToolGenericData.hxx>
29 #include <IGESDefs_ToolMacroDef.hxx>
30 #include <IGESDefs_ToolTabularData.hxx>
31 #include <IGESDefs_ToolUnitsData.hxx>
32
33
34
35 //  Each Module is attached to a Protocol : it must interprete Case Numbers
36 //  (arguments <CN> of various methods) in accordance to values returned by
37 //  the method TypeNumber from this Protocol
38
39
40 IGESDefs_ReadWriteModule::IGESDefs_ReadWriteModule ()    {  }
41
42
43     Standard_Integer  IGESDefs_ReadWriteModule::CaseIGES
44   (const Standard_Integer typenum, const Standard_Integer formnum) const 
45 {
46   switch (typenum) {
47     case 302 : return  1;
48     case 306 : return  5;
49     case 316 : return  7;
50     case 322 : return  2;
51     case 406 :
52       switch (formnum) {
53         case 11 : return  6;
54         case 27 : return  4;
55         default : break;
56       }
57       break;
58     case 422 : return  3;
59     default : break;
60   }
61   return 0;
62 }
63
64
65     void  IGESDefs_ReadWriteModule::ReadOwnParams
66   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
67    const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const 
68 {
69   switch (CN) {
70     case  1 : {
71       DeclareAndCast(IGESDefs_AssociativityDef,anent,ent);
72       if (anent.IsNull()) return;
73       IGESDefs_ToolAssociativityDef tool;
74       tool.ReadOwnParams(anent,IR,PR);
75     }
76       break;
77     case  2 : {
78       DeclareAndCast(IGESDefs_AttributeDef,anent,ent);
79       if (anent.IsNull()) return;
80       IGESDefs_ToolAttributeDef tool;
81       tool.ReadOwnParams(anent,IR,PR);
82     }
83       break;
84     case  3 : {
85       DeclareAndCast(IGESDefs_AttributeTable,anent,ent);
86       if (anent.IsNull()) return;
87       IGESDefs_ToolAttributeTable tool;
88       tool.ReadOwnParams(anent,IR,PR);
89     }
90       break;
91     case  4 : {
92       DeclareAndCast(IGESDefs_GenericData,anent,ent);
93       if (anent.IsNull()) return;
94       IGESDefs_ToolGenericData tool;
95       tool.ReadOwnParams(anent,IR,PR);
96     }
97       break;
98     case  5 : {
99       DeclareAndCast(IGESDefs_MacroDef,anent,ent);
100       if (anent.IsNull()) return;
101       IGESDefs_ToolMacroDef tool;
102       tool.ReadOwnParams(anent,IR,PR);
103     }
104       break;
105     case  6 : {
106       DeclareAndCast(IGESDefs_TabularData,anent,ent);
107       if (anent.IsNull()) return;
108       IGESDefs_ToolTabularData tool;
109       tool.ReadOwnParams(anent,IR,PR);
110     }
111       break;
112     case  7 : {
113       DeclareAndCast(IGESDefs_UnitsData,anent,ent);
114       if (anent.IsNull()) return;
115       IGESDefs_ToolUnitsData tool;
116       tool.ReadOwnParams(anent,IR,PR);
117     }
118       break;
119     default : break;
120   }
121 }
122
123
124     void  IGESDefs_ReadWriteModule::WriteOwnParams
125   (const Standard_Integer CN,  const Handle(IGESData_IGESEntity)& ent,
126    IGESData_IGESWriter& IW) const
127 {
128   switch (CN) {
129     case  1 : {
130       DeclareAndCast(IGESDefs_AssociativityDef,anent,ent);
131       if (anent.IsNull()) return;
132       IGESDefs_ToolAssociativityDef tool;
133       tool.WriteOwnParams(anent,IW);
134     }
135       break;
136     case  2 : {
137       DeclareAndCast(IGESDefs_AttributeDef,anent,ent);
138       if (anent.IsNull()) return;
139       IGESDefs_ToolAttributeDef tool;
140       tool.WriteOwnParams(anent,IW);
141     }
142       break;
143     case  3 : {
144       DeclareAndCast(IGESDefs_AttributeTable,anent,ent);
145       if (anent.IsNull()) return;
146       IGESDefs_ToolAttributeTable tool;
147       tool.WriteOwnParams(anent,IW);
148     }
149       break;
150     case  4 : {
151       DeclareAndCast(IGESDefs_GenericData,anent,ent);
152       if (anent.IsNull()) return;
153       IGESDefs_ToolGenericData tool;
154       tool.WriteOwnParams(anent,IW);
155     }
156       break;
157     case  5 : {
158       DeclareAndCast(IGESDefs_MacroDef,anent,ent);
159       if (anent.IsNull()) return;
160       IGESDefs_ToolMacroDef tool;
161       tool.WriteOwnParams(anent,IW);
162     }
163       break;
164     case  6 : {
165       DeclareAndCast(IGESDefs_TabularData,anent,ent);
166       if (anent.IsNull()) return;
167       IGESDefs_ToolTabularData tool;
168       tool.WriteOwnParams(anent,IW);
169     }
170       break;
171     case  7 : {
172       DeclareAndCast(IGESDefs_UnitsData,anent,ent);
173       if (anent.IsNull()) return;
174       IGESDefs_ToolUnitsData tool;
175       tool.WriteOwnParams(anent,IW);
176     }
177       break;
178     default : break;
179   }
180 }