EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHPointerListIterator.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHPointerListIterator.h
1 #ifndef PHOOL_PHPOINTERLISTITERATOR_H
2 #define PHOOL_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>
12 {
13  public:
14  explicit PHPointerListIterator(const PHPointerList<T>&);
16  T* operator()();
17  void operator--();
18  void reset();
19  size_t pos() const { return m_Index; }
20 
21  private:
22  PHPointerListIterator() = delete;
24  size_t m_Index;
25 };
26 
27 template <class T>
29  : m_List(lis)
30 {
31  reset();
32 }
33 
34 template <class T>
36 {
37  m_Index++;
38  if (m_Index < m_List.length())
39  {
40  return m_List[m_Index];
41  }
42  else
43  {
44  return 0;
45  }
46 }
47 
48 template <class T>
50 {
51  --m_Index;
52 }
53 
54 template <class T>
56 {
57  m_Index = ~(size_t) 0;
58 }
59 
60 #endif // PHOOL_PHPOINTERLISTITERATOR_H