1 // Created on: 2002-05-15
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License 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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef QANCollection_Common3_HeaderFile
17 #define QANCollection_Common3_HeaderFile
22 #include <QANCollection_Common.hxx>
24 // ===================== INSTANTIATIONS ===========
25 // ===================== The Types must be defined before this line ===========
26 // These are: TheItemType, TheKey1Type, TheKey2Type
27 // So must be defined ::HashCode and ::IsEqual too
29 #if defined(ItemType) && defined(Key1Type) && defined(Key2Type)
31 #include <NCollection_DefineBaseCollection.hxx>
32 ////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_BaseCol,ItemType)
33 ////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_Key1BaseCol,Key1Type)
34 ////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_Key2BaseCol,Key2Type)
35 DEFINE_BASECOLLECTION(QANCollection_BaseColPerf,ItemType)
36 DEFINE_BASECOLLECTION(QANCollection_Key1BaseColPerf,Key1Type)
37 DEFINE_BASECOLLECTION(QANCollection_Key2BaseColPerf,Key2Type)
39 #include <NCollection_DefineArray1.hxx>
40 #include <NCollection_DefineHArray1.hxx>
41 ////////////////////////////////DEFINE_ARRAY1(QANCollection_Array1,QANCollection_BaseCol,ItemType)
42 ////////////////////////////////DEFINE_HARRAY1(QANCollection_HArray1,QANCollection_Array1)
43 DEFINE_ARRAY1(QANCollection_Array1Perf,QANCollection_BaseColPerf,ItemType)
44 DEFINE_HARRAY1(QANCollection_HArray1Perf,QANCollection_Array1Perf)
46 #include <NCollection_DefineArray2.hxx>
47 #include <NCollection_DefineHArray2.hxx>
48 ////////////////////////////////DEFINE_ARRAY2(QANCollection_Array2,QANCollection_BaseCol,ItemType)
49 ////////////////////////////////DEFINE_HARRAY2(QANCollection_HArray2,QANCollection_Array2)
50 DEFINE_ARRAY2(QANCollection_Array2Perf,QANCollection_BaseColPerf,ItemType)
51 DEFINE_HARRAY2(QANCollection_HArray2Perf,QANCollection_Array2Perf)
53 #include <NCollection_DefineMap.hxx>
54 #include <NCollection_DefineDataMap.hxx>
55 #include <NCollection_DefineDoubleMap.hxx>
56 #include <NCollection_DefineIndexedMap.hxx>
57 #include <NCollection_DefineIndexedDataMap.hxx>
58 ////////////////////////////////DEFINE_MAP(QANCollection_Map,QANCollection_Key1BaseCol,Key1Type)
59 ////////////////////////////////DEFINE_DATAMAP(QANCollection_DataMap,QANCollection_BaseCol,Key1Type,ItemType)
60 ////////////////////////////////DEFINE_DOUBLEMAP(QANCollection_DoubleMap,QANCollection_Key2BaseCol,Key1Type,Key2Type)
61 ////////////////////////////////DEFINE_INDEXEDMAP(QANCollection_IndexedMap,QANCollection_Key1BaseCol,Key1Type)
62 ////////////////////////////////DEFINE_INDEXEDDATAMAP(QANCollection_IDMap,QANCollection_BaseCol,Key1Type,ItemType)
63 DEFINE_MAP(QANCollection_MapPerf,QANCollection_Key1BaseColPerf,Key1Type)
64 DEFINE_DATAMAP(QANCollection_DataMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType)
65 DEFINE_DOUBLEMAP(QANCollection_DoubleMapPerf,QANCollection_Key2BaseColPerf,Key1Type,Key2Type)
66 DEFINE_INDEXEDMAP(QANCollection_IndexedMapPerf,QANCollection_Key1BaseColPerf,Key1Type)
67 DEFINE_INDEXEDDATAMAP(QANCollection_IDMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType)
69 #include <NCollection_DefineList.hxx>
70 #include <NCollection_DefineStack.hxx>
71 #include <NCollection_DefineSet.hxx>
72 #include <NCollection_DefineHSet.hxx>
73 ////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
74 ////////////////////////////////DEFINE_STACK(QANCollection_Stack,QANCollection_BaseCol,ItemType)
75 ////////////////////////////////DEFINE_SET(QANCollection_Set,QANCollection_Key2BaseCol,Key2Type)
76 ////////////////////////////////DEFINE_HSET(QANCollection_HSet,QANCollection_Set)
77 DEFINE_LIST(QANCollection_ListPerf,QANCollection_BaseColPerf,ItemType)
78 DEFINE_STACK(QANCollection_StackPerf,QANCollection_BaseColPerf,ItemType)
79 DEFINE_SET(QANCollection_SetPerf,QANCollection_Key2BaseColPerf,Key2Type)
80 DEFINE_HSET(QANCollection_HSetPerf,QANCollection_SetPerf)
82 #include <NCollection_DefineSequence.hxx>
83 #include <NCollection_DefineHSequence.hxx>
84 ////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
85 ////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
86 DEFINE_SEQUENCE(QANCollection_SequencePerf,QANCollection_BaseColPerf,ItemType)
87 DEFINE_HSEQUENCE(QANCollection_HSequencePerf,QANCollection_SequencePerf)
90 // ===================== Type independent methods =============================
91 ////////////////////////////////void printCollection (QANCollection_BaseCol& aColl,
93 void printCollection (QANCollection_BaseColPerf& aColl,
97 Standard_Integer iSize = aColl.Size();
98 ////////////////////////////////QANCollection_BaseCol::Iterator& anIter = aColl.CreateIterator();
99 QANCollection_BaseColPerf::Iterator& anIter = aColl.CreateIterator();
103 printf (" <Empty collection>\n");
105 printf ("Error : empty collection has size==%d",iSize);
109 printf (" Size==%d\n",iSize);
110 for (; anIter.More(); anIter.Next())
111 PrintItem(anIter.Value());
115 ////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
116 void printCollection (QANCollection_Key1BaseColPerf& aColl,
119 printf ("%s:\n",str);
120 Standard_Integer iSize = aColl.Size();
121 ////////////////////////////////QANCollection_Key1BaseCol::Iterator& anIter = aColl.CreateIterator();
122 QANCollection_Key1BaseColPerf::Iterator& anIter = aColl.CreateIterator();
126 printf (" <Empty collection>\n");
128 printf ("Error : empty collection has size==%d",iSize);
132 printf (" Size==%d\n",iSize);
133 for (; anIter.More(); anIter.Next())
134 PrintItem(anIter.Value());
138 ////////////////////////////////void printCollection (QANCollection_Key2BaseCol& aColl,
139 void printCollection (QANCollection_Key2BaseColPerf& aColl,
142 printf ("%s:\n",str);
143 Standard_Integer iSize = aColl.Size();
144 ////////////////////////////////QANCollection_Key2BaseCol::Iterator& anIter = aColl.CreateIterator();
145 QANCollection_Key2BaseColPerf::Iterator& anIter = aColl.CreateIterator();
149 printf (" <Empty collection>\n");
151 printf ("Error : empty collection has size==%d",iSize);
155 printf (" Size==%d\n",iSize);
156 for (; anIter.More(); anIter.Next())
157 PrintItem(anIter.Value());
161 ////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
162 //////////////////////////////// QANCollection_BaseCol& aCollDst)
163 void AssignCollection (QANCollection_BaseColPerf& aCollSrc,
164 QANCollection_BaseColPerf& aCollDst)
166 printCollection (aCollSrc,"Source collection");
167 aCollDst.Assign(aCollSrc);
168 printCollection (aCollDst,"Target collection");
171 ////////////////////////////////void AssignCollection (QANCollection_Key1BaseCol& aCollSrc,
172 //////////////////////////////// QANCollection_Key1BaseCol& aCollDst)
173 void AssignCollection (QANCollection_Key1BaseColPerf& aCollSrc,
174 QANCollection_Key1BaseColPerf& aCollDst)
176 printCollection (aCollSrc,"Source collection");
177 aCollDst.Assign(aCollSrc);
178 printCollection (aCollDst,"Target collection");
181 ////////////////////////////////void AssignCollection (QANCollection_Key2BaseCol& aCollSrc,
182 //////////////////////////////// QANCollection_Key2BaseCol& aCollDst)
183 void AssignCollection (QANCollection_Key2BaseColPerf& aCollSrc,
184 QANCollection_Key2BaseColPerf& aCollDst)
186 printCollection (aCollSrc,"Source collection");
187 aCollDst.Assign(aCollSrc);
188 printCollection (aCollDst,"Target collection");