973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #include <IGESDefs_GeneralModule.ixx> |
15 | #include <Interface_Macros.hxx> |
16 | #include <Interface_Category.hxx> |
17 | |
18 | #include <IGESDefs_AssociativityDef.hxx> |
19 | #include <IGESDefs_AttributeDef.hxx> |
20 | #include <IGESDefs_AttributeTable.hxx> |
21 | #include <IGESDefs_GenericData.hxx> |
22 | #include <IGESDefs_MacroDef.hxx> |
23 | #include <IGESDefs_TabularData.hxx> |
24 | #include <IGESDefs_UnitsData.hxx> |
25 | |
26 | #include <IGESDefs_ToolAssociativityDef.hxx> |
27 | #include <IGESDefs_ToolAttributeDef.hxx> |
28 | #include <IGESDefs_ToolAttributeTable.hxx> |
29 | #include <IGESDefs_ToolGenericData.hxx> |
30 | #include <IGESDefs_ToolMacroDef.hxx> |
31 | #include <IGESDefs_ToolTabularData.hxx> |
32 | #include <IGESDefs_ToolUnitsData.hxx> |
33 | |
34 | |
35 | |
36 | // Each Module is attached to a Protocol : it must interprete Case Numbers |
37 | // (arguments <CN> of various methods) in accordance to values returned by |
38 | // the method TypeNumber from this Protocol |
39 | |
40 | |
b311480e |
41 | IGESDefs_GeneralModule::IGESDefs_GeneralModule () { } |
7fd59977 |
42 | |
43 | |
44 | void IGESDefs_GeneralModule::OwnSharedCase |
45 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
46 | Interface_EntityIterator& iter) const |
47 | { |
48 | switch (CN) { |
49 | case 1 : { |
50 | DeclareAndCast(IGESDefs_AssociativityDef,anent,ent); |
51 | if (anent.IsNull()) return; |
52 | IGESDefs_ToolAssociativityDef tool; |
53 | tool.OwnShared(anent,iter); |
54 | } |
55 | break; |
56 | case 2 : { |
57 | DeclareAndCast(IGESDefs_AttributeDef,anent,ent); |
58 | if (anent.IsNull()) return; |
59 | IGESDefs_ToolAttributeDef tool; |
60 | tool.OwnShared(anent,iter); |
61 | } |
62 | break; |
63 | case 3 : { |
64 | DeclareAndCast(IGESDefs_AttributeTable,anent,ent); |
65 | if (anent.IsNull()) return; |
66 | IGESDefs_ToolAttributeTable tool; |
67 | tool.OwnShared(anent,iter); |
68 | } |
69 | break; |
70 | case 4 : { |
71 | DeclareAndCast(IGESDefs_GenericData,anent,ent); |
72 | if (anent.IsNull()) return; |
73 | IGESDefs_ToolGenericData tool; |
74 | tool.OwnShared(anent,iter); |
75 | } |
76 | break; |
77 | case 5 : { |
78 | DeclareAndCast(IGESDefs_MacroDef,anent,ent); |
79 | if (anent.IsNull()) return; |
80 | IGESDefs_ToolMacroDef tool; |
81 | tool.OwnShared(anent,iter); |
82 | } |
83 | break; |
84 | case 6 : { |
85 | DeclareAndCast(IGESDefs_TabularData,anent,ent); |
86 | if (anent.IsNull()) return; |
87 | IGESDefs_ToolTabularData tool; |
88 | tool.OwnShared(anent,iter); |
89 | } |
90 | break; |
91 | case 7 : { |
92 | DeclareAndCast(IGESDefs_UnitsData,anent,ent); |
93 | if (anent.IsNull()) return; |
94 | IGESDefs_ToolUnitsData tool; |
95 | tool.OwnShared(anent,iter); |
96 | } |
97 | break; |
98 | default : break; |
99 | } |
100 | } |
101 | |
102 | |
103 | IGESData_DirChecker IGESDefs_GeneralModule::DirChecker |
104 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const |
105 | { |
106 | switch (CN) { |
107 | case 1 : { |
108 | DeclareAndCast(IGESDefs_AssociativityDef,anent,ent); |
109 | if (anent.IsNull()) break; |
110 | IGESDefs_ToolAssociativityDef tool; |
111 | return tool.DirChecker(anent); |
112 | } |
113 | case 2 : { |
114 | DeclareAndCast(IGESDefs_AttributeDef,anent,ent); |
115 | if (anent.IsNull()) break; |
116 | IGESDefs_ToolAttributeDef tool; |
117 | return tool.DirChecker(anent); |
118 | } |
119 | case 3 : { |
120 | DeclareAndCast(IGESDefs_AttributeTable,anent,ent); |
121 | if (anent.IsNull()) break; |
122 | IGESDefs_ToolAttributeTable tool; |
123 | return tool.DirChecker(anent); |
124 | } |
125 | case 4 : { |
126 | DeclareAndCast(IGESDefs_GenericData,anent,ent); |
127 | if (anent.IsNull()) break; |
128 | IGESDefs_ToolGenericData tool; |
129 | return tool.DirChecker(anent); |
130 | } |
131 | case 5 : { |
132 | DeclareAndCast(IGESDefs_MacroDef,anent,ent); |
133 | if (anent.IsNull()) break; |
134 | IGESDefs_ToolMacroDef tool; |
135 | return tool.DirChecker(anent); |
136 | } |
137 | case 6 : { |
138 | DeclareAndCast(IGESDefs_TabularData,anent,ent); |
139 | if (anent.IsNull()) break; |
140 | IGESDefs_ToolTabularData tool; |
141 | return tool.DirChecker(anent); |
142 | } |
143 | case 7 : { |
144 | DeclareAndCast(IGESDefs_UnitsData,anent,ent); |
145 | if (anent.IsNull()) break; |
146 | IGESDefs_ToolUnitsData tool; |
147 | return tool.DirChecker(anent); |
148 | } |
149 | default : break; |
150 | } |
151 | return IGESData_DirChecker(); // by default, no specific criterium |
152 | } |
153 | |
154 | |
155 | void IGESDefs_GeneralModule::OwnCheckCase |
156 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
157 | const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const |
158 | { |
159 | switch (CN) { |
160 | case 1 : { |
161 | DeclareAndCast(IGESDefs_AssociativityDef,anent,ent); |
162 | if (anent.IsNull()) return; |
163 | IGESDefs_ToolAssociativityDef tool; |
164 | tool.OwnCheck(anent,shares,ach); |
165 | } |
166 | break; |
167 | case 2 : { |
168 | DeclareAndCast(IGESDefs_AttributeDef,anent,ent); |
169 | if (anent.IsNull()) return; |
170 | IGESDefs_ToolAttributeDef tool; |
171 | tool.OwnCheck(anent,shares,ach); |
172 | } |
173 | break; |
174 | case 3 : { |
175 | DeclareAndCast(IGESDefs_AttributeTable,anent,ent); |
176 | if (anent.IsNull()) return; |
177 | IGESDefs_ToolAttributeTable tool; |
178 | tool.OwnCheck(anent,shares,ach); |
179 | } |
180 | break; |
181 | case 4 : { |
182 | DeclareAndCast(IGESDefs_GenericData,anent,ent); |
183 | if (anent.IsNull()) return; |
184 | IGESDefs_ToolGenericData tool; |
185 | tool.OwnCheck(anent,shares,ach); |
186 | } |
187 | break; |
188 | case 5 : { |
189 | DeclareAndCast(IGESDefs_MacroDef,anent,ent); |
190 | if (anent.IsNull()) return; |
191 | IGESDefs_ToolMacroDef tool; |
192 | tool.OwnCheck(anent,shares,ach); |
193 | } |
194 | break; |
195 | case 6 : { |
196 | DeclareAndCast(IGESDefs_TabularData,anent,ent); |
197 | if (anent.IsNull()) return; |
198 | IGESDefs_ToolTabularData tool; |
199 | tool.OwnCheck(anent,shares,ach); |
200 | } |
201 | break; |
202 | case 7 : { |
203 | DeclareAndCast(IGESDefs_UnitsData,anent,ent); |
204 | if (anent.IsNull()) return; |
205 | IGESDefs_ToolUnitsData tool; |
206 | tool.OwnCheck(anent,shares,ach); |
207 | } |
208 | break; |
209 | default : break; |
210 | } |
211 | } |
212 | |
213 | |
214 | Standard_Boolean IGESDefs_GeneralModule::NewVoid |
215 | (const Standard_Integer CN, Handle(Standard_Transient)& ent) const |
216 | { |
217 | switch (CN) { |
218 | case 1 : ent = new IGESDefs_AssociativityDef; break; |
219 | case 2 : ent = new IGESDefs_AttributeDef; break; |
220 | case 3 : ent = new IGESDefs_AttributeTable; break; |
221 | case 4 : ent = new IGESDefs_GenericData; break; |
222 | case 5 : ent = new IGESDefs_MacroDef; break; |
223 | case 6 : ent = new IGESDefs_TabularData; break; |
224 | case 7 : ent = new IGESDefs_UnitsData; break; |
225 | default : return Standard_False; // by default, Failure on Recognize |
226 | } |
227 | return Standard_True; |
228 | } |
229 | |
230 | |
231 | void IGESDefs_GeneralModule::OwnCopyCase |
232 | (const Standard_Integer CN, |
233 | const Handle(IGESData_IGESEntity)& entfrom, |
234 | const Handle(IGESData_IGESEntity)& entto, |
235 | Interface_CopyTool& TC) const |
236 | { |
237 | switch (CN) { |
238 | case 1 : { |
239 | DeclareAndCast(IGESDefs_AssociativityDef,enfr,entfrom); |
240 | DeclareAndCast(IGESDefs_AssociativityDef,ento,entto); |
241 | IGESDefs_ToolAssociativityDef tool; |
242 | tool.OwnCopy(enfr,ento,TC); |
243 | } |
244 | break; |
245 | case 2 : { |
246 | DeclareAndCast(IGESDefs_AttributeDef,enfr,entfrom); |
247 | DeclareAndCast(IGESDefs_AttributeDef,ento,entto); |
248 | IGESDefs_ToolAttributeDef tool; |
249 | tool.OwnCopy(enfr,ento,TC); |
250 | } |
251 | break; |
252 | case 3 : { |
253 | DeclareAndCast(IGESDefs_AttributeTable,enfr,entfrom); |
254 | DeclareAndCast(IGESDefs_AttributeTable,ento,entto); |
255 | IGESDefs_ToolAttributeTable tool; |
256 | tool.OwnCopy(enfr,ento,TC); |
257 | } |
258 | break; |
259 | case 4 : { |
260 | DeclareAndCast(IGESDefs_GenericData,enfr,entfrom); |
261 | DeclareAndCast(IGESDefs_GenericData,ento,entto); |
262 | IGESDefs_ToolGenericData tool; |
263 | tool.OwnCopy(enfr,ento,TC); |
264 | } |
265 | break; |
266 | case 5 : { |
267 | DeclareAndCast(IGESDefs_MacroDef,enfr,entfrom); |
268 | DeclareAndCast(IGESDefs_MacroDef,ento,entto); |
269 | IGESDefs_ToolMacroDef tool; |
270 | tool.OwnCopy(enfr,ento,TC); |
271 | } |
272 | break; |
273 | case 6 : { |
274 | DeclareAndCast(IGESDefs_TabularData,enfr,entfrom); |
275 | DeclareAndCast(IGESDefs_TabularData,ento,entto); |
276 | IGESDefs_ToolTabularData tool; |
277 | tool.OwnCopy(enfr,ento,TC); |
278 | } |
279 | break; |
280 | case 7 : { |
281 | DeclareAndCast(IGESDefs_UnitsData,enfr,entfrom); |
282 | DeclareAndCast(IGESDefs_UnitsData,ento,entto); |
283 | IGESDefs_ToolUnitsData tool; |
284 | tool.OwnCopy(enfr,ento,TC); |
285 | } |
286 | break; |
287 | default : break; |
288 | } |
289 | } |
290 | |
291 | |
292 | Standard_Integer IGESDefs_GeneralModule::CategoryNumber |
35e08fe8 |
293 | (const Standard_Integer /*CN*/, const Handle(Standard_Transient)& /*ent*/, |
7fd59977 |
294 | const Interface_ShareTool& ) const |
295 | { |
296 | return Interface_Category::Number("Auxiliary"); |
297 | } |