0024186: Eliminate remaining compiler warnings in MSVC++ 2010 64 bit with warning...
[occt.git] / src / QANCollection / QANCollection_FuncArrays.hxx
1 // Created on: 2002-04-30
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-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
20
21
22 #ifndef QANCollection_FuncArrays_HeaderFile
23 #define QANCollection_FuncArrays_HeaderFile
24
25 // ===================== Test methods of Array1 type ==========================
26 ////////////////////////////////void TestArray1  (QANCollection_Array1&     theA1)
27 void TestArray1  (QANCollection_Array1Func&     theA1)
28 {
29   // Bounds
30   Standard_Integer iLow=theA1.Lower();
31   Standard_Integer iUpp=theA1.Upper();
32   Standard_Integer i;
33
34   printf ("Info: testing Array1(%d,%d), %s\n",
35           iLow, iUpp, (theA1.IsDeletable()?"deletable":"frozen"));
36   // C-array constructor, Length, Init
37   ItemType anItem;
38   Random(anItem);
39   theA1.Init (anItem);
40   ItemType * rBlock = new ItemType[theA1.Length()];
41   ////////////////////////////////QANCollection_Array1 aCArr(*rBlock, iLow-100, iUpp-100);
42   QANCollection_Array1Func aCArr(*rBlock, iLow-100, iUpp-100);
43   printf ("      created the same sized preallocated array (%d,%d), %s\n",
44         aCArr.Lower(),aCArr.Upper(),(aCArr.IsDeletable()?"deletable":"frozen"));
45   // *Value, operator()
46   for (i=iLow+1; i<iUpp; i++)
47   {
48     Random (aCArr.ChangeValue (i-101));
49     aCArr.SetValue (i-100, ItemType(aCArr.Value(i-101)));
50     aCArr(i-99) = aCArr(i-100) = aCArr(i-101);
51   }
52   // Handle, copy constructor (including operator=)
53   ////////////////////////////////Handle(QANCollection_HArray1) aHa = new QANCollection_HArray1(aCArr);
54   Handle(QANCollection_HArray1Func) aHa = new QANCollection_HArray1Func(aCArr);
55   // Assign
56   AssignCollection (aHa->ChangeArray1(), theA1);
57 }
58
59 // ===================== Test methods of Array2 type ==========================
60 ////////////////////////////////void TestArray2  (QANCollection_Array2&     theA2)
61 void TestArray2  (QANCollection_Array2Func&     theA2)
62 {
63   // Bounds
64   Standard_Integer iLR=theA2.LowerRow(), iLC=theA2.LowerCol();
65   Standard_Integer iUR=theA2.UpperRow(), iUC=theA2.UpperCol();
66   Standard_Integer i,j;
67
68   printf ("Info: testing Array2 (%d,%d)(%d,%d), %s\n",
69           iLR, iUR, iLC, iUC, (theA2.IsDeletable()?"deletable":"frozen"));
70   // C-array constructor, Length, Init, RowLength, ColLength
71   ItemType anItem;
72   Random(anItem);
73   theA2.Init (anItem);
74   ItemType * rBlock = new ItemType[theA2.Length()];
75   ////////////////////////////////QANCollection_Array2 aCArr(*rBlock, iLR-100, iUR-100, iLC, iUC);
76   QANCollection_Array2Func aCArr(*rBlock, iLR-100, iUR-100, iLC, iUC);
77   printf ("      created the same sized preallocated array (%d*%d), %s\n",
78           aCArr.RowLength(), aCArr.ColLength(),
79           (aCArr.IsDeletable()?"deletable":"frozen"));
80   // *Value, operator()
81   for (i=iLR+1; i<iUR; i++)
82   {
83     for (j=iLC; j<=iUC; j++)
84     {
85       Random (aCArr.ChangeValue (i-101, j));
86       aCArr.SetValue (i-100, j, 
87                       ItemType(aCArr.Value(i-101,j)));
88       aCArr(i-99,j) = aCArr(i-100,j) = aCArr(i-101,j);
89     }
90   }
91   // Handle, copy constructor (including operator=)
92   ////////////////////////////////Handle(QANCollection_HArray2) aHa = new QANCollection_HArray2(aCArr);
93   Handle(QANCollection_HArray2Func) aHa = new QANCollection_HArray2Func(aCArr);
94   // Assign
95   AssignCollection (aHa->ChangeArray2(), theA2);
96 }
97
98 #endif