ATLAS Offline Software
Loading...
Searching...
No Matches
NavigableIterator.h
Go to the documentation of this file.
1// Hey emacs --- this is -*- C++ -*-
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef NAVIGATION_NAVIGABLEITERATOR_H
8#define NAVIGATION_NAVIGABLEITERATOR_H
9
11
12
13// Normally, i'd want to use iterator_adaptor here.
14// But this causes dictionary problems:
15// - We'd need to add this to the selection (or use an auto-select).
16// - More importantly, it causes cint to crash because type names
17// get too long.
18//
19// Note also that we need to use member functions rather than free functions
20// for operators, or pyroot gets confused.
21
22template <typename CONT, typename RPAR, typename COLL>
24{
25public:
26 // Iterator trait typedefs.
27 typedef typename COLL::const_iterator::iterator_category iterator_category;
28 typedef const typename CONT::base_value_type* value_type;
29 typedef typename COLL::const_iterator::difference_type difference_type;
32
33 typedef typename CONT::base_value_type child_type;
35
36
37public:
39 // Constructor //
41
45
46 NavigableIterator(const COLL& theCollection)
47 : m_actual (theCollection.begin()),
48 m_collection(&theCollection)
49 {
50 }
51
52 // Use implicit copy ctor, dtor, and assignment.
53
54
56
58 {
59 ++m_actual;
60 return *this;
61 }
62
64 {
65 NavigableIterator tmp = *this;
66 ++m_actual;
67 return tmp;
68 }
69
71 {
72 --m_actual;
73 return *this;
74 }
75
77 {
78 NavigableIterator tmp = *this;
79 --m_actual;
80 return tmp;
81 }
82
84 {
85 m_actual += n;
86 return *this;
87 }
88
90 {
91 m_actual -= n;
92 return *this;
93 }
94
96 {
97 NavigableIterator tmp = *this;
98 tmp += n;
99 return tmp;
100 }
101
103 {
104 NavigableIterator tmp = *this;
105 tmp -= n;
106 return tmp;
107 }
108
110 {
111 return m_actual - other.m_actual;
112 }
113
114
116
117 const child_type* operator*() const
118 {
120 }
121
122 const child_type* operator->() const
123 {
125 }
126
128 {
130 }
131
133 {
135 }
136
137
139
140 bool operator== (const NavigableIterator& other) const
141 {
142 return m_actual == other.m_actual;
143 }
144
145 bool operator!= (const NavigableIterator& other) const
146 {
147 return m_actual != other.m_actual;
148 }
149
150 bool operator< (const NavigableIterator& other) const
151 {
152 return m_actual < other.m_actual;
153 }
154
155 bool operator> (const NavigableIterator& other) const
156 {
157 return m_actual > other.m_actual;
158 }
159
160 bool operator<= (const NavigableIterator& other) const
161 {
162 return m_actual <= other.m_actual;
163 }
164
165 bool operator>= (const NavigableIterator& other) const
166 {
167 return m_actual >= other.m_actual;
168 }
169
170
172
174 {
175 m_actual = m_collection->begin();
176 return *this;
177 }
178
180 {
181 m_actual = m_collection->end();
182 return *this;
183 }
184
186 {
187 ++m_actual;
188 return *this;
189 }
190
192 {
193 --m_actual;
194 return *this;
195 }
196
197 RPAR getParameter() const
198 {
200 }
201
202 // access to internal iterator
203 typename COLL::const_iterator getInternalIterator() const
204 {
205 return m_actual;
206 }
207
208
209
210protected:
211
212 typename COLL::const_iterator m_actual;
213 const COLL* m_collection;
214};
215
216
217template <typename CONT, typename RPAR, typename COLL>
226
227#endif
static Double_t a
NavigableIterator< CONT, RPAR, COLL > operator+(typename NavigableIterator< CONT, RPAR, COLL >::difference_type n, NavigableIterator< CONT, RPAR, COLL > a)
const CONT::base_value_type * value_type
COLL::const_iterator::difference_type difference_type
bool operator<=(const NavigableIterator &other) const
NavigableIterator & operator++()
NavigableIterator begin()
NavigableIterator next()
COLL::const_iterator getInternalIterator() const
bool operator>=(const NavigableIterator &other) const
const child_type * operator*() const
const COLL * m_collection
bool operator>(const NavigableIterator &other) const
NavigableIterator & operator--()
const child_type * operator[](difference_type n) const
const child_type * operator->() const
const ElementLink< CONT > & getElement() const
CONT::base_value_type child_type
NavigableIterator(const COLL &theCollection)
COLL::const_iterator::iterator_category iterator_category
NavigableIterator end()
NavigableIterator previous()
NavigableIterator operator-(difference_type n) const
bool operator!=(const NavigableIterator &other) const
NavigationDefaults::DefaultChildColl< CONT, RPAR > helper_type
NavigableIterator & operator+=(difference_type n)
bool operator<(const NavigableIterator &other) const
bool operator==(const NavigableIterator &other) const
NavigableIterator operator+(difference_type n) const
COLL::const_iterator m_actual
NavigableIterator & operator-=(difference_type n)
RPAR getParameter() const
static RPAR getChildPar(type_const_iterator thisIter)
static const ElementLink< CONT > * getElementPtr(type_const_iterator thisIter)
static const_child_ptr getChildPtr(type_const_iterator thisIter)