b311480e |
1 | // Created on: 2002-05-15 |
2 | // Created by: Alexander KARTOMIN (akm) |
973c2be1 |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #ifndef QANCollection_Common3_HeaderFile |
17 | #define QANCollection_Common3_HeaderFile |
18 | |
19 | #include <stdio.h> |
20 | #include <gp_Pnt.hxx> |
21 | |
22 | #include <QANCollection_Common.hxx> |
23 | |
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 |
28 | |
29 | #if defined(ItemType) && defined(Key1Type) && defined(Key2Type) |
30 | |
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) |
38 | |
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) |
45 | |
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) |
52 | |
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) |
68 | |
69 | #include <NCollection_DefineList.hxx> |
7fd59977 |
70 | #include <NCollection_DefineStack.hxx> |
71 | #include <NCollection_DefineSet.hxx> |
72 | #include <NCollection_DefineHSet.hxx> |
73 | ////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType) |
7fd59977 |
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) |
7fd59977 |
78 | DEFINE_STACK(QANCollection_StackPerf,QANCollection_BaseColPerf,ItemType) |
79 | DEFINE_SET(QANCollection_SetPerf,QANCollection_Key2BaseColPerf,Key2Type) |
80 | DEFINE_HSET(QANCollection_HSetPerf,QANCollection_SetPerf) |
81 | |
82 | #include <NCollection_DefineSList.hxx> |
83 | ////////////////////////////////DEFINE_SLIST(QANCollection_SList,QANCollection_BaseCol,ItemType) |
84 | DEFINE_SLIST(QANCollection_SListPerf,QANCollection_BaseColPerf,ItemType) |
85 | |
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) |
92 | |
93 | |
94 | // ===================== Type independent methods ============================= |
95 | ////////////////////////////////void printCollection (QANCollection_BaseCol& aColl, |
96 | #if 0 |
97 | void printCollection (QANCollection_BaseColPerf& aColl, |
98 | const char * str) |
99 | { |
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(); |
104 | if (!anIter.More()) |
105 | { |
106 | if (iSize==0) |
107 | printf (" <Empty collection>\n"); |
108 | else |
109 | printf ("Error : empty collection has size==%d",iSize); |
110 | } |
111 | else |
112 | { |
113 | printf (" Size==%d\n",iSize); |
114 | for (; anIter.More(); anIter.Next()) |
115 | PrintItem(anIter.Value()); |
116 | } |
117 | } |
118 | |
119 | ////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl, |
120 | void printCollection (QANCollection_Key1BaseColPerf& aColl, |
121 | const char * str) |
122 | { |
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(); |
127 | if (!anIter.More()) |
128 | { |
129 | if (iSize==0) |
130 | printf (" <Empty collection>\n"); |
131 | else |
132 | printf ("Error : empty collection has size==%d",iSize); |
133 | } |
134 | else |
135 | { |
136 | printf (" Size==%d\n",iSize); |
137 | for (; anIter.More(); anIter.Next()) |
138 | PrintItem(anIter.Value()); |
139 | } |
140 | } |
141 | |
142 | ////////////////////////////////void printCollection (QANCollection_Key2BaseCol& aColl, |
143 | void printCollection (QANCollection_Key2BaseColPerf& aColl, |
144 | const char * str) |
145 | { |
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(); |
150 | if (!anIter.More()) |
151 | { |
152 | if (iSize==0) |
153 | printf (" <Empty collection>\n"); |
154 | else |
155 | printf ("Error : empty collection has size==%d",iSize); |
156 | } |
157 | else |
158 | { |
159 | printf (" Size==%d\n",iSize); |
160 | for (; anIter.More(); anIter.Next()) |
161 | PrintItem(anIter.Value()); |
162 | } |
163 | } |
164 | |
165 | ////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc, |
166 | //////////////////////////////// QANCollection_BaseCol& aCollDst) |
167 | void AssignCollection (QANCollection_BaseColPerf& aCollSrc, |
168 | QANCollection_BaseColPerf& aCollDst) |
169 | { |
170 | printCollection (aCollSrc,"Source collection"); |
171 | aCollDst.Assign(aCollSrc); |
172 | printCollection (aCollDst,"Target collection"); |
173 | } |
174 | |
175 | ////////////////////////////////void AssignCollection (QANCollection_Key1BaseCol& aCollSrc, |
176 | //////////////////////////////// QANCollection_Key1BaseCol& aCollDst) |
177 | void AssignCollection (QANCollection_Key1BaseColPerf& aCollSrc, |
178 | QANCollection_Key1BaseColPerf& aCollDst) |
179 | { |
180 | printCollection (aCollSrc,"Source collection"); |
181 | aCollDst.Assign(aCollSrc); |
182 | printCollection (aCollDst,"Target collection"); |
183 | } |
184 | |
185 | ////////////////////////////////void AssignCollection (QANCollection_Key2BaseCol& aCollSrc, |
186 | //////////////////////////////// QANCollection_Key2BaseCol& aCollDst) |
187 | void AssignCollection (QANCollection_Key2BaseColPerf& aCollSrc, |
188 | QANCollection_Key2BaseColPerf& aCollDst) |
189 | { |
190 | printCollection (aCollSrc,"Source collection"); |
191 | aCollDst.Assign(aCollSrc); |
192 | printCollection (aCollDst,"Target collection"); |
193 | } |
194 | #endif |
195 | |
196 | #endif |
197 | |
198 | #endif |