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