0024428: Implementation of LGPL license
[occt.git] / src / QANCollection / QANCollection_Common2.hxx
CommitLineData
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//
973c2be1 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.
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_Common2_HeaderFile
17#define QANCollection_Common2_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)
35DEFINE_BASECOLLECTION(QANCollection_BaseColFunc,ItemType)
36DEFINE_BASECOLLECTION(QANCollection_Key1BaseColFunc,Key1Type)
37DEFINE_BASECOLLECTION(QANCollection_Key2BaseColFunc,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)
43DEFINE_ARRAY1(QANCollection_Array1Func,QANCollection_BaseColFunc,ItemType)
44DEFINE_HARRAY1(QANCollection_HArray1Func,QANCollection_Array1Func)
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)
50DEFINE_ARRAY2(QANCollection_Array2Func,QANCollection_BaseColFunc,ItemType)
51DEFINE_HARRAY2(QANCollection_HArray2Func,QANCollection_Array2Func)
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)
63DEFINE_MAP(QANCollection_MapFunc,QANCollection_Key1BaseColFunc,Key1Type)
64DEFINE_DATAMAP(QANCollection_DataMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
65DEFINE_DOUBLEMAP(QANCollection_DoubleMapFunc,QANCollection_Key2BaseColFunc,Key1Type,Key2Type)
66DEFINE_INDEXEDMAP(QANCollection_IndexedMapFunc,QANCollection_Key1BaseColFunc,Key1Type)
67DEFINE_INDEXEDDATAMAP(QANCollection_IDMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
68
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)
79DEFINE_LIST(QANCollection_ListFunc,QANCollection_BaseColFunc,ItemType)
80DEFINE_QUEUE(QANCollection_QueueFunc,QANCollection_BaseColFunc,ItemType)
81DEFINE_STACK(QANCollection_StackFunc,QANCollection_BaseColFunc,ItemType)
82DEFINE_SET(QANCollection_SetFunc,QANCollection_Key2BaseColFunc,Key2Type)
83DEFINE_HSET(QANCollection_HSetFunc,QANCollection_SetFunc)
84
85#include <NCollection_DefineSList.hxx>
86////////////////////////////////DEFINE_SLIST(QANCollection_SList,QANCollection_BaseCol,ItemType)
87DEFINE_SLIST(QANCollection_SListFunc,QANCollection_BaseColFunc,ItemType)
88
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)
93DEFINE_SEQUENCE(QANCollection_SequenceFunc,QANCollection_BaseColFunc,ItemType)
94DEFINE_HSEQUENCE(QANCollection_HSequenceFunc,QANCollection_SequenceFunc)
95
96
97// ===================== Type independent methods =============================
98////////////////////////////////void printCollection (QANCollection_BaseCol& aColl,
99void printCollection (QANCollection_BaseColFunc& aColl,
100 const char * str)
101{
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();
106 if (!anIter.More())
107 {
108 if (iSize==0)
109 printf (" <Empty collection>\n");
110 else
111 printf ("Error : empty collection has size==%d",iSize);
112 }
113 else
114 {
115 printf (" Size==%d\n",iSize);
116 for (; anIter.More(); anIter.Next())
117 PrintItem(anIter.Value());
118 }
119}
120
121////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
122#if 0
123void printCollection (QANCollection_Key1BaseColFunc& aColl,
124 const char * str)
125{
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();
130 if (!anIter.More())
131 {
132 if (iSize==0)
133 printf (" <Empty collection>\n");
134 else
135 printf ("Error : empty collection has size==%d",iSize);
136 }
137 else
138 {
139 printf (" Size==%d\n",iSize);
140 for (; anIter.More(); anIter.Next())
141 PrintItem(anIter.Value());
142 }
143}
144#endif
145
146////////////////////////////////void printCollection (QANCollection_Key2BaseCol& aColl,
147void printCollection (QANCollection_Key2BaseColFunc& aColl,
148 const char * str)
149{
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();
154 if (!anIter.More())
155 {
156 if (iSize==0)
157 printf (" <Empty collection>\n");
158 else
159 printf ("Error : empty collection has size==%d",iSize);
160 }
161 else
162 {
163 printf (" Size==%d\n",iSize);
164 for (; anIter.More(); anIter.Next())
165 PrintItem(anIter.Value());
166 }
167}
168
169////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
170//////////////////////////////// QANCollection_BaseCol& aCollDst)
171void AssignCollection (QANCollection_BaseColFunc& aCollSrc,
172 QANCollection_BaseColFunc& aCollDst)
173{
174 printCollection (aCollSrc,"Source collection");
175 aCollDst.Assign(aCollSrc);
176 printCollection (aCollDst,"Target collection");
177}
178
179////////////////////////////////void AssignCollection (QANCollection_Key1BaseCol& aCollSrc,
180//////////////////////////////// QANCollection_Key1BaseCol& aCollDst)
181#if 0
182void AssignCollection (QANCollection_Key1BaseColFunc& aCollSrc,
183 QANCollection_Key1BaseColFunc& aCollDst)
184{
185 printCollection (aCollSrc,"Source collection");
186 aCollDst.Assign(aCollSrc);
187 printCollection (aCollDst,"Target collection");
188}
189#endif
190
191////////////////////////////////void AssignCollection (QANCollection_Key2BaseCol& aCollSrc,
192//////////////////////////////// QANCollection_Key2BaseCol& aCollDst)
193void AssignCollection (QANCollection_Key2BaseColFunc& aCollSrc,
194 QANCollection_Key2BaseColFunc& aCollDst)
195{
196 printCollection (aCollSrc,"Source collection");
197 aCollDst.Assign(aCollSrc);
198 printCollection (aCollDst,"Target collection");
199}
200
201#endif
202
203#endif