ATLAS Offline Software
Loading...
Searching...
No Matches
SGIterator.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4*/
5/*
6 */
11
12
13#ifndef STOREGATE_SGITERATOR_H
14#define STOREGATE_SGITERATOR_H
15
16
18#include "SGTools/DataProxy.h"
20#include "SGTools/ProxyMap.h"
22#include <boost/iterator/iterator_facade.hpp>
23class SGImplSvc;
24
25
26namespace SG {
27
28
29namespace detail {
30
31
38protected:
39 // Required for boost iterator adapter.
41
42 // To access setState.
43 friend class ::SGImplSvc;
44
45
50
51
62 bool isConst);
63
64
68 IteratorBase (const IteratorBase& other);
69
70
75
76
81
82
92 StatusCode setState (SG::ConstProxyIterator itr,
94 bool isConst);
95
96
102 void increment();
103
104
108 bool eql(const IteratorBase& rhs) const;
109
110
116 void const_check() const;
117
118
119public:
123 DataProxy* proxy() const;
124
125
129 const std::string& key() const;
130
131
132private:
136 void addRef();
137
138
142 void release();
143
144
146 std::vector<SG::DataProxy*> m_proxies;
147};
148
149
150} //end ns detail
151
152
157template <class DATA>
159 : public detail::IteratorBase,
160 public boost::iterator_facade<
161 ConstIterator<DATA>,
162 const DATA,
163 boost::forward_traversal_tag >
164{
165public:
170
171
180 const SG::ConstProxyIterator& itrEnd);
181
182
191 StatusCode setState (const SG::ConstProxyIterator& itr,
192 const SG::ConstProxyIterator& itrEnd);
193
194
195private:
196 // Required for boost iterator adapter.
198 // INHERITED: void increment();
199
200
206 bool equal (const ConstIterator& rhs) const;
207
208
216 const DATA& dereference() const;
217};
218
219
223template <class DATA>
225 : public detail::IteratorBase,
226 public boost::iterator_facade<
227 Iterator<DATA>,
228 DATA,
229 boost::forward_traversal_tag >
230{
231public:
236
237
245 explicit Iterator (const SG::ConstProxyIterator& itr,
246 const SG::ConstProxyIterator& itrEnd);
247
248
257 StatusCode setState (const SG::ConstProxyIterator& itr,
258 const SG::ConstProxyIterator& itrEnd);
259
260
261private:
262 // Required for boost iterator adapter.
264 //INHERITED: void increment();
265
266
272 bool equal(const Iterator<DATA>& rhs) const;
273
274
283 DATA& dereference() const;
284};
285
286
287} // namespace SG
288
289
291
292
293#endif
294
Exceptions that can be thrown from StoreGate.
Helpers for retrieving the payload held by a DataProxy.
The Athena Transient Store API.
Definition SGImplSvc.h:110
ConstIterator()
Default constructor.
const DATA & dereference() const
Dereference the iterator.
friend class boost::iterator_core_access
Definition SGIterator.h:197
ConstIterator(const SG::ConstProxyIterator &itr, const SG::ConstProxyIterator &itrEnd)
Constructor from proxy iterator pair.
StatusCode setState(const SG::ConstProxyIterator &itr, const SG::ConstProxyIterator &itrEnd)
Reset state of the iterator.
bool equal(const ConstIterator &rhs) const
Equality check.
Iterator()
Default constructor.
Iterator(const SG::ConstProxyIterator &itr, const SG::ConstProxyIterator &itrEnd)
Constructor from proxy iterator pair.
friend class boost::iterator_core_access
Definition SGIterator.h:263
bool equal(const Iterator< DATA > &rhs) const
Equality check.
DATA & dereference() const
Dereference the iterator.
StatusCode setState(const SG::ConstProxyIterator &itr, const SG::ConstProxyIterator &itrEnd)
Reset state of the iterator.
Implementation class, not to be used directly Iterates over valid proxies it the range.
Definition SGIterator.h:37
std::vector< SG::DataProxy * > m_proxies
All proxies in our range, in reverse order.
Definition SGIterator.h:146
const std::string & key() const
Get the key string with which the current object was stored.
DataProxy * proxy() const
The proxy pointed at by this iterator.
void increment()
Move to the next valid proxy.
IteratorBase & operator=(const IteratorBase &other)
Assignment.
void const_check() const
Const check: throw an exception if we're pointing at a const proxy.
IteratorBase()
Default constructor.
void release()
Remove a reference count from all proxies in our range.
friend class boost::iterator_core_access
Definition SGIterator.h:40
StatusCode setState(SG::ConstProxyIterator itr, SG::ConstProxyIterator itrEnd, bool isConst)
Reset state of the iterator.
bool eql(const IteratorBase &rhs) const
Equality check.
void addRef()
Add a reference count to all proxies in our range.
Forward declaration.
ProxyMap::const_iterator ConstProxyIterator
Definition ProxyMap.h:24