1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
18 #include <IGESDefs_GeneralModule.ixx>
19 #include <Interface_Macros.hxx>
20 #include <Interface_Category.hxx>
22 #include <IGESDefs_AssociativityDef.hxx>
23 #include <IGESDefs_AttributeDef.hxx>
24 #include <IGESDefs_AttributeTable.hxx>
25 #include <IGESDefs_GenericData.hxx>
26 #include <IGESDefs_MacroDef.hxx>
27 #include <IGESDefs_TabularData.hxx>
28 #include <IGESDefs_UnitsData.hxx>
30 #include <IGESDefs_ToolAssociativityDef.hxx>
31 #include <IGESDefs_ToolAttributeDef.hxx>
32 #include <IGESDefs_ToolAttributeTable.hxx>
33 #include <IGESDefs_ToolGenericData.hxx>
34 #include <IGESDefs_ToolMacroDef.hxx>
35 #include <IGESDefs_ToolTabularData.hxx>
36 #include <IGESDefs_ToolUnitsData.hxx>
40 // Each Module is attached to a Protocol : it must interprete Case Numbers
41 // (arguments <CN> of various methods) in accordance to values returned by
42 // the method TypeNumber from this Protocol
45 IGESDefs_GeneralModule::IGESDefs_GeneralModule () { }
48 void IGESDefs_GeneralModule::OwnSharedCase
49 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
50 Interface_EntityIterator& iter) const
54 DeclareAndCast(IGESDefs_AssociativityDef,anent,ent);
55 if (anent.IsNull()) return;
56 IGESDefs_ToolAssociativityDef tool;
57 tool.OwnShared(anent,iter);
61 DeclareAndCast(IGESDefs_AttributeDef,anent,ent);
62 if (anent.IsNull()) return;
63 IGESDefs_ToolAttributeDef tool;
64 tool.OwnShared(anent,iter);
68 DeclareAndCast(IGESDefs_AttributeTable,anent,ent);
69 if (anent.IsNull()) return;
70 IGESDefs_ToolAttributeTable tool;
71 tool.OwnShared(anent,iter);
75 DeclareAndCast(IGESDefs_GenericData,anent,ent);
76 if (anent.IsNull()) return;
77 IGESDefs_ToolGenericData tool;
78 tool.OwnShared(anent,iter);
82 DeclareAndCast(IGESDefs_MacroDef,anent,ent);
83 if (anent.IsNull()) return;
84 IGESDefs_ToolMacroDef tool;
85 tool.OwnShared(anent,iter);
89 DeclareAndCast(IGESDefs_TabularData,anent,ent);
90 if (anent.IsNull()) return;
91 IGESDefs_ToolTabularData tool;
92 tool.OwnShared(anent,iter);
96 DeclareAndCast(IGESDefs_UnitsData,anent,ent);
97 if (anent.IsNull()) return;
98 IGESDefs_ToolUnitsData tool;
99 tool.OwnShared(anent,iter);
107 IGESData_DirChecker IGESDefs_GeneralModule::DirChecker
108 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const
112 DeclareAndCast(IGESDefs_AssociativityDef,anent,ent);
113 if (anent.IsNull()) break;
114 IGESDefs_ToolAssociativityDef tool;
115 return tool.DirChecker(anent);
118 DeclareAndCast(IGESDefs_AttributeDef,anent,ent);
119 if (anent.IsNull()) break;
120 IGESDefs_ToolAttributeDef tool;
121 return tool.DirChecker(anent);
124 DeclareAndCast(IGESDefs_AttributeTable,anent,ent);
125 if (anent.IsNull()) break;
126 IGESDefs_ToolAttributeTable tool;
127 return tool.DirChecker(anent);
130 DeclareAndCast(IGESDefs_GenericData,anent,ent);
131 if (anent.IsNull()) break;
132 IGESDefs_ToolGenericData tool;
133 return tool.DirChecker(anent);
136 DeclareAndCast(IGESDefs_MacroDef,anent,ent);
137 if (anent.IsNull()) break;
138 IGESDefs_ToolMacroDef tool;
139 return tool.DirChecker(anent);
142 DeclareAndCast(IGESDefs_TabularData,anent,ent);
143 if (anent.IsNull()) break;
144 IGESDefs_ToolTabularData tool;
145 return tool.DirChecker(anent);
148 DeclareAndCast(IGESDefs_UnitsData,anent,ent);
149 if (anent.IsNull()) break;
150 IGESDefs_ToolUnitsData tool;
151 return tool.DirChecker(anent);
155 return IGESData_DirChecker(); // by default, no specific criterium
159 void IGESDefs_GeneralModule::OwnCheckCase
160 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
161 const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const
165 DeclareAndCast(IGESDefs_AssociativityDef,anent,ent);
166 if (anent.IsNull()) return;
167 IGESDefs_ToolAssociativityDef tool;
168 tool.OwnCheck(anent,shares,ach);
172 DeclareAndCast(IGESDefs_AttributeDef,anent,ent);
173 if (anent.IsNull()) return;
174 IGESDefs_ToolAttributeDef tool;
175 tool.OwnCheck(anent,shares,ach);
179 DeclareAndCast(IGESDefs_AttributeTable,anent,ent);
180 if (anent.IsNull()) return;
181 IGESDefs_ToolAttributeTable tool;
182 tool.OwnCheck(anent,shares,ach);
186 DeclareAndCast(IGESDefs_GenericData,anent,ent);
187 if (anent.IsNull()) return;
188 IGESDefs_ToolGenericData tool;
189 tool.OwnCheck(anent,shares,ach);
193 DeclareAndCast(IGESDefs_MacroDef,anent,ent);
194 if (anent.IsNull()) return;
195 IGESDefs_ToolMacroDef tool;
196 tool.OwnCheck(anent,shares,ach);
200 DeclareAndCast(IGESDefs_TabularData,anent,ent);
201 if (anent.IsNull()) return;
202 IGESDefs_ToolTabularData tool;
203 tool.OwnCheck(anent,shares,ach);
207 DeclareAndCast(IGESDefs_UnitsData,anent,ent);
208 if (anent.IsNull()) return;
209 IGESDefs_ToolUnitsData tool;
210 tool.OwnCheck(anent,shares,ach);
218 Standard_Boolean IGESDefs_GeneralModule::NewVoid
219 (const Standard_Integer CN, Handle(Standard_Transient)& ent) const
222 case 1 : ent = new IGESDefs_AssociativityDef; break;
223 case 2 : ent = new IGESDefs_AttributeDef; break;
224 case 3 : ent = new IGESDefs_AttributeTable; break;
225 case 4 : ent = new IGESDefs_GenericData; break;
226 case 5 : ent = new IGESDefs_MacroDef; break;
227 case 6 : ent = new IGESDefs_TabularData; break;
228 case 7 : ent = new IGESDefs_UnitsData; break;
229 default : return Standard_False; // by default, Failure on Recognize
231 return Standard_True;
235 void IGESDefs_GeneralModule::OwnCopyCase
236 (const Standard_Integer CN,
237 const Handle(IGESData_IGESEntity)& entfrom,
238 const Handle(IGESData_IGESEntity)& entto,
239 Interface_CopyTool& TC) const
243 DeclareAndCast(IGESDefs_AssociativityDef,enfr,entfrom);
244 DeclareAndCast(IGESDefs_AssociativityDef,ento,entto);
245 IGESDefs_ToolAssociativityDef tool;
246 tool.OwnCopy(enfr,ento,TC);
250 DeclareAndCast(IGESDefs_AttributeDef,enfr,entfrom);
251 DeclareAndCast(IGESDefs_AttributeDef,ento,entto);
252 IGESDefs_ToolAttributeDef tool;
253 tool.OwnCopy(enfr,ento,TC);
257 DeclareAndCast(IGESDefs_AttributeTable,enfr,entfrom);
258 DeclareAndCast(IGESDefs_AttributeTable,ento,entto);
259 IGESDefs_ToolAttributeTable tool;
260 tool.OwnCopy(enfr,ento,TC);
264 DeclareAndCast(IGESDefs_GenericData,enfr,entfrom);
265 DeclareAndCast(IGESDefs_GenericData,ento,entto);
266 IGESDefs_ToolGenericData tool;
267 tool.OwnCopy(enfr,ento,TC);
271 DeclareAndCast(IGESDefs_MacroDef,enfr,entfrom);
272 DeclareAndCast(IGESDefs_MacroDef,ento,entto);
273 IGESDefs_ToolMacroDef tool;
274 tool.OwnCopy(enfr,ento,TC);
278 DeclareAndCast(IGESDefs_TabularData,enfr,entfrom);
279 DeclareAndCast(IGESDefs_TabularData,ento,entto);
280 IGESDefs_ToolTabularData tool;
281 tool.OwnCopy(enfr,ento,TC);
285 DeclareAndCast(IGESDefs_UnitsData,enfr,entfrom);
286 DeclareAndCast(IGESDefs_UnitsData,ento,entto);
287 IGESDefs_ToolUnitsData tool;
288 tool.OwnCopy(enfr,ento,TC);
296 Standard_Integer IGESDefs_GeneralModule::CategoryNumber
297 (const Standard_Integer CN, const Handle(Standard_Transient)& ent,
298 const Interface_ShareTool& ) const
300 return Interface_Category::Number("Auxiliary");