0024186: Eliminate remaining compiler warnings in MSVC++ 2010 64 bit with warning...
[occt.git] / src / QANCollection / QANCollection2.cxx
CommitLineData
b311480e 1// Created on: 2004-03-05
2// Created by: Mikhail KUZMITCHEV
3// Copyright (c) 2004-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
7fd59977 20#include <QANCollection.hxx>
91322f44 21
22#include <Draw.hxx>
7fd59977 23#include <Draw_Interpretor.hxx>
24
25#include <gp_Pnt.hxx>
7fd59977 26
91322f44 27// HashCode and IsEquel must be defined for key types of maps
28Standard_Integer HashCode(const gp_Pnt thePnt, int theUpper)
7fd59977 29{
30 return HashCode(thePnt.X(),theUpper);
31}
32
33Standard_Boolean IsEqual(const gp_Pnt& theP1, const gp_Pnt& theP2)
34{
35 return theP1.IsEqual(theP2,gp::Resolution());
36}
37
38#define ItemType gp_Pnt
39#define Key1Type gp_Pnt
40#define Key2Type Standard_Real
41
42#include <QANCollection_FuncTest.hxx>
43
44IMPLEMENT_HARRAY1(QANCollection_HArray1Func)
45IMPLEMENT_HARRAY2(QANCollection_HArray2Func)
46IMPLEMENT_HSET(QANCollection_HSetFunc)
47IMPLEMENT_HSEQUENCE(QANCollection_HSequenceFunc)
48
49//=======================================================================
50//function : CheckArguments1
51//purpose :
52//=======================================================================
53Standard_Integer CheckArguments1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& Lower, Standard_Integer& Upper)
54{
55 if ( argc != 3) {
56 di << "Usage : " << argv[0] << " Lower Upper" << "\n";
57 return 1;
58 }
91322f44 59 Lower = Draw::Atoi(argv[1]);
60 Upper = Draw::Atoi(argv[2]);
7fd59977 61 if ( Lower > Upper ) {
62 di << "Lower > Upper" << "\n";
63 return 1;
64 }
65 return 0;
66}
67
68//=======================================================================
69//function : CheckArguments2
70//purpose :
71//=======================================================================
72Standard_Integer CheckArguments2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& LowerRow, Standard_Integer& UpperRow, Standard_Integer& LowerCol, Standard_Integer& UpperCol)
73{
74 if ( argc != 5) {
75 di << "Usage : " << argv[0] << " LowerRow UpperRow LowerCol UpperCol" << "\n";
76 return 1;
77 }
91322f44 78 LowerRow = Draw::Atoi(argv[1]);
79 UpperRow = Draw::Atoi(argv[2]);
80 LowerCol = Draw::Atoi(argv[3]);
81 UpperCol = Draw::Atoi(argv[4]);
7fd59977 82 if ( LowerRow > UpperRow ) {
83 di << "LowerRow > UpperRow" << "\n";
84 return 1;
85 }
86 if ( LowerCol > UpperCol ) {
87 di << "LowerCol UpperCol> " << "\n";
88 return 1;
89 }
90 return 0;
91}
92
93
94//=======================================================================
95//function : QANColTestArray1
96//purpose :
97//=======================================================================
98static Standard_Integer QANColTestArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
99{
100 Standard_Integer Lower, Upper;
101 if ( CheckArguments1(di, argc, argv, Lower, Upper) ) {
102 return 1;
103 }
104 QANCollection_Array1Func anArr1(Lower, Upper);
105 TestArray1(anArr1);
106 return 0;
107}
108
109//=======================================================================
110//function : QANColTestArray2
111//purpose :
112//=======================================================================
113static Standard_Integer QANColTestArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
114{
115 Standard_Integer LowerRow, UpperRow, LowerCol, UpperCol;
116 if ( CheckArguments2(di, argc, argv, LowerRow, UpperRow, LowerCol, UpperCol) ) {
117 return 1;
118 }
119 QANCollection_Array2Func anArr2(LowerRow, UpperRow, LowerCol, UpperCol);
120 TestArray2(anArr2);
121 return 0;
122}
123
124//=======================================================================
125//function : QANColTestMap
126//purpose :
127//=======================================================================
128static Standard_Integer QANColTestMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
129{
130 if ( argc != 1) {
131 di << "Usage : " << argv[0] << "\n";
132 return 1;
133 }
134 QANCollection_MapFunc aMap;
135 TestMap(aMap);
136 return 0;
137}
138
139//=======================================================================
140//function : QANColTestDataMap
141//purpose :
142//=======================================================================
143static Standard_Integer QANColTestDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
144{
145 if ( argc != 1) {
146 di << "Usage : " << argv[0] << "\n";
147 return 1;
148 }
149 QANCollection_DataMapFunc aDataMap;
150 TestDataMap(aDataMap);
151 return 0;
152}
153
154//=======================================================================
155//function : QANColTestDoubleMap
156//purpose :
157//=======================================================================
158static Standard_Integer QANColTestDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
159{
160 if ( argc != 1) {
161 di << "Usage : " << argv[0] << "\n";
162 return 1;
163 }
164 QANCollection_DoubleMapFunc aDoubleMap;
165 TestDoubleMap(aDoubleMap);
166 return 0;
167}
168
169//=======================================================================
170//function : QANColTestIndexedMap
171//purpose :
172//=======================================================================
173static Standard_Integer QANColTestIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
174{
175 if ( argc != 1) {
176 di << "Usage : " << argv[0] << "\n";
177 return 1;
178 }
179 QANCollection_IndexedMapFunc aIndexedMap;
180 TestIndexedMap(aIndexedMap);
181 return 0;
182}
183
184//=======================================================================
185//function : QANColTestIndexedDataMap
186//purpose :
187//=======================================================================
188static Standard_Integer QANColTestIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
189{
190 if ( argc != 1) {
191 di << "Usage : " << argv[0] << "\n";
192 return 1;
193 }
194 QANCollection_IDMapFunc aIDMap;
195 TestIndexedDataMap(aIDMap);
196 return 0;
197}
198
199//=======================================================================
200//function : QANColTestList
201//purpose :
202//=======================================================================
203static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
204{
205 if ( argc != 1) {
206 di << "Usage : " << argv[0] << "\n";
207 return 1;
208 }
209 QANCollection_ListFunc aList;
210 TestList(aList);
211 return 0;
212}
213
214//=======================================================================
215//function : QANColTestQueue
216//purpose :
217//=======================================================================
218static Standard_Integer QANColTestQueue(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
219{
220 if ( argc != 1) {
221 di << "Usage : " << argv[0] << "\n";
222 return 1;
223 }
224 QANCollection_QueueFunc aQueue;
225 TestQueue(aQueue);
226 return 0;
227}
228
229//=======================================================================
230//function : QANColTestStack
231//purpose :
232//=======================================================================
233static Standard_Integer QANColTestStack(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
234{
235 if ( argc != 1) {
236 di << "Usage : " << argv[0] << "\n";
237 return 1;
238 }
239 QANCollection_StackFunc aStack;
240 TestStack(aStack);
241 return 0;
242}
243
244//=======================================================================
245//function : QANColTestSet
246//purpose :
247//=======================================================================
248static Standard_Integer QANColTestSet(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
249{
250 if ( argc != 1) {
251 di << "Usage : " << argv[0] << "\n";
252 return 1;
253 }
254 QANCollection_SetFunc aSet;
255 TestSet(aSet);
256 return 0;
257}
258
259//=======================================================================
260//function : QANColTestSList
261//purpose :
262//=======================================================================
263static Standard_Integer QANColTestSList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
264{
265 if ( argc != 1) {
266 di << "Usage : " << argv[0] << "\n";
267 return 1;
268 }
269 QANCollection_SListFunc aSList;
270 TestSList(aSList);
271 return 0;
272}
273
274//=======================================================================
275//function : QANColTestSequence
276//purpose :
277//=======================================================================
278static Standard_Integer QANColTestSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
279{
280 if ( argc != 1) {
281 di << "Usage : " << argv[0] << "\n";
282 return 1;
283 }
284 QANCollection_SequenceFunc aSeq;
285 TestSequence(aSeq);
286 return 0;
287}
288
289void QANCollection::Commands2(Draw_Interpretor& theCommands) {
1365140b 290 const char *group = "QANCollection";
7fd59977 291
292 // from agvCollTest/src/CollectionEXE/FuncTestEXE.cxx
293 theCommands.Add("QANColTestArray1", "QANColTestArray1", __FILE__, QANColTestArray1, group);
294 theCommands.Add("QANColTestArray2", "QANColTestArray2", __FILE__, QANColTestArray2, group);
295 theCommands.Add("QANColTestMap", "QANColTestMap", __FILE__, QANColTestMap, group);
296 theCommands.Add("QANColTestDataMap", "QANColTestDataMap", __FILE__, QANColTestDataMap, group);
297 theCommands.Add("QANColTestDoubleMap", "QANColTestDoubleMap", __FILE__, QANColTestDoubleMap, group);
298 theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group);
299 theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group);
300 theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
301 theCommands.Add("QANColTestQueue", "QANColTestQueue", __FILE__, QANColTestQueue, group);
302 theCommands.Add("QANColTestStack", "QANColTestStack", __FILE__, QANColTestStack, group);
303 theCommands.Add("QANColTestSet", "QANColTestSet", __FILE__, QANColTestSet, group);
304 theCommands.Add("QANColTestSList", "QANColTestSList", __FILE__, QANColTestSList, group);
305 theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group);
306
307 return;
308}