b311480e |
1 | // Created on: 2004-03-05 |
2 | // Created by: Mikhail KUZMITCHEV |
973c2be1 |
3 | // Copyright (c) 2004-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
973c2be1 |
7 | // This library is free software; you can redistribute it and / or modify it |
8 | // under the terms of the GNU Lesser General Public version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
7fd59977 |
16 | #include <QANCollection.hxx> |
91322f44 |
17 | |
18 | #include <Draw.hxx> |
7fd59977 |
19 | #include <Draw_Interpretor.hxx> |
20 | |
21 | #include <gp_Pnt.hxx> |
7fd59977 |
22 | |
91322f44 |
23 | // HashCode and IsEquel must be defined for key types of maps |
24 | Standard_Integer HashCode(const gp_Pnt thePnt, int theUpper) |
7fd59977 |
25 | { |
26 | return HashCode(thePnt.X(),theUpper); |
27 | } |
28 | |
29 | Standard_Boolean IsEqual(const gp_Pnt& theP1, const gp_Pnt& theP2) |
30 | { |
31 | return theP1.IsEqual(theP2,gp::Resolution()); |
32 | } |
33 | |
34 | #define ItemType gp_Pnt |
35 | #define Key1Type gp_Pnt |
36 | #define Key2Type Standard_Real |
37 | |
38 | #include <QANCollection_FuncTest.hxx> |
39 | |
40 | IMPLEMENT_HARRAY1(QANCollection_HArray1Func) |
41 | IMPLEMENT_HARRAY2(QANCollection_HArray2Func) |
42 | IMPLEMENT_HSET(QANCollection_HSetFunc) |
43 | IMPLEMENT_HSEQUENCE(QANCollection_HSequenceFunc) |
44 | |
45 | //======================================================================= |
46 | //function : CheckArguments1 |
47 | //purpose : |
48 | //======================================================================= |
49 | Standard_Integer CheckArguments1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& Lower, Standard_Integer& Upper) |
50 | { |
51 | if ( argc != 3) { |
52 | di << "Usage : " << argv[0] << " Lower Upper" << "\n"; |
53 | return 1; |
54 | } |
91322f44 |
55 | Lower = Draw::Atoi(argv[1]); |
56 | Upper = Draw::Atoi(argv[2]); |
7fd59977 |
57 | if ( Lower > Upper ) { |
58 | di << "Lower > Upper" << "\n"; |
59 | return 1; |
60 | } |
61 | return 0; |
62 | } |
63 | |
64 | //======================================================================= |
65 | //function : CheckArguments2 |
66 | //purpose : |
67 | //======================================================================= |
68 | Standard_Integer CheckArguments2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& LowerRow, Standard_Integer& UpperRow, Standard_Integer& LowerCol, Standard_Integer& UpperCol) |
69 | { |
70 | if ( argc != 5) { |
71 | di << "Usage : " << argv[0] << " LowerRow UpperRow LowerCol UpperCol" << "\n"; |
72 | return 1; |
73 | } |
91322f44 |
74 | LowerRow = Draw::Atoi(argv[1]); |
75 | UpperRow = Draw::Atoi(argv[2]); |
76 | LowerCol = Draw::Atoi(argv[3]); |
77 | UpperCol = Draw::Atoi(argv[4]); |
7fd59977 |
78 | if ( LowerRow > UpperRow ) { |
79 | di << "LowerRow > UpperRow" << "\n"; |
80 | return 1; |
81 | } |
82 | if ( LowerCol > UpperCol ) { |
83 | di << "LowerCol UpperCol> " << "\n"; |
84 | return 1; |
85 | } |
86 | return 0; |
87 | } |
88 | |
89 | |
90 | //======================================================================= |
91 | //function : QANColTestArray1 |
92 | //purpose : |
93 | //======================================================================= |
94 | static Standard_Integer QANColTestArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
95 | { |
96 | Standard_Integer Lower, Upper; |
97 | if ( CheckArguments1(di, argc, argv, Lower, Upper) ) { |
98 | return 1; |
99 | } |
100 | QANCollection_Array1Func anArr1(Lower, Upper); |
101 | TestArray1(anArr1); |
102 | return 0; |
103 | } |
104 | |
105 | //======================================================================= |
106 | //function : QANColTestArray2 |
107 | //purpose : |
108 | //======================================================================= |
109 | static Standard_Integer QANColTestArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
110 | { |
111 | Standard_Integer LowerRow, UpperRow, LowerCol, UpperCol; |
112 | if ( CheckArguments2(di, argc, argv, LowerRow, UpperRow, LowerCol, UpperCol) ) { |
113 | return 1; |
114 | } |
115 | QANCollection_Array2Func anArr2(LowerRow, UpperRow, LowerCol, UpperCol); |
116 | TestArray2(anArr2); |
117 | return 0; |
118 | } |
119 | |
120 | //======================================================================= |
121 | //function : QANColTestMap |
122 | //purpose : |
123 | //======================================================================= |
124 | static Standard_Integer QANColTestMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
125 | { |
126 | if ( argc != 1) { |
127 | di << "Usage : " << argv[0] << "\n"; |
128 | return 1; |
129 | } |
130 | QANCollection_MapFunc aMap; |
131 | TestMap(aMap); |
132 | return 0; |
133 | } |
134 | |
135 | //======================================================================= |
136 | //function : QANColTestDataMap |
137 | //purpose : |
138 | //======================================================================= |
139 | static Standard_Integer QANColTestDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
140 | { |
141 | if ( argc != 1) { |
142 | di << "Usage : " << argv[0] << "\n"; |
143 | return 1; |
144 | } |
145 | QANCollection_DataMapFunc aDataMap; |
146 | TestDataMap(aDataMap); |
147 | return 0; |
148 | } |
149 | |
150 | //======================================================================= |
151 | //function : QANColTestDoubleMap |
152 | //purpose : |
153 | //======================================================================= |
154 | static Standard_Integer QANColTestDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
155 | { |
156 | if ( argc != 1) { |
157 | di << "Usage : " << argv[0] << "\n"; |
158 | return 1; |
159 | } |
160 | QANCollection_DoubleMapFunc aDoubleMap; |
161 | TestDoubleMap(aDoubleMap); |
162 | return 0; |
163 | } |
164 | |
165 | //======================================================================= |
166 | //function : QANColTestIndexedMap |
167 | //purpose : |
168 | //======================================================================= |
169 | static Standard_Integer QANColTestIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
170 | { |
171 | if ( argc != 1) { |
172 | di << "Usage : " << argv[0] << "\n"; |
173 | return 1; |
174 | } |
175 | QANCollection_IndexedMapFunc aIndexedMap; |
176 | TestIndexedMap(aIndexedMap); |
177 | return 0; |
178 | } |
179 | |
180 | //======================================================================= |
181 | //function : QANColTestIndexedDataMap |
182 | //purpose : |
183 | //======================================================================= |
184 | static Standard_Integer QANColTestIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
185 | { |
186 | if ( argc != 1) { |
187 | di << "Usage : " << argv[0] << "\n"; |
188 | return 1; |
189 | } |
190 | QANCollection_IDMapFunc aIDMap; |
191 | TestIndexedDataMap(aIDMap); |
192 | return 0; |
193 | } |
194 | |
195 | //======================================================================= |
196 | //function : QANColTestList |
197 | //purpose : |
198 | //======================================================================= |
199 | static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
200 | { |
201 | if ( argc != 1) { |
202 | di << "Usage : " << argv[0] << "\n"; |
203 | return 1; |
204 | } |
205 | QANCollection_ListFunc aList; |
206 | TestList(aList); |
207 | return 0; |
208 | } |
209 | |
210 | //======================================================================= |
211 | //function : QANColTestQueue |
212 | //purpose : |
213 | //======================================================================= |
214 | static Standard_Integer QANColTestQueue(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
215 | { |
216 | if ( argc != 1) { |
217 | di << "Usage : " << argv[0] << "\n"; |
218 | return 1; |
219 | } |
220 | QANCollection_QueueFunc aQueue; |
221 | TestQueue(aQueue); |
222 | return 0; |
223 | } |
224 | |
225 | //======================================================================= |
226 | //function : QANColTestStack |
227 | //purpose : |
228 | //======================================================================= |
229 | static Standard_Integer QANColTestStack(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
230 | { |
231 | if ( argc != 1) { |
232 | di << "Usage : " << argv[0] << "\n"; |
233 | return 1; |
234 | } |
235 | QANCollection_StackFunc aStack; |
236 | TestStack(aStack); |
237 | return 0; |
238 | } |
239 | |
240 | //======================================================================= |
241 | //function : QANColTestSet |
242 | //purpose : |
243 | //======================================================================= |
244 | static Standard_Integer QANColTestSet(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
245 | { |
246 | if ( argc != 1) { |
247 | di << "Usage : " << argv[0] << "\n"; |
248 | return 1; |
249 | } |
250 | QANCollection_SetFunc aSet; |
251 | TestSet(aSet); |
252 | return 0; |
253 | } |
254 | |
255 | //======================================================================= |
256 | //function : QANColTestSList |
257 | //purpose : |
258 | //======================================================================= |
259 | static Standard_Integer QANColTestSList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
260 | { |
261 | if ( argc != 1) { |
262 | di << "Usage : " << argv[0] << "\n"; |
263 | return 1; |
264 | } |
265 | QANCollection_SListFunc aSList; |
266 | TestSList(aSList); |
267 | return 0; |
268 | } |
269 | |
270 | //======================================================================= |
271 | //function : QANColTestSequence |
272 | //purpose : |
273 | //======================================================================= |
274 | static Standard_Integer QANColTestSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) |
275 | { |
276 | if ( argc != 1) { |
277 | di << "Usage : " << argv[0] << "\n"; |
278 | return 1; |
279 | } |
280 | QANCollection_SequenceFunc aSeq; |
281 | TestSequence(aSeq); |
282 | return 0; |
283 | } |
284 | |
285 | void QANCollection::Commands2(Draw_Interpretor& theCommands) { |
1365140b |
286 | const char *group = "QANCollection"; |
7fd59977 |
287 | |
288 | // from agvCollTest/src/CollectionEXE/FuncTestEXE.cxx |
289 | theCommands.Add("QANColTestArray1", "QANColTestArray1", __FILE__, QANColTestArray1, group); |
290 | theCommands.Add("QANColTestArray2", "QANColTestArray2", __FILE__, QANColTestArray2, group); |
291 | theCommands.Add("QANColTestMap", "QANColTestMap", __FILE__, QANColTestMap, group); |
292 | theCommands.Add("QANColTestDataMap", "QANColTestDataMap", __FILE__, QANColTestDataMap, group); |
293 | theCommands.Add("QANColTestDoubleMap", "QANColTestDoubleMap", __FILE__, QANColTestDoubleMap, group); |
294 | theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group); |
295 | theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group); |
296 | theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group); |
297 | theCommands.Add("QANColTestQueue", "QANColTestQueue", __FILE__, QANColTestQueue, group); |
298 | theCommands.Add("QANColTestStack", "QANColTestStack", __FILE__, QANColTestStack, group); |
299 | theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group); |
300 | theCommands.Add("QANColTestSList", "QANColTestSList", __FILE__, QANColTestSList, group); |
301 | theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group); |
302 | |
303 | return; |
304 | } |