0024911: Avoid using virtual functions in NCollection classes
[occt.git] / src / QANCollection / QANCollection_Common3.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//
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)
35DEFINE_BASECOLLECTION(QANCollection_BaseColPerf,ItemType)
36DEFINE_BASECOLLECTION(QANCollection_Key1BaseColPerf,Key1Type)
37DEFINE_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)
43DEFINE_ARRAY1(QANCollection_Array1Perf,QANCollection_BaseColPerf,ItemType)
44DEFINE_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)
50DEFINE_ARRAY2(QANCollection_Array2Perf,QANCollection_BaseColPerf,ItemType)
51DEFINE_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)
63DEFINE_MAP(QANCollection_MapPerf,QANCollection_Key1BaseColPerf,Key1Type)
64DEFINE_DATAMAP(QANCollection_DataMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType)
65DEFINE_DOUBLEMAP(QANCollection_DoubleMapPerf,QANCollection_Key2BaseColPerf,Key1Type,Key2Type)
66DEFINE_INDEXEDMAP(QANCollection_IndexedMapPerf,QANCollection_Key1BaseColPerf,Key1Type)
67DEFINE_INDEXEDDATAMAP(QANCollection_IDMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType)
68
69#include <NCollection_DefineList.hxx>
7fd59977 70////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
7fd59977 71DEFINE_LIST(QANCollection_ListPerf,QANCollection_BaseColPerf,ItemType)
7fd59977 72
7fd59977 73#include <NCollection_DefineSequence.hxx>
74#include <NCollection_DefineHSequence.hxx>
75////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
76////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
77DEFINE_SEQUENCE(QANCollection_SequencePerf,QANCollection_BaseColPerf,ItemType)
78DEFINE_HSEQUENCE(QANCollection_HSequencePerf,QANCollection_SequencePerf)
79
80
81// ===================== Type independent methods =============================
82////////////////////////////////void printCollection (QANCollection_BaseCol& aColl,
83#if 0
84void printCollection (QANCollection_BaseColPerf& aColl,
85 const char * str)
86{
87 printf ("%s:\n",str);
88 Standard_Integer iSize = aColl.Size();
89 ////////////////////////////////QANCollection_BaseCol::Iterator& anIter = aColl.CreateIterator();
90 QANCollection_BaseColPerf::Iterator& anIter = aColl.CreateIterator();
91 if (!anIter.More())
92 {
93 if (iSize==0)
94 printf (" <Empty collection>\n");
95 else
96 printf ("Error : empty collection has size==%d",iSize);
97 }
98 else
99 {
100 printf (" Size==%d\n",iSize);
101 for (; anIter.More(); anIter.Next())
102 PrintItem(anIter.Value());
103 }
104}
105
106////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
107void printCollection (QANCollection_Key1BaseColPerf& aColl,
108 const char * str)
109{
110 printf ("%s:\n",str);
111 Standard_Integer iSize = aColl.Size();
112 ////////////////////////////////QANCollection_Key1BaseCol::Iterator& anIter = aColl.CreateIterator();
113 QANCollection_Key1BaseColPerf::Iterator& anIter = aColl.CreateIterator();
114 if (!anIter.More())
115 {
116 if (iSize==0)
117 printf (" <Empty collection>\n");
118 else
119 printf ("Error : empty collection has size==%d",iSize);
120 }
121 else
122 {
123 printf (" Size==%d\n",iSize);
124 for (; anIter.More(); anIter.Next())
125 PrintItem(anIter.Value());
126 }
127}
128
129////////////////////////////////void printCollection (QANCollection_Key2BaseCol& aColl,
130void printCollection (QANCollection_Key2BaseColPerf& aColl,
131 const char * str)
132{
133 printf ("%s:\n",str);
134 Standard_Integer iSize = aColl.Size();
135 ////////////////////////////////QANCollection_Key2BaseCol::Iterator& anIter = aColl.CreateIterator();
136 QANCollection_Key2BaseColPerf::Iterator& anIter = aColl.CreateIterator();
137 if (!anIter.More())
138 {
139 if (iSize==0)
140 printf (" <Empty collection>\n");
141 else
142 printf ("Error : empty collection has size==%d",iSize);
143 }
144 else
145 {
146 printf (" Size==%d\n",iSize);
147 for (; anIter.More(); anIter.Next())
148 PrintItem(anIter.Value());
149 }
150}
151
152////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
153//////////////////////////////// QANCollection_BaseCol& aCollDst)
154void AssignCollection (QANCollection_BaseColPerf& aCollSrc,
155 QANCollection_BaseColPerf& aCollDst)
156{
157 printCollection (aCollSrc,"Source collection");
158 aCollDst.Assign(aCollSrc);
159 printCollection (aCollDst,"Target collection");
160}
161
162////////////////////////////////void AssignCollection (QANCollection_Key1BaseCol& aCollSrc,
163//////////////////////////////// QANCollection_Key1BaseCol& aCollDst)
164void AssignCollection (QANCollection_Key1BaseColPerf& aCollSrc,
165 QANCollection_Key1BaseColPerf& aCollDst)
166{
167 printCollection (aCollSrc,"Source collection");
168 aCollDst.Assign(aCollSrc);
169 printCollection (aCollDst,"Target collection");
170}
171
172////////////////////////////////void AssignCollection (QANCollection_Key2BaseCol& aCollSrc,
173//////////////////////////////// QANCollection_Key2BaseCol& aCollDst)
174void AssignCollection (QANCollection_Key2BaseColPerf& aCollSrc,
175 QANCollection_Key2BaseColPerf& aCollDst)
176{
177 printCollection (aCollSrc,"Source collection");
178 aCollDst.Assign(aCollSrc);
179 printCollection (aCollDst,"Target collection");
180}
181#endif
182
183#endif
184
185#endif