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_Common2_HeaderFile
17 #define QANCollection_Common2_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_BaseColFunc,ItemType)
36 DEFINE_BASECOLLECTION(QANCollection_Key1BaseColFunc,Key1Type)
37 DEFINE_BASECOLLECTION(QANCollection_Key2BaseColFunc,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_Array1Func,QANCollection_BaseColFunc,ItemType)
44 DEFINE_HARRAY1(QANCollection_HArray1Func,QANCollection_Array1Func)
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_Array2Func,QANCollection_BaseColFunc,ItemType)
51 DEFINE_HARRAY2(QANCollection_HArray2Func,QANCollection_Array2Func)
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_MapFunc,QANCollection_Key1BaseColFunc,Key1Type)
64 DEFINE_DATAMAP(QANCollection_DataMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
65 DEFINE_DOUBLEMAP(QANCollection_DoubleMapFunc,QANCollection_Key2BaseColFunc,Key1Type,Key2Type)
66 DEFINE_INDEXEDMAP(QANCollection_IndexedMapFunc,QANCollection_Key1BaseColFunc,Key1Type)
67 DEFINE_INDEXEDDATAMAP(QANCollection_IDMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
69 #include <NCollection_DefineList.hxx>
70 #include <NCollection_DefineSet.hxx>
71 #include <NCollection_DefineHSet.hxx>
72 ////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
73 ////////////////////////////////DEFINE_SET(QANCollection_Set,QANCollection_Key2BaseCol,Key2Type)
74 ////////////////////////////////DEFINE_HSET(QANCollection_HSet,QANCollection_Set)
75 DEFINE_LIST(QANCollection_ListFunc,QANCollection_BaseColFunc,ItemType)
76 DEFINE_SET(QANCollection_SetFunc,QANCollection_Key2BaseColFunc,Key2Type)
77 DEFINE_HSET(QANCollection_HSetFunc,QANCollection_SetFunc)
79 #include <NCollection_DefineSequence.hxx>
80 #include <NCollection_DefineHSequence.hxx>
81 ////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
82 ////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
83 DEFINE_SEQUENCE(QANCollection_SequenceFunc,QANCollection_BaseColFunc,ItemType)
84 DEFINE_HSEQUENCE(QANCollection_HSequenceFunc,QANCollection_SequenceFunc)
87 // ===================== Type independent methods =============================
88 ////////////////////////////////void printCollection (QANCollection_BaseCol& aColl,
89 void printCollection (QANCollection_BaseColFunc& aColl,
93 Standard_Integer iSize = aColl.Size();
94 ////////////////////////////////QANCollection_BaseCol::Iterator& anIter = aColl.CreateIterator();
95 QANCollection_BaseColFunc::Iterator& anIter = aColl.CreateIterator();
99 printf (" <Empty collection>\n");
101 printf ("Error : empty collection has size==%d",iSize);
105 printf (" Size==%d\n",iSize);
106 for (; anIter.More(); anIter.Next())
107 PrintItem(anIter.Value());
111 ////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
113 void printCollection (QANCollection_Key1BaseColFunc& aColl,
116 printf ("%s:\n",str);
117 Standard_Integer iSize = aColl.Size();
118 ////////////////////////////////QANCollection_Key1BaseCol::Iterator& anIter = aColl.CreateIterator();
119 QANCollection_Key1BaseColFunc::Iterator& anIter = aColl.CreateIterator();
123 printf (" <Empty collection>\n");
125 printf ("Error : empty collection has size==%d",iSize);
129 printf (" Size==%d\n",iSize);
130 for (; anIter.More(); anIter.Next())
131 PrintItem(anIter.Value());
136 ////////////////////////////////void printCollection (QANCollection_Key2BaseCol& aColl,
137 void printCollection (QANCollection_Key2BaseColFunc& aColl,
140 printf ("%s:\n",str);
141 Standard_Integer iSize = aColl.Size();
142 ////////////////////////////////QANCollection_Key2BaseCol::Iterator& anIter = aColl.CreateIterator();
143 QANCollection_Key2BaseColFunc::Iterator& anIter = aColl.CreateIterator();
147 printf (" <Empty collection>\n");
149 printf ("Error : empty collection has size==%d",iSize);
153 printf (" Size==%d\n",iSize);
154 for (; anIter.More(); anIter.Next())
155 PrintItem(anIter.Value());
159 ////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
160 //////////////////////////////// QANCollection_BaseCol& aCollDst)
161 void AssignCollection (QANCollection_BaseColFunc& aCollSrc,
162 QANCollection_BaseColFunc& aCollDst)
164 printCollection (aCollSrc,"Source collection");
165 aCollDst.Assign(aCollSrc);
166 printCollection (aCollDst,"Target collection");
169 ////////////////////////////////void AssignCollection (QANCollection_Key1BaseCol& aCollSrc,
170 //////////////////////////////// QANCollection_Key1BaseCol& aCollDst)
172 void AssignCollection (QANCollection_Key1BaseColFunc& aCollSrc,
173 QANCollection_Key1BaseColFunc& aCollDst)
175 printCollection (aCollSrc,"Source collection");
176 aCollDst.Assign(aCollSrc);
177 printCollection (aCollDst,"Target collection");
181 ////////////////////////////////void AssignCollection (QANCollection_Key2BaseCol& aCollSrc,
182 //////////////////////////////// QANCollection_Key2BaseCol& aCollDst)
183 void AssignCollection (QANCollection_Key2BaseColFunc& aCollSrc,
184 QANCollection_Key2BaseColFunc& aCollDst)
186 printCollection (aCollSrc,"Source collection");
187 aCollDst.Assign(aCollSrc);
188 printCollection (aCollDst,"Target collection");