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 <IGESBasic_SpecificModule.ixx> |
15 | #include <Interface_Macros.hxx> |
16 | |
17 | #include <IGESBasic_AssocGroupType.hxx> |
18 | #include <IGESBasic_ExternalRefFile.hxx> |
19 | #include <IGESBasic_ExternalRefFileIndex.hxx> |
20 | #include <IGESBasic_ExternalRefFileName.hxx> |
21 | #include <IGESBasic_ExternalRefLibName.hxx> |
22 | #include <IGESBasic_ExternalRefName.hxx> |
23 | #include <IGESBasic_ExternalReferenceFile.hxx> |
24 | #include <IGESBasic_Group.hxx> |
25 | #include <IGESBasic_GroupWithoutBackP.hxx> |
26 | #include <IGESBasic_Hierarchy.hxx> |
27 | #include <IGESBasic_Name.hxx> |
28 | #include <IGESBasic_OrderedGroup.hxx> |
29 | #include <IGESBasic_OrderedGroupWithoutBackP.hxx> |
30 | #include <IGESBasic_SingleParent.hxx> |
31 | #include <IGESBasic_SingularSubfigure.hxx> |
32 | #include <IGESBasic_SubfigureDef.hxx> |
33 | |
34 | #include <IGESBasic_ToolAssocGroupType.hxx> |
35 | #include <IGESBasic_ToolExternalRefFile.hxx> |
36 | #include <IGESBasic_ToolExternalRefFileIndex.hxx> |
37 | #include <IGESBasic_ToolExternalRefFileName.hxx> |
38 | #include <IGESBasic_ToolExternalRefLibName.hxx> |
39 | #include <IGESBasic_ToolExternalRefName.hxx> |
40 | #include <IGESBasic_ToolExternalReferenceFile.hxx> |
41 | #include <IGESBasic_ToolGroup.hxx> |
42 | #include <IGESBasic_ToolGroupWithoutBackP.hxx> |
43 | #include <IGESBasic_ToolHierarchy.hxx> |
44 | #include <IGESBasic_ToolName.hxx> |
45 | #include <IGESBasic_ToolOrderedGroup.hxx> |
46 | #include <IGESBasic_ToolOrderedGroupWithoutBackP.hxx> |
47 | #include <IGESBasic_ToolSingleParent.hxx> |
48 | #include <IGESBasic_ToolSingularSubfigure.hxx> |
49 | #include <IGESBasic_ToolSubfigureDef.hxx> |
50 | |
51 | #include <Message_Messenger.hxx> |
52 | |
53 | // Each Module is attached to a Protocol : it must interprete Case Numbers |
54 | // (arguments <CN> of various methods) in accordance to values returned by |
55 | // the method TypeNumber from this Protocol |
56 | |
57 | |
b311480e |
58 | IGESBasic_SpecificModule::IGESBasic_SpecificModule() { } |
7fd59977 |
59 | |
60 | |
61 | void IGESBasic_SpecificModule::OwnDump |
62 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
63 | const IGESData_IGESDumper& dumper, const Handle(Message_Messenger)& S, |
64 | const Standard_Integer own) const |
65 | { |
66 | switch (CN) { |
67 | case 1 : { |
68 | DeclareAndCast(IGESBasic_AssocGroupType,anent,ent); |
69 | if (anent.IsNull()) return; |
70 | IGESBasic_ToolAssocGroupType tool; |
71 | tool.OwnDump(anent,dumper,S,own); |
72 | } |
73 | break; |
74 | case 2 : { |
75 | DeclareAndCast(IGESBasic_ExternalRefFile,anent,ent); |
76 | if (anent.IsNull()) return; |
77 | IGESBasic_ToolExternalRefFile tool; |
78 | tool.OwnDump(anent,dumper,S,own); |
79 | } |
80 | break; |
81 | case 3 : { |
82 | DeclareAndCast(IGESBasic_ExternalRefFileIndex,anent,ent); |
83 | if (anent.IsNull()) return; |
84 | IGESBasic_ToolExternalRefFileIndex tool; |
85 | tool.OwnDump(anent,dumper,S,own); |
86 | } |
87 | break; |
88 | case 4 : { |
89 | DeclareAndCast(IGESBasic_ExternalRefFileName,anent,ent); |
90 | if (anent.IsNull()) return; |
91 | IGESBasic_ToolExternalRefFileName tool; |
92 | tool.OwnDump(anent,dumper,S,own); |
93 | } |
94 | break; |
95 | case 5 : { |
96 | DeclareAndCast(IGESBasic_ExternalRefLibName,anent,ent); |
97 | if (anent.IsNull()) return; |
98 | IGESBasic_ToolExternalRefLibName tool; |
99 | tool.OwnDump(anent,dumper,S,own); |
100 | } |
101 | break; |
102 | case 6 : { |
103 | DeclareAndCast(IGESBasic_ExternalRefName,anent,ent); |
104 | if (anent.IsNull()) return; |
105 | IGESBasic_ToolExternalRefName tool; |
106 | tool.OwnDump(anent,dumper,S,own); |
107 | } |
108 | break; |
109 | case 7 : { |
110 | DeclareAndCast(IGESBasic_ExternalReferenceFile,anent,ent); |
111 | if (anent.IsNull()) return; |
112 | IGESBasic_ToolExternalReferenceFile tool; |
113 | tool.OwnDump(anent,dumper,S,own); |
114 | } |
115 | break; |
116 | case 8 : { |
117 | DeclareAndCast(IGESBasic_Group,anent,ent); |
118 | if (anent.IsNull()) return; |
119 | IGESBasic_ToolGroup tool; |
120 | tool.OwnDump(anent,dumper,S,own); |
121 | } |
122 | break; |
123 | case 9 : { |
124 | DeclareAndCast(IGESBasic_GroupWithoutBackP,anent,ent); |
125 | if (anent.IsNull()) return; |
126 | IGESBasic_ToolGroupWithoutBackP tool; |
127 | tool.OwnDump(anent,dumper,S,own); |
128 | } |
129 | break; |
130 | case 10 : { |
131 | DeclareAndCast(IGESBasic_Hierarchy,anent,ent); |
132 | if (anent.IsNull()) return; |
133 | IGESBasic_ToolHierarchy tool; |
134 | tool.OwnDump(anent,dumper,S,own); |
135 | } |
136 | break; |
137 | case 11 : { |
138 | DeclareAndCast(IGESBasic_Name,anent,ent); |
139 | if (anent.IsNull()) return; |
140 | IGESBasic_ToolName tool; |
141 | tool.OwnDump(anent,dumper,S,own); |
142 | } |
143 | break; |
144 | case 12 : { |
145 | DeclareAndCast(IGESBasic_OrderedGroup,anent,ent); |
146 | if (anent.IsNull()) return; |
147 | IGESBasic_ToolOrderedGroup tool; |
148 | tool.OwnDump(anent,dumper,S,own); |
149 | } |
150 | break; |
151 | case 13 : { |
152 | DeclareAndCast(IGESBasic_OrderedGroupWithoutBackP,anent,ent); |
153 | if (anent.IsNull()) return; |
154 | IGESBasic_ToolOrderedGroupWithoutBackP tool; |
155 | tool.OwnDump(anent,dumper,S,own); |
156 | } |
157 | break; |
158 | case 14 : { |
159 | DeclareAndCast(IGESBasic_SingleParent,anent,ent); |
160 | if (anent.IsNull()) return; |
161 | IGESBasic_ToolSingleParent tool; |
162 | tool.OwnDump(anent,dumper,S,own); |
163 | } |
164 | break; |
165 | case 15 : { |
166 | DeclareAndCast(IGESBasic_SingularSubfigure,anent,ent); |
167 | if (anent.IsNull()) return; |
168 | IGESBasic_ToolSingularSubfigure tool; |
169 | tool.OwnDump(anent,dumper,S,own); |
170 | } |
171 | break; |
172 | case 16 : { |
173 | DeclareAndCast(IGESBasic_SubfigureDef,anent,ent); |
174 | if (anent.IsNull()) return; |
175 | IGESBasic_ToolSubfigureDef tool; |
176 | tool.OwnDump(anent,dumper,S,own); |
177 | } |
178 | break; |
179 | default : break; |
180 | } |
181 | } |
182 | |
183 | |
184 | Standard_Boolean IGESBasic_SpecificModule::OwnCorrect |
185 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const |
186 | { |
187 | // Applies only on some types |
188 | switch (CN) { |
189 | case 1 : { |
190 | DeclareAndCast(IGESBasic_AssocGroupType,anent,ent); |
191 | if (anent.IsNull()) break; |
192 | IGESBasic_ToolAssocGroupType tool; |
193 | return tool.OwnCorrect(anent); |
194 | } |
195 | case 8 : { |
196 | DeclareAndCast(IGESBasic_Group,anent,ent); |
197 | if (anent.IsNull()) break; |
198 | IGESBasic_ToolGroup tool; |
199 | return tool.OwnCorrect(anent); |
200 | } |
201 | case 9 : { |
202 | DeclareAndCast(IGESBasic_GroupWithoutBackP,anent,ent); |
203 | if (anent.IsNull()) break; |
204 | IGESBasic_ToolGroupWithoutBackP tool; |
205 | return tool.OwnCorrect(anent); |
206 | } |
207 | case 10 : { |
208 | DeclareAndCast(IGESBasic_Hierarchy,anent,ent); |
209 | if (anent.IsNull()) break; |
210 | IGESBasic_ToolHierarchy tool; |
211 | return tool.OwnCorrect(anent); |
212 | } |
213 | case 11 : { |
214 | DeclareAndCast(IGESBasic_Name,anent,ent); |
215 | if (anent.IsNull()) break; |
216 | IGESBasic_ToolName tool; |
217 | return tool.OwnCorrect(anent); |
218 | } |
219 | case 12 : { |
220 | DeclareAndCast(IGESBasic_OrderedGroup,anent,ent); |
221 | if (anent.IsNull()) break; |
222 | IGESBasic_ToolOrderedGroup tool; |
223 | return tool.OwnCorrect(anent); |
224 | } |
225 | case 13 : { |
226 | DeclareAndCast(IGESBasic_OrderedGroupWithoutBackP,anent,ent); |
227 | if (anent.IsNull()) break; |
228 | IGESBasic_ToolOrderedGroupWithoutBackP tool; |
229 | return tool.OwnCorrect(anent); |
230 | } |
231 | case 14 : { |
232 | DeclareAndCast(IGESBasic_SingleParent,anent,ent); |
233 | if (anent.IsNull()) break; |
234 | IGESBasic_ToolSingleParent tool; |
235 | return tool.OwnCorrect(anent); |
236 | } |
237 | default : break; |
238 | } |
239 | return Standard_False; |
240 | } |