Class Reference for E1039 Core & Analysis Software
PHPointerListIterator.h
Go to the documentation of this file.
1
#ifndef __PHPOINTERLISTITERATOR_H__
2
#define __PHPOINTERLISTITERATOR_H__
3
4
// Declaration of class PHPointerListIterator
5
// Purpose: iterator for access to a PHPointerList
6
// Author: Matthias Messer
7
8
#include "
PHPointerList.h
"
9
10
template
<
class
T>
11
class
PHPointerListIterator
12
{
13
public
:
14
PHPointerListIterator
(
const
PHPointerList<T>
&);
15
virtual
~PHPointerListIterator
() {}
16
17
public
:
18
T*
operator()
();
19
void
operator--
();
20
void
reset
();
21
size_t
pos
()
const
{
return
index; }
22
23
protected
:
24
PHPointerListIterator
() : list(0),index(0) {}
25
26
private
:
27
const
PHPointerList<T>
& list;
28
size_t
index;
29
};
30
31
template
<
class
T>
32
PHPointerListIterator<T>::PHPointerListIterator
(
const
PHPointerList<T>
& lis)
33
: list(lis)
34
{
35
reset
();
36
}
37
38
template
<
class
T> T*
39
PHPointerListIterator<T>::operator()
()
40
{
41
index++;
42
if
(index < list.length())
43
{
44
return
list[index];
45
}
46
else
47
{
48
return
0;
49
}
50
}
51
52
template
<
class
T>
void
53
PHPointerListIterator<T>::operator--
()
54
{
55
--index;
56
}
57
58
template
<
class
T>
void
59
PHPointerListIterator<T>::reset
()
60
{
61
index = ~(size_t) 0;
62
}
63
64
#endif
/* __PHPOINTERLISTITERATOR_H__ */
PHPointerList.h
PHPointerListIterator
Definition:
PHPointerListIterator.h:12
PHPointerListIterator::PHPointerListIterator
PHPointerListIterator()
Definition:
PHPointerListIterator.h:24
PHPointerListIterator::PHPointerListIterator
PHPointerListIterator(const PHPointerList< T > &)
Definition:
PHPointerListIterator.h:32
PHPointerListIterator::~PHPointerListIterator
virtual ~PHPointerListIterator()
Definition:
PHPointerListIterator.h:15
PHPointerListIterator::reset
void reset()
Definition:
PHPointerListIterator.h:59
PHPointerListIterator::operator()
T * operator()()
Definition:
PHPointerListIterator.h:39
PHPointerListIterator::pos
size_t pos() const
Definition:
PHPointerListIterator.h:21
PHPointerListIterator::operator--
void operator--()
Definition:
PHPointerListIterator.h:53
PHPointerList
Definition:
PHPointerList.h:34
e1039-core
framework
phool
PHPointerListIterator.h
Built by
Haiwang Yu
. updated:
Thu Jan 30 2025 10:15:15
using
1.9.1 with
SeaQuest GitHub integration