1 // Created on: 2002-05-15
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
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.
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.
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.
22 #ifndef QANCollection_Common2_HeaderFile
23 #define QANCollection_Common2_HeaderFile
28 #include <QANCollection_Common.hxx>
30 // ===================== INSTANTIATIONS ===========
31 // ===================== The Types must be defined before this line ===========
32 // These are: TheItemType, TheKey1Type, TheKey2Type
33 // So must be defined ::HashCode and ::IsEqual too
35 #if defined(ItemType) && defined(Key1Type) && defined(Key2Type)
37 #include <NCollection_DefineBaseCollection.hxx>
38 ////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_BaseCol,ItemType)
39 ////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_Key1BaseCol,Key1Type)
40 ////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_Key2BaseCol,Key2Type)
41 DEFINE_BASECOLLECTION(QANCollection_BaseColFunc,ItemType)
42 DEFINE_BASECOLLECTION(QANCollection_Key1BaseColFunc,Key1Type)
43 DEFINE_BASECOLLECTION(QANCollection_Key2BaseColFunc,Key2Type)
45 #include <NCollection_DefineArray1.hxx>
46 #include <NCollection_DefineHArray1.hxx>
47 ////////////////////////////////DEFINE_ARRAY1(QANCollection_Array1,QANCollection_BaseCol,ItemType)
48 ////////////////////////////////DEFINE_HARRAY1(QANCollection_HArray1,QANCollection_Array1)
49 DEFINE_ARRAY1(QANCollection_Array1Func,QANCollection_BaseColFunc,ItemType)
50 DEFINE_HARRAY1(QANCollection_HArray1Func,QANCollection_Array1Func)
52 #include <NCollection_DefineArray2.hxx>
53 #include <NCollection_DefineHArray2.hxx>
54 ////////////////////////////////DEFINE_ARRAY2(QANCollection_Array2,QANCollection_BaseCol,ItemType)
55 ////////////////////////////////DEFINE_HARRAY2(QANCollection_HArray2,QANCollection_Array2)
56 DEFINE_ARRAY2(QANCollection_Array2Func,QANCollection_BaseColFunc,ItemType)
57 DEFINE_HARRAY2(QANCollection_HArray2Func,QANCollection_Array2Func)
59 #include <NCollection_DefineMap.hxx>
60 #include <NCollection_DefineDataMap.hxx>
61 #include <NCollection_DefineDoubleMap.hxx>
62 #include <NCollection_DefineIndexedMap.hxx>
63 #include <NCollection_DefineIndexedDataMap.hxx>
64 ////////////////////////////////DEFINE_MAP(QANCollection_Map,QANCollection_Key1BaseCol,Key1Type)
65 ////////////////////////////////DEFINE_DATAMAP(QANCollection_DataMap,QANCollection_BaseCol,Key1Type,ItemType)
66 ////////////////////////////////DEFINE_DOUBLEMAP(QANCollection_DoubleMap,QANCollection_Key2BaseCol,Key1Type,Key2Type)
67 ////////////////////////////////DEFINE_INDEXEDMAP(QANCollection_IndexedMap,QANCollection_Key1BaseCol,Key1Type)
68 ////////////////////////////////DEFINE_INDEXEDDATAMAP(QANCollection_IDMap,QANCollection_BaseCol,Key1Type,ItemType)
69 DEFINE_MAP(QANCollection_MapFunc,QANCollection_Key1BaseColFunc,Key1Type)
70 DEFINE_DATAMAP(QANCollection_DataMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
71 DEFINE_DOUBLEMAP(QANCollection_DoubleMapFunc,QANCollection_Key2BaseColFunc,Key1Type,Key2Type)
72 DEFINE_INDEXEDMAP(QANCollection_IndexedMapFunc,QANCollection_Key1BaseColFunc,Key1Type)
73 DEFINE_INDEXEDDATAMAP(QANCollection_IDMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
75 #include <NCollection_DefineList.hxx>
76 #include <NCollection_DefineQueue.hxx>
77 #include <NCollection_DefineStack.hxx>
78 #include <NCollection_DefineSet.hxx>
79 #include <NCollection_DefineHSet.hxx>
80 ////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
81 ////////////////////////////////DEFINE_QUEUE(QANCollection_Queue,QANCollection_BaseCol,ItemType)
82 ////////////////////////////////DEFINE_STACK(QANCollection_Stack,QANCollection_BaseCol,ItemType)
83 ////////////////////////////////DEFINE_SET(QANCollection_Set,QANCollection_Key2BaseCol,Key2Type)
84 ////////////////////////////////DEFINE_HSET(QANCollection_HSet,QANCollection_Set)
85 DEFINE_LIST(QANCollection_ListFunc,QANCollection_BaseColFunc,ItemType)
86 DEFINE_QUEUE(QANCollection_QueueFunc,QANCollection_BaseColFunc,ItemType)
87 DEFINE_STACK(QANCollection_StackFunc,QANCollection_BaseColFunc,ItemType)
88 DEFINE_SET(QANCollection_SetFunc,QANCollection_Key2BaseColFunc,Key2Type)
89 DEFINE_HSET(QANCollection_HSetFunc,QANCollection_SetFunc)
91 #include <NCollection_DefineSList.hxx>
92 ////////////////////////////////DEFINE_SLIST(QANCollection_SList,QANCollection_BaseCol,ItemType)
93 DEFINE_SLIST(QANCollection_SListFunc,QANCollection_BaseColFunc,ItemType)
95 #include <NCollection_DefineSequence.hxx>
96 #include <NCollection_DefineHSequence.hxx>
97 ////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
98 ////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
99 DEFINE_SEQUENCE(QANCollection_SequenceFunc,QANCollection_BaseColFunc,ItemType)
100 DEFINE_HSEQUENCE(QANCollection_HSequenceFunc,QANCollection_SequenceFunc)
103 // ===================== Type independent methods =============================
104 ////////////////////////////////void printCollection (QANCollection_BaseCol& aColl,
105 void printCollection (QANCollection_BaseColFunc& aColl,
108 printf ("%s:\n",str);
109 Standard_Integer iSize = aColl.Size();
110 ////////////////////////////////QANCollection_BaseCol::Iterator& anIter = aColl.CreateIterator();
111 QANCollection_BaseColFunc::Iterator& anIter = aColl.CreateIterator();
115 printf (" <Empty collection>\n");
117 printf ("Error : empty collection has size==%d",iSize);
121 printf (" Size==%d\n",iSize);
122 for (; anIter.More(); anIter.Next())
123 PrintItem(anIter.Value());
127 ////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
129 void printCollection (QANCollection_Key1BaseColFunc& aColl,
132 printf ("%s:\n",str);
133 Standard_Integer iSize = aColl.Size();
134 ////////////////////////////////QANCollection_Key1BaseCol::Iterator& anIter = aColl.CreateIterator();
135 QANCollection_Key1BaseColFunc::Iterator& anIter = aColl.CreateIterator();
139 printf (" <Empty collection>\n");
141 printf ("Error : empty collection has size==%d",iSize);
145 printf (" Size==%d\n",iSize);
146 for (; anIter.More(); anIter.Next())
147 PrintItem(anIter.Value());
152 ////////////////////////////////void printCollection (QANCollection_Key2BaseCol& aColl,
153 void printCollection (QANCollection_Key2BaseColFunc& aColl,
156 printf ("%s:\n",str);
157 Standard_Integer iSize = aColl.Size();
158 ////////////////////////////////QANCollection_Key2BaseCol::Iterator& anIter = aColl.CreateIterator();
159 QANCollection_Key2BaseColFunc::Iterator& anIter = aColl.CreateIterator();
163 printf (" <Empty collection>\n");
165 printf ("Error : empty collection has size==%d",iSize);
169 printf (" Size==%d\n",iSize);
170 for (; anIter.More(); anIter.Next())
171 PrintItem(anIter.Value());
175 ////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
176 //////////////////////////////// QANCollection_BaseCol& aCollDst)
177 void AssignCollection (QANCollection_BaseColFunc& aCollSrc,
178 QANCollection_BaseColFunc& aCollDst)
180 printCollection (aCollSrc,"Source collection");
181 aCollDst.Assign(aCollSrc);
182 printCollection (aCollDst,"Target collection");
185 ////////////////////////////////void AssignCollection (QANCollection_Key1BaseCol& aCollSrc,
186 //////////////////////////////// QANCollection_Key1BaseCol& aCollDst)
188 void AssignCollection (QANCollection_Key1BaseColFunc& aCollSrc,
189 QANCollection_Key1BaseColFunc& aCollDst)
191 printCollection (aCollSrc,"Source collection");
192 aCollDst.Assign(aCollSrc);
193 printCollection (aCollDst,"Target collection");
197 ////////////////////////////////void AssignCollection (QANCollection_Key2BaseCol& aCollSrc,
198 //////////////////////////////// QANCollection_Key2BaseCol& aCollDst)
199 void AssignCollection (QANCollection_Key2BaseColFunc& aCollSrc,
200 QANCollection_Key2BaseColFunc& aCollDst)
202 printCollection (aCollSrc,"Source collection");
203 aCollDst.Assign(aCollSrc);
204 printCollection (aCollDst,"Target collection");