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_DefineSList.hxx>
83 ////////////////////////////////DEFINE_SLIST(QANCollection_SList,QANCollection_BaseCol,ItemType)
84 DEFINE_SLIST(QANCollection_SListPerf,QANCollection_BaseColPerf,ItemType)
86 #include <NCollection_DefineSequence.hxx>
87 #include <NCollection_DefineHSequence.hxx>
88 ////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
89 ////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
90 DEFINE_SEQUENCE(QANCollection_SequencePerf,QANCollection_BaseColPerf,ItemType)
91 DEFINE_HSEQUENCE(QANCollection_HSequencePerf,QANCollection_SequencePerf)
94 // ===================== Type independent methods =============================
95 ////////////////////////////////void printCollection (QANCollection_BaseCol& aColl,
97 void printCollection (QANCollection_BaseColPerf& aColl,
100 printf ("%s:\n",str);
101 Standard_Integer iSize = aColl.Size();
102 ////////////////////////////////QANCollection_BaseCol::Iterator& anIter = aColl.CreateIterator();
103 QANCollection_BaseColPerf::Iterator& anIter = aColl.CreateIterator();
107 printf (" <Empty collection>\n");
109 printf ("Error : empty collection has size==%d",iSize);
113 printf (" Size==%d\n",iSize);
114 for (; anIter.More(); anIter.Next())
115 PrintItem(anIter.Value());
119 ////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
120 void printCollection (QANCollection_Key1BaseColPerf& aColl,
123 printf ("%s:\n",str);
124 Standard_Integer iSize = aColl.Size();
125 ////////////////////////////////QANCollection_Key1BaseCol::Iterator& anIter = aColl.CreateIterator();
126 QANCollection_Key1BaseColPerf::Iterator& anIter = aColl.CreateIterator();
130 printf (" <Empty collection>\n");
132 printf ("Error : empty collection has size==%d",iSize);
136 printf (" Size==%d\n",iSize);
137 for (; anIter.More(); anIter.Next())
138 PrintItem(anIter.Value());
142 ////////////////////////////////void printCollection (QANCollection_Key2BaseCol& aColl,
143 void printCollection (QANCollection_Key2BaseColPerf& aColl,
146 printf ("%s:\n",str);
147 Standard_Integer iSize = aColl.Size();
148 ////////////////////////////////QANCollection_Key2BaseCol::Iterator& anIter = aColl.CreateIterator();
149 QANCollection_Key2BaseColPerf::Iterator& anIter = aColl.CreateIterator();
153 printf (" <Empty collection>\n");
155 printf ("Error : empty collection has size==%d",iSize);
159 printf (" Size==%d\n",iSize);
160 for (; anIter.More(); anIter.Next())
161 PrintItem(anIter.Value());
165 ////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
166 //////////////////////////////// QANCollection_BaseCol& aCollDst)
167 void AssignCollection (QANCollection_BaseColPerf& aCollSrc,
168 QANCollection_BaseColPerf& aCollDst)
170 printCollection (aCollSrc,"Source collection");
171 aCollDst.Assign(aCollSrc);
172 printCollection (aCollDst,"Target collection");
175 ////////////////////////////////void AssignCollection (QANCollection_Key1BaseCol& aCollSrc,
176 //////////////////////////////// QANCollection_Key1BaseCol& aCollDst)
177 void AssignCollection (QANCollection_Key1BaseColPerf& aCollSrc,
178 QANCollection_Key1BaseColPerf& aCollDst)
180 printCollection (aCollSrc,"Source collection");
181 aCollDst.Assign(aCollSrc);
182 printCollection (aCollDst,"Target collection");
185 ////////////////////////////////void AssignCollection (QANCollection_Key2BaseCol& aCollSrc,
186 //////////////////////////////// QANCollection_Key2BaseCol& aCollDst)
187 void AssignCollection (QANCollection_Key2BaseColPerf& aCollSrc,
188 QANCollection_Key2BaseColPerf& aCollDst)
190 printCollection (aCollSrc,"Source collection");
191 aCollDst.Assign(aCollSrc);
192 printCollection (aCollDst,"Target collection");