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