blob: e5b0964381b852e4c8a39c1dcae4e544aac639f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
// File: NCollection_TListIterator.hxx
// Created: Tue Apr 23 17:33:02 2002
// Author: Alexander KARTOMIN
// <a-kartomin@opencascade.com>
#ifndef NCollection_TListIterator_HeaderFile
#define NCollection_TListIterator_HeaderFile
#include <NCollection_BaseCollection.hxx>
#include <NCollection_BaseList.hxx>
#include <NCollection_TListNode.hxx>
#ifdef WNT
// Disable the warning "operator new unmatched by delete"
#pragma warning (push)
#pragma warning (disable:4291)
#endif
/**
* Purpose: This Iterator class iterates on BaseList of TListNode and is
* instantiated in List/Set/Queue/Stack
* Remark: TListIterator is internal class
*/
template <class TheItemType> class NCollection_TListIterator
: public NCollection_BaseCollection<TheItemType>::Iterator,
public NCollection_BaseList::Iterator
{
public:
//! Empty constructor - for later Init
NCollection_TListIterator (void) :
NCollection_BaseList::Iterator () {}
//! Constructor with initialisation
NCollection_TListIterator (const NCollection_BaseList& theList) :
NCollection_BaseList::Iterator (theList) {}
//! Assignment
NCollection_TListIterator& operator= (const NCollection_TListIterator& theIt)
{
NCollection_BaseList::Iterator& me = * this;
me.operator= (theIt);
return * this;
}
//! Check end
virtual Standard_Boolean More (void) const
{ return (myCurrent!=NULL); }
//! Make step
virtual void Next (void)
{
myPrevious = myCurrent;
myCurrent = myCurrent->Next();
}
//! Constant Value access
virtual const TheItemType& Value (void) const
{ return ((const NCollection_TListNode<TheItemType>*) myCurrent)->Value(); }
//! Variable Value access
virtual TheItemType& ChangeValue (void) const
{ return ((NCollection_TListNode<TheItemType> *)myCurrent)->ChangeValue(); }
//! Operator new for allocating iterators
void* operator new(size_t theSize,
const Handle(NCollection_BaseAllocator)& theAllocator)
{ return theAllocator->Allocate(theSize); }
};
#ifdef WNT
#pragma warning (pop)
#endif
#endif
|