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
8 // under the terms of the GNU Lesser General Public 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_DefineQueue.hxx>
71 #include <NCollection_DefineStack.hxx>
72 #include <NCollection_DefineSet.hxx>
73 #include <NCollection_DefineHSet.hxx>
74 ////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
75 ////////////////////////////////DEFINE_QUEUE(QANCollection_Queue,QANCollection_BaseCol,ItemType)
76 ////////////////////////////////DEFINE_STACK(QANCollection_Stack,QANCollection_BaseCol,ItemType)
77 ////////////////////////////////DEFINE_SET(QANCollection_Set,QANCollection_Key2BaseCol,Key2Type)
78 ////////////////////////////////DEFINE_HSET(QANCollection_HSet,QANCollection_Set)
79 DEFINE_LIST(QANCollection_ListFunc,QANCollection_BaseColFunc,ItemType)
80 DEFINE_QUEUE(QANCollection_QueueFunc,QANCollection_BaseColFunc,ItemType)
81 DEFINE_STACK(QANCollection_StackFunc,QANCollection_BaseColFunc,ItemType)
82 DEFINE_SET(QANCollection_SetFunc,QANCollection_Key2BaseColFunc,Key2Type)
83 DEFINE_HSET(QANCollection_HSetFunc,QANCollection_SetFunc)
85 #include <NCollection_DefineSList.hxx>
86 ////////////////////////////////DEFINE_SLIST(QANCollection_SList,QANCollection_BaseCol,ItemType)
87 DEFINE_SLIST(QANCollection_SListFunc,QANCollection_BaseColFunc,ItemType)
89 #include <NCollection_DefineSequence.hxx>
90 #include <NCollection_DefineHSequence.hxx>
91 ////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
92 ////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
93 DEFINE_SEQUENCE(QANCollection_SequenceFunc,QANCollection_BaseColFunc,ItemType)
94 DEFINE_HSEQUENCE(QANCollection_HSequenceFunc,QANCollection_SequenceFunc)
97 // ===================== Type independent methods =============================
98 ////////////////////////////////void printCollection (QANCollection_BaseCol& aColl,
99 void printCollection (QANCollection_BaseColFunc& aColl,
102 printf ("%s:\n",str);
103 Standard_Integer iSize = aColl.Size();
104 ////////////////////////////////QANCollection_BaseCol::Iterator& anIter = aColl.CreateIterator();
105 QANCollection_BaseColFunc::Iterator& anIter = aColl.CreateIterator();
109 printf (" <Empty collection>\n");
111 printf ("Error : empty collection has size==%d",iSize);
115 printf (" Size==%d\n",iSize);
116 for (; anIter.More(); anIter.Next())
117 PrintItem(anIter.Value());
121 ////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
123 void printCollection (QANCollection_Key1BaseColFunc& aColl,
126 printf ("%s:\n",str);
127 Standard_Integer iSize = aColl.Size();
128 ////////////////////////////////QANCollection_Key1BaseCol::Iterator& anIter = aColl.CreateIterator();
129 QANCollection_Key1BaseColFunc::Iterator& anIter = aColl.CreateIterator();
133 printf (" <Empty collection>\n");
135 printf ("Error : empty collection has size==%d",iSize);
139 printf (" Size==%d\n",iSize);
140 for (; anIter.More(); anIter.Next())
141 PrintItem(anIter.Value());
146 ////////////////////////////////void printCollection (QANCollection_Key2BaseCol& aColl,
147 void printCollection (QANCollection_Key2BaseColFunc& aColl,
150 printf ("%s:\n",str);
151 Standard_Integer iSize = aColl.Size();
152 ////////////////////////////////QANCollection_Key2BaseCol::Iterator& anIter = aColl.CreateIterator();
153 QANCollection_Key2BaseColFunc::Iterator& anIter = aColl.CreateIterator();
157 printf (" <Empty collection>\n");
159 printf ("Error : empty collection has size==%d",iSize);
163 printf (" Size==%d\n",iSize);
164 for (; anIter.More(); anIter.Next())
165 PrintItem(anIter.Value());
169 ////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
170 //////////////////////////////// QANCollection_BaseCol& aCollDst)
171 void AssignCollection (QANCollection_BaseColFunc& aCollSrc,
172 QANCollection_BaseColFunc& aCollDst)
174 printCollection (aCollSrc,"Source collection");
175 aCollDst.Assign(aCollSrc);
176 printCollection (aCollDst,"Target collection");
179 ////////////////////////////////void AssignCollection (QANCollection_Key1BaseCol& aCollSrc,
180 //////////////////////////////// QANCollection_Key1BaseCol& aCollDst)
182 void AssignCollection (QANCollection_Key1BaseColFunc& aCollSrc,
183 QANCollection_Key1BaseColFunc& aCollDst)
185 printCollection (aCollSrc,"Source collection");
186 aCollDst.Assign(aCollSrc);
187 printCollection (aCollDst,"Target collection");
191 ////////////////////////////////void AssignCollection (QANCollection_Key2BaseCol& aCollSrc,
192 //////////////////////////////// QANCollection_Key2BaseCol& aCollDst)
193 void AssignCollection (QANCollection_Key2BaseColFunc& aCollSrc,
194 QANCollection_Key2BaseColFunc& aCollDst)
196 printCollection (aCollSrc,"Source collection");
197 aCollDst.Assign(aCollSrc);
198 printCollection (aCollDst,"Target collection");