Skip to content

Commit 8123aab

Browse files
authored
Merge pull request #33 from tpaviot/review/smesh-array1-test
Review/smesh array1 test
2 parents fdbc869 + 8cb1099 commit 8123aab

File tree

5 files changed

+38
-27
lines changed

5 files changed

+38
-27
lines changed

inc/SMESH_Array1.hxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <Standard_OutOfRange.hxx>
1414
#endif
1515

16-
#include <NCollection_BaseCollection.hxx>
16+
#include <NCollection_Array1.hxx>
1717

1818
#ifdef WNT
1919
// Disable the warning "operator new unmatched by delete"
@@ -52,12 +52,12 @@
5252
* with IsDeletable.
5353
*/
5454
template <class TheItemType> class SMESH_Array1
55-
: public NCollection_BaseCollection<TheItemType>
55+
: public NCollection_Array1<TheItemType>
5656
{
5757

5858
public:
5959
//! Implementation of the Iterator interface.
60-
class Iterator : public NCollection_BaseCollection<TheItemType>::Iterator
60+
class Iterator : public NCollection_Array1<TheItemType>::Iterator
6161
{
6262
public:
6363
//! Empty constructor - for later Init
@@ -101,7 +101,7 @@ template <class TheItemType> class SMESH_Array1
101101
//! Constructor
102102
SMESH_Array1(const Standard_Integer theLower,
103103
const Standard_Integer theUpper) :
104-
NCollection_BaseCollection<TheItemType> (),
104+
NCollection_Array1<TheItemType> (),
105105
myLowerBound (theLower),
106106
myUpperBound (theUpper),
107107
myDeletable (Standard_True)
@@ -121,7 +121,7 @@ template <class TheItemType> class SMESH_Array1
121121

122122
//! Copy constructor
123123
SMESH_Array1 (const SMESH_Array1& theOther) :
124-
NCollection_BaseCollection<TheItemType> (),
124+
NCollection_Array1<TheItemType> (),
125125
myLowerBound (theOther.Lower()),
126126
myUpperBound (theOther.Upper()),
127127
myDeletable (Standard_True)
@@ -140,7 +140,7 @@ template <class TheItemType> class SMESH_Array1
140140
SMESH_Array1 (const TheItemType& theBegin,
141141
const Standard_Integer theLower,
142142
const Standard_Integer theUpper) :
143-
NCollection_BaseCollection<TheItemType> (),
143+
NCollection_Array1<TheItemType> (),
144144
myLowerBound (theLower),
145145
myUpperBound (theUpper),
146146
myDeletable (Standard_False)
@@ -185,15 +185,15 @@ template <class TheItemType> class SMESH_Array1
185185
//! Assign (any collection to this array)
186186
// Copies items from the other collection into the allocated
187187
// storage. Raises an exception when sizes differ.
188-
virtual void Assign (const NCollection_BaseCollection<TheItemType>& theOther)
188+
virtual void Assign (const NCollection_Array1<TheItemType>& theOther)
189189
{
190190
if (&theOther == this)
191191
return;
192192
#if !defined No_Exception && !defined No_Standard_DimensionMismatch
193193
if (Length() != theOther.Size())
194194
Standard_DimensionMismatch::Raise ("SMESH_Array1::Assign");
195195
#endif
196-
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& anIter2 =
196+
TYPENAME NCollection_Array1<TheItemType>::Iterator& anIter2 =
197197
theOther.CreateIterator();
198198
TheItemType * const pEndItem = &myData[myUpperBound];
199199
for (TheItemType * pItem = &myData[myLowerBound];
@@ -265,7 +265,7 @@ template <class TheItemType> class SMESH_Array1
265265

266266
// ******** Creates Iterator for use on BaseCollection
267267
virtual
268-
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator&
268+
TYPENAME NCollection_Array1<TheItemType>::Iterator&
269269
CreateIterator(void) const
270270
{ return *(new (this->IterAllocator()) Iterator(*this)); }
271271

inc/SMESH_Array2.hxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <Standard_OutOfRange.hxx>
1414
#endif
1515

16-
#include <NCollection_BaseCollection.hxx>
16+
#include <NCollection_Array2.hxx>
1717

1818
#ifdef WNT
1919
// Disable the warning "operator new unmatched by delete"
@@ -34,11 +34,11 @@
3434
* for (j = A.LowerCol(); j <= A.UpperCol(); j++)
3535
*/
3636
template <class TheItemType> class SMESH_Array2
37-
: public NCollection_BaseCollection<TheItemType>
37+
: public NCollection_Array2<TheItemType>
3838
{
3939
public:
4040
// **************** Implementation of the Iterator interface.
41-
class Iterator : public NCollection_BaseCollection<TheItemType>::Iterator
41+
class Iterator : public NCollection_Array2<TheItemType>::Iterator
4242
{
4343
public:
4444
//! Empty constructor - for later Init
@@ -88,7 +88,7 @@ template <class TheItemType> class SMESH_Array2
8888
const Standard_Integer theRowUpper,
8989
const Standard_Integer theColLower,
9090
const Standard_Integer theColUpper) :
91-
NCollection_BaseCollection<TheItemType> (),
91+
NCollection_Array2<TheItemType> (),
9292
myLowerRow (theRowLower),
9393
myUpperRow (theRowUpper),
9494
myLowerCol (theColLower),
@@ -98,7 +98,7 @@ template <class TheItemType> class SMESH_Array2
9898

9999
//! Copy constructor
100100
SMESH_Array2 (const SMESH_Array2& theOther) :
101-
NCollection_BaseCollection<TheItemType> (),
101+
NCollection_Array2<TheItemType> (),
102102
myLowerRow (theOther.LowerRow()),
103103
myUpperRow (theOther.UpperRow()),
104104
myLowerCol (theOther.LowerCol()),
@@ -115,7 +115,7 @@ template <class TheItemType> class SMESH_Array2
115115
const Standard_Integer theRowUpper,
116116
const Standard_Integer theColLower,
117117
const Standard_Integer theColUpper) :
118-
NCollection_BaseCollection<TheItemType> (),
118+
NCollection_Array2<TheItemType> (),
119119
myLowerRow (theRowLower),
120120
myUpperRow (theRowUpper),
121121
myLowerCol (theColLower),
@@ -168,15 +168,15 @@ template <class TheItemType> class SMESH_Array2
168168
//! Assign
169169
// Copies items from the other collection into the allocated
170170
// storage. Raises an exception when sizes differ.
171-
virtual void Assign (const NCollection_BaseCollection<TheItemType>& theOther)
171+
virtual void Assign (const NCollection_Array2<TheItemType>& theOther)
172172
{
173173
if (&theOther == this)
174174
return;
175175
#if !defined No_Exception && !defined No_Standard_DimensionMismatch
176176
if (Length() != theOther.Size())
177177
Standard_DimensionMismatch::Raise ("SMESH_Array2::Assign");
178178
#endif
179-
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& anIter2 =
179+
TYPENAME NCollection_Array2<TheItemType>::Iterator& anIter2 =
180180
theOther.CreateIterator();
181181
const TheItemType* pEnd = myStart+Length();
182182
for (TheItemType* pItem=myStart;
@@ -296,7 +296,7 @@ template <class TheItemType> class SMESH_Array2
296296
}
297297

298298
//! Creates Iterator for use on BaseCollection
299-
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator&
299+
virtual TYPENAME NCollection_Array2<TheItemType>::Iterator&
300300
CreateIterator(void) const
301301
{ return *(new (this->IterAllocator()) Iterator(*this)); }
302302

inc/SMESH_IndexedMap.hxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifndef SMESH_IndexedMap_HeaderFile
77
#define SMESH_IndexedMap_HeaderFile
88

9-
#include <NCollection_BaseCollection.hxx>
9+
#include <NCollection_IndexedMap.hxx>
1010
#include <NCollection_BaseMap.hxx>
1111
#include <NCollection_TListNode.hxx>
1212
#include <Standard_NoSuchObject.hxx>
@@ -33,7 +33,7 @@
3333
* discussion about the number of buckets.
3434
*/
3535
template <class TheKeyType> class SMESH_IndexedMap
36-
: public NCollection_BaseCollection<TheKeyType>,
36+
: public NCollection_IndexedMap<TheKeyType>,
3737
public NCollection_BaseMap
3838
{
3939
// **************** Adaptation of the TListNode to the INDEXEDmap
@@ -77,7 +77,7 @@ template <class TheKeyType> class SMESH_IndexedMap
7777
public:
7878
// **************** Implementation of the Iterator interface.
7979
class Iterator
80-
: public NCollection_BaseCollection<TheKeyType>::Iterator
80+
: public NCollection_IndexedMap<TheKeyType>::Iterator
8181
{
8282
public:
8383
//! Empty constructor
@@ -126,23 +126,23 @@ template <class TheKeyType> class SMESH_IndexedMap
126126
//! Constructor
127127
SMESH_IndexedMap (const Standard_Integer NbBuckets=1,
128128
const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
129-
NCollection_BaseCollection<TheKeyType>(theAllocator),
130-
NCollection_BaseMap (NbBuckets, Standard_False) {}
129+
NCollection_IndexedMap<TheKeyType>(theAllocator),
130+
NCollection_BaseMap (NbBuckets, Standard_False, theAllocator) {}
131131

132132
//! Copy constructor
133133
SMESH_IndexedMap (const SMESH_IndexedMap& theOther) :
134-
NCollection_BaseCollection<TheKeyType>(theOther.myAllocator),
134+
NCollection_IndexedMap<TheKeyType>(theOther.myAllocator),
135135
NCollection_BaseMap (theOther.NbBuckets(), Standard_False)
136136
{ *this = theOther; }
137137

138138
//! Assign another collection
139-
virtual void Assign (const NCollection_BaseCollection<TheKeyType>& theOther)
139+
virtual void Assign (const NCollection_IndexedMap<TheKeyType>& theOther)
140140
{
141141
if (this == &theOther)
142142
return;
143143
Clear();
144144
ReSize (theOther.Size());
145-
TYPENAME NCollection_BaseCollection<TheKeyType>::Iterator& anIter =
145+
TYPENAME NCollection_IndexedMap<TheKeyType>::Iterator& anIter =
146146
theOther.CreateIterator();
147147
for (; anIter.More(); anIter.Next())
148148
Add(anIter.Value());
@@ -406,7 +406,7 @@ template <class TheKeyType> class SMESH_IndexedMap
406406
// ----------- PRIVATE METHODS -----------
407407

408408
//! Creates Iterator for use on BaseCollection
409-
virtual TYPENAME NCollection_BaseCollection<TheKeyType>::Iterator&
409+
virtual TYPENAME NCollection_IndexedMap<TheKeyType>::Iterator&
410410
CreateIterator(void) const
411411
{ return *(new (this->IterAllocator()) Iterator(*this)); }
412412

test/SMESHArray1_test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_smesh_test(SMESHArray1_test "SMESH")
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <SMESH_Array1.hxx>
2+
#include <SMESH_Array2.hxx>
3+
#include <SMESH_IndexedMap.hxx>
4+
5+
#include <gtest/gtest.h>
6+
7+
int main(int argc, char **argv){
8+
testing::InitGoogleTest(&argc, argv);
9+
return RUN_ALL_TESTS();
10+
}

0 commit comments

Comments
 (0)