1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <IGESBasic_AssocGroupType.hxx>
16 #include <IGESBasic_ExternalReferenceFile.hxx>
17 #include <IGESBasic_ExternalRefFile.hxx>
18 #include <IGESBasic_ExternalRefFileIndex.hxx>
19 #include <IGESBasic_ExternalRefFileName.hxx>
20 #include <IGESBasic_ExternalRefLibName.hxx>
21 #include <IGESBasic_ExternalRefName.hxx>
22 #include <IGESBasic_Group.hxx>
23 #include <IGESBasic_GroupWithoutBackP.hxx>
24 #include <IGESBasic_Hierarchy.hxx>
25 #include <IGESBasic_Name.hxx>
26 #include <IGESBasic_OrderedGroup.hxx>
27 #include <IGESBasic_OrderedGroupWithoutBackP.hxx>
28 #include <IGESBasic_ReadWriteModule.hxx>
29 #include <IGESBasic_SingleParent.hxx>
30 #include <IGESBasic_SingularSubfigure.hxx>
31 #include <IGESBasic_SubfigureDef.hxx>
32 #include <IGESBasic_ToolAssocGroupType.hxx>
33 #include <IGESBasic_ToolExternalReferenceFile.hxx>
34 #include <IGESBasic_ToolExternalRefFile.hxx>
35 #include <IGESBasic_ToolExternalRefFileIndex.hxx>
36 #include <IGESBasic_ToolExternalRefFileName.hxx>
37 #include <IGESBasic_ToolExternalRefLibName.hxx>
38 #include <IGESBasic_ToolExternalRefName.hxx>
39 #include <IGESBasic_ToolGroup.hxx>
40 #include <IGESBasic_ToolGroupWithoutBackP.hxx>
41 #include <IGESBasic_ToolHierarchy.hxx>
42 #include <IGESBasic_ToolName.hxx>
43 #include <IGESBasic_ToolOrderedGroup.hxx>
44 #include <IGESBasic_ToolOrderedGroupWithoutBackP.hxx>
45 #include <IGESBasic_ToolSingleParent.hxx>
46 #include <IGESBasic_ToolSingularSubfigure.hxx>
47 #include <IGESBasic_ToolSubfigureDef.hxx>
48 #include <IGESData_IGESEntity.hxx>
49 #include <IGESData_IGESReaderData.hxx>
50 #include <IGESData_IGESWriter.hxx>
51 #include <IGESData_ParamReader.hxx>
52 #include <Interface_Macros.hxx>
53 #include <Standard_DomainError.hxx>
54 #include <Standard_Type.hxx>
56 IMPLEMENT_STANDARD_RTTIEXT(IGESBasic_ReadWriteModule,IGESData_ReadWriteModule)
58 // Each Module is attached to a Protocol : it must interprete Case Numbers
59 // (arguments <CN> of various methods) in accordance to values returned by
60 // the method TypeNumber from this Protocol
61 IGESBasic_ReadWriteModule::IGESBasic_ReadWriteModule () { }
64 Standard_Integer IGESBasic_ReadWriteModule::CaseIGES
65 (const Standard_Integer typenum, const Standard_Integer formnum) const
106 void IGESBasic_ReadWriteModule::ReadOwnParams
107 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
108 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
112 DeclareAndCast(IGESBasic_AssocGroupType,anent,ent);
113 if (anent.IsNull()) return;
114 IGESBasic_ToolAssocGroupType tool;
115 tool.ReadOwnParams(anent,IR,PR);
119 DeclareAndCast(IGESBasic_ExternalRefFile,anent,ent);
120 if (anent.IsNull()) return;
121 IGESBasic_ToolExternalRefFile tool;
122 tool.ReadOwnParams(anent,IR,PR);
126 DeclareAndCast(IGESBasic_ExternalRefFileIndex,anent,ent);
127 if (anent.IsNull()) return;
128 IGESBasic_ToolExternalRefFileIndex tool;
129 tool.ReadOwnParams(anent,IR,PR);
133 DeclareAndCast(IGESBasic_ExternalRefFileName,anent,ent);
134 if (anent.IsNull()) return;
135 IGESBasic_ToolExternalRefFileName tool;
136 tool.ReadOwnParams(anent,IR,PR);
140 DeclareAndCast(IGESBasic_ExternalRefLibName,anent,ent);
141 if (anent.IsNull()) return;
142 IGESBasic_ToolExternalRefLibName tool;
143 tool.ReadOwnParams(anent,IR,PR);
147 DeclareAndCast(IGESBasic_ExternalRefName,anent,ent);
148 if (anent.IsNull()) return;
149 IGESBasic_ToolExternalRefName tool;
150 tool.ReadOwnParams(anent,IR,PR);
154 DeclareAndCast(IGESBasic_ExternalReferenceFile,anent,ent);
155 if (anent.IsNull()) return;
156 IGESBasic_ToolExternalReferenceFile tool;
157 tool.ReadOwnParams(anent,IR,PR);
161 DeclareAndCast(IGESBasic_Group,anent,ent);
162 if (anent.IsNull()) return;
163 IGESBasic_ToolGroup tool;
164 tool.ReadOwnParams(anent,IR,PR);
168 DeclareAndCast(IGESBasic_GroupWithoutBackP,anent,ent);
169 if (anent.IsNull()) return;
170 IGESBasic_ToolGroupWithoutBackP tool;
171 tool.ReadOwnParams(anent,IR,PR);
175 DeclareAndCast(IGESBasic_Hierarchy,anent,ent);
176 if (anent.IsNull()) return;
177 IGESBasic_ToolHierarchy tool;
178 tool.ReadOwnParams(anent,IR,PR);
182 DeclareAndCast(IGESBasic_Name,anent,ent);
183 if (anent.IsNull()) return;
184 IGESBasic_ToolName tool;
185 tool.ReadOwnParams(anent,IR,PR);
189 DeclareAndCast(IGESBasic_OrderedGroup,anent,ent);
190 if (anent.IsNull()) return;
191 IGESBasic_ToolOrderedGroup tool;
192 tool.ReadOwnParams(anent,IR,PR);
196 DeclareAndCast(IGESBasic_OrderedGroupWithoutBackP,anent,ent);
197 if (anent.IsNull()) return;
198 IGESBasic_ToolOrderedGroupWithoutBackP tool;
199 tool.ReadOwnParams(anent,IR,PR);
203 DeclareAndCast(IGESBasic_SingleParent,anent,ent);
204 if (anent.IsNull()) return;
205 IGESBasic_ToolSingleParent tool;
206 tool.ReadOwnParams(anent,IR,PR);
210 DeclareAndCast(IGESBasic_SingularSubfigure,anent,ent);
211 if (anent.IsNull()) return;
212 IGESBasic_ToolSingularSubfigure tool;
213 tool.ReadOwnParams(anent,IR,PR);
217 DeclareAndCast(IGESBasic_SubfigureDef,anent,ent);
218 if (anent.IsNull()) return;
219 IGESBasic_ToolSubfigureDef tool;
220 tool.ReadOwnParams(anent,IR,PR);
228 void IGESBasic_ReadWriteModule::WriteOwnParams
229 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
230 IGESData_IGESWriter& IW) const
234 DeclareAndCast(IGESBasic_AssocGroupType,anent,ent);
235 if (anent.IsNull()) return;
236 IGESBasic_ToolAssocGroupType tool;
237 tool.WriteOwnParams(anent,IW);
241 DeclareAndCast(IGESBasic_ExternalRefFile,anent,ent);
242 if (anent.IsNull()) return;
243 IGESBasic_ToolExternalRefFile tool;
244 tool.WriteOwnParams(anent,IW);
248 DeclareAndCast(IGESBasic_ExternalRefFileIndex,anent,ent);
249 if (anent.IsNull()) return;
250 IGESBasic_ToolExternalRefFileIndex tool;
251 tool.WriteOwnParams(anent,IW);
255 DeclareAndCast(IGESBasic_ExternalRefFileName,anent,ent);
256 if (anent.IsNull()) return;
257 IGESBasic_ToolExternalRefFileName tool;
258 tool.WriteOwnParams(anent,IW);
262 DeclareAndCast(IGESBasic_ExternalRefLibName,anent,ent);
263 if (anent.IsNull()) return;
264 IGESBasic_ToolExternalRefLibName tool;
265 tool.WriteOwnParams(anent,IW);
269 DeclareAndCast(IGESBasic_ExternalRefName,anent,ent);
270 if (anent.IsNull()) return;
271 IGESBasic_ToolExternalRefName tool;
272 tool.WriteOwnParams(anent,IW);
276 DeclareAndCast(IGESBasic_ExternalReferenceFile,anent,ent);
277 if (anent.IsNull()) return;
278 IGESBasic_ToolExternalReferenceFile tool;
279 tool.WriteOwnParams(anent,IW);
283 DeclareAndCast(IGESBasic_Group,anent,ent);
284 if (anent.IsNull()) return;
285 IGESBasic_ToolGroup tool;
286 tool.WriteOwnParams(anent,IW);
290 DeclareAndCast(IGESBasic_GroupWithoutBackP,anent,ent);
291 if (anent.IsNull()) return;
292 IGESBasic_ToolGroupWithoutBackP tool;
293 tool.WriteOwnParams(anent,IW);
297 DeclareAndCast(IGESBasic_Hierarchy,anent,ent);
298 if (anent.IsNull()) return;
299 IGESBasic_ToolHierarchy tool;
300 tool.WriteOwnParams(anent,IW);
304 DeclareAndCast(IGESBasic_Name,anent,ent);
305 if (anent.IsNull()) return;
306 IGESBasic_ToolName tool;
307 tool.WriteOwnParams(anent,IW);
311 DeclareAndCast(IGESBasic_OrderedGroup,anent,ent);
312 if (anent.IsNull()) return;
313 IGESBasic_ToolOrderedGroup tool;
314 tool.WriteOwnParams(anent,IW);
318 DeclareAndCast(IGESBasic_OrderedGroupWithoutBackP,anent,ent);
319 if (anent.IsNull()) return;
320 IGESBasic_ToolOrderedGroupWithoutBackP tool;
321 tool.WriteOwnParams(anent,IW);
325 DeclareAndCast(IGESBasic_SingleParent,anent,ent);
326 if (anent.IsNull()) return;
327 IGESBasic_ToolSingleParent tool;
328 tool.WriteOwnParams(anent,IW);
332 DeclareAndCast(IGESBasic_SingularSubfigure,anent,ent);
333 if (anent.IsNull()) return;
334 IGESBasic_ToolSingularSubfigure tool;
335 tool.WriteOwnParams(anent,IW);
339 DeclareAndCast(IGESBasic_SubfigureDef,anent,ent);
340 if (anent.IsNull()) return;
341 IGESBasic_ToolSubfigureDef tool;
342 tool.WriteOwnParams(anent,IW);