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 <IGESData_IGESEntity.hxx>
16 #include <IGESData_IGESReaderData.hxx>
17 #include <IGESData_IGESWriter.hxx>
18 #include <IGESData_ParamReader.hxx>
19 #include <IGESDefs_AssociativityDef.hxx>
20 #include <IGESDefs_AttributeDef.hxx>
21 #include <IGESDefs_AttributeTable.hxx>
22 #include <IGESDefs_GenericData.hxx>
23 #include <IGESDefs_MacroDef.hxx>
24 #include <IGESDefs_ReadWriteModule.hxx>
25 #include <IGESDefs_TabularData.hxx>
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 #include <IGESDefs_UnitsData.hxx>
34 #include <Interface_Macros.hxx>
35 #include <Standard_DomainError.hxx>
36 #include <Standard_Type.hxx>
38 IMPLEMENT_STANDARD_RTTIEXT(IGESDefs_ReadWriteModule,IGESData_ReadWriteModule)
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
43 IGESDefs_ReadWriteModule::IGESDefs_ReadWriteModule () { }
46 Standard_Integer IGESDefs_ReadWriteModule::CaseIGES
47 (const Standard_Integer typenum, const Standard_Integer formnum) const
68 void IGESDefs_ReadWriteModule::ReadOwnParams
69 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
70 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
74 DeclareAndCast(IGESDefs_AssociativityDef,anent,ent);
75 if (anent.IsNull()) return;
76 IGESDefs_ToolAssociativityDef tool;
77 tool.ReadOwnParams(anent,IR,PR);
81 DeclareAndCast(IGESDefs_AttributeDef,anent,ent);
82 if (anent.IsNull()) return;
83 IGESDefs_ToolAttributeDef tool;
84 tool.ReadOwnParams(anent,IR,PR);
88 DeclareAndCast(IGESDefs_AttributeTable,anent,ent);
89 if (anent.IsNull()) return;
90 IGESDefs_ToolAttributeTable tool;
91 tool.ReadOwnParams(anent,IR,PR);
95 DeclareAndCast(IGESDefs_GenericData,anent,ent);
96 if (anent.IsNull()) return;
97 IGESDefs_ToolGenericData tool;
98 tool.ReadOwnParams(anent,IR,PR);
102 DeclareAndCast(IGESDefs_MacroDef,anent,ent);
103 if (anent.IsNull()) return;
104 IGESDefs_ToolMacroDef tool;
105 tool.ReadOwnParams(anent,IR,PR);
109 DeclareAndCast(IGESDefs_TabularData,anent,ent);
110 if (anent.IsNull()) return;
111 IGESDefs_ToolTabularData tool;
112 tool.ReadOwnParams(anent,IR,PR);
116 DeclareAndCast(IGESDefs_UnitsData,anent,ent);
117 if (anent.IsNull()) return;
118 IGESDefs_ToolUnitsData tool;
119 tool.ReadOwnParams(anent,IR,PR);
127 void IGESDefs_ReadWriteModule::WriteOwnParams
128 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
129 IGESData_IGESWriter& IW) const
133 DeclareAndCast(IGESDefs_AssociativityDef,anent,ent);
134 if (anent.IsNull()) return;
135 IGESDefs_ToolAssociativityDef tool;
136 tool.WriteOwnParams(anent,IW);
140 DeclareAndCast(IGESDefs_AttributeDef,anent,ent);
141 if (anent.IsNull()) return;
142 IGESDefs_ToolAttributeDef tool;
143 tool.WriteOwnParams(anent,IW);
147 DeclareAndCast(IGESDefs_AttributeTable,anent,ent);
148 if (anent.IsNull()) return;
149 IGESDefs_ToolAttributeTable tool;
150 tool.WriteOwnParams(anent,IW);
154 DeclareAndCast(IGESDefs_GenericData,anent,ent);
155 if (anent.IsNull()) return;
156 IGESDefs_ToolGenericData tool;
157 tool.WriteOwnParams(anent,IW);
161 DeclareAndCast(IGESDefs_MacroDef,anent,ent);
162 if (anent.IsNull()) return;
163 IGESDefs_ToolMacroDef tool;
164 tool.WriteOwnParams(anent,IW);
168 DeclareAndCast(IGESDefs_TabularData,anent,ent);
169 if (anent.IsNull()) return;
170 IGESDefs_ToolTabularData tool;
171 tool.WriteOwnParams(anent,IW);
175 DeclareAndCast(IGESDefs_UnitsData,anent,ent);
176 if (anent.IsNull()) return;
177 IGESDefs_ToolUnitsData tool;
178 tool.WriteOwnParams(anent,IW);