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-2026 CERN for the benefit of the ATLAS collaboration
4*/
9
10
11#ifndef STOREGATE_SGITERATOR_H
12#define STOREGATE_SGITERATOR_H
13
14
16#include "SGTools/DataProxy.h"
18#include "SGTools/ProxyMap.h"
20#include <boost/iterator/iterator_facade.hpp>
21#include <iterator>
22#include <concepts>
23class SGImplSvc;
24
25
26namespace SG {
27
28
29namespace detail {
30
32template <class ITERATOR>
34 std::bidirectional_iterator<ITERATOR> && std::same_as<typename std::iterator_traits<ITERATOR>::value_type, DataProxy*>;
35
36
43protected:
44 // Required for boost iterator adapter.
46
47 // To access setState.
48 friend class ::SGImplSvc;
49
50
54 IteratorBase() = default;
55
56
67 bool isConst);
68
69
78 template <DataProxyIterator ITERATOR>
79 explicit IteratorBase (ITERATOR itr, ITERATOR itrEnd, bool isConst);
80
81
85 IteratorBase (const IteratorBase& other);
86
87
92
93
98
99
109 StatusCode setState (SG::ConstProxyIterator itr,
111 bool isConst);
112
113
123 template <DataProxyIterator ITERATOR>
124 StatusCode setState (ITERATOR itr, ITERATOR itrEnd, bool isConst);
125
126
132 void increment();
133
134
138 bool eql(const IteratorBase& rhs) const;
139
140
146 void const_check() const;
147
148
149public:
153 DataProxy* proxy() const;
154
155
159 const std::string& key() const;
160
161
162private:
166 void addRef();
167
168
172 void release();
173
174
176 std::vector<SG::DataProxy*> m_proxies;
177};
178
179
180} //end ns detail
181
182
188 : public detail::IteratorBase,
189 public boost::iterator_facade<
190 TypelessIterator,
191 DataProxy*,
192 boost::forward_traversal_tag,
193 DataProxy*>
194{
195public:
197
198
202 TypelessIterator() = default;
203
204
214
215
223 template <detail::DataProxyIterator ITERATOR>
224 explicit TypelessIterator (ITERATOR itr, ITERATOR itrEnd);
225
226
237
238
247 template <detail::DataProxyIterator ITERATOR>
248 StatusCode setState (ITERATOR itr, ITERATOR itrEnd);
249
250
251private:
252 // Required for boost iterator adapter.
254 //INHERITED: void increment();
255
256
262 bool equal(const TypelessIterator& rhs) const;
263
264
271};
272
273
278template <class DATA>
280 : public detail::IteratorBase,
281 public boost::iterator_facade<
282 ConstIterator<DATA>,
283 const DATA,
284 boost::forward_traversal_tag >
285{
286public:
291
292
302
303
314
315
316private:
317 // Required for boost iterator adapter.
319 // INHERITED: void increment();
320
321
327 bool equal (const ConstIterator& rhs) const;
328
329
337 const DATA& dereference() const;
338};
339
340
344template <class DATA>
346 : public detail::IteratorBase,
347 public boost::iterator_facade<
348 Iterator<DATA>,
349 DATA,
350 boost::forward_traversal_tag >
351{
352public:
357
358
368
369
380
381
382private:
383 // Required for boost iterator adapter.
385 //INHERITED: void increment();
386
387
393 bool equal(const Iterator<DATA>& rhs) const;
394
395
404 DATA& dereference() const;
405};
406
407
408} // namespace SG
409
410
412
413
414#endif
415
Exceptions that can be thrown from StoreGate.
Helpers for retrieving the payload held by a DataProxy.
The Athena Transient Store API.
Definition SGImplSvc.h:107
ConstIterator()
Default constructor.
const DATA & dereference() const
Dereference the iterator.
friend class boost::iterator_core_access
Definition SGIterator.h:318
bool equal(const ConstIterator &rhs) const
Equality check.
ConstIterator(SG::ConstProxyIterator itr, SG::ConstProxyIterator itrEnd)
Constructor from proxy iterator pair.
StatusCode setState(SG::ConstProxyIterator itr, SG::ConstProxyIterator itrEnd)
Reset state of the iterator.
Iterator()
Default constructor.
Iterator(SG::ConstProxyIterator itr, SG::ConstProxyIterator itrEnd)
Constructor from proxy iterator pair.
StatusCode setState(SG::ConstProxyIterator itr, SG::ConstProxyIterator itrEnd)
Reset state of the iterator.
friend class boost::iterator_core_access
Definition SGIterator.h:384
bool equal(const Iterator< DATA > &rhs) const
Equality check.
DATA & dereference() const
Dereference the iterator.
StatusCode setState(ITERATOR itr, ITERATOR itrEnd)
Reset state of the iterator.
TypelessIterator()=default
Default constructor.
DataProxy * dereference() const
Dereference the iterator.
bool equal(const TypelessIterator &rhs) const
Equality check.
StatusCode setState(SG::ConstProxyIterator itr, SG::ConstProxyIterator itrEnd)
Reset state of the iterator.
friend class boost::iterator_core_access
Definition SGIterator.h:253
TypelessIterator(SG::ConstProxyIterator itr, SG::ConstProxyIterator itrEnd)
Constructor from proxy iterator pair.
TypelessIterator(ITERATOR itr, ITERATOR itrEnd)
Constructor from iterator pair over DataProxy*.
Implementation class, not to be used directly Iterates over valid proxies in the range.
Definition SGIterator.h:42
std::vector< SG::DataProxy * > m_proxies
All proxies in our range, in reverse order.
Definition SGIterator.h:176
StatusCode setState(ITERATOR itr, ITERATOR itrEnd, bool isConst)
Reset state of the iterator.
IteratorBase(ITERATOR itr, ITERATOR itrEnd, bool isConst)
Constructor from iterator pair over DataProxy*.
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.
void release()
Remove a reference count from all proxies in our range.
friend class boost::iterator_core_access
Definition SGIterator.h:45
IteratorBase()=default
Default constructor.
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.
A bidirectional_iterator over DataProxy*.
Definition SGIterator.h:33
Forward declaration.
ProxyMap::const_iterator ConstProxyIterator
Definition ProxyMap.h:24