ATLAS Offline Software
RangeIterator.h
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
4 */
5 
6 #ifndef Identifier_RangeIterator_h
7 #define Identifier_RangeIterator_h
8 
10 #include <vector>
11 class Range;
12 
19 class RangeIterator {
20  public:
21  using iterator_category = std::forward_iterator_tag;
22  using difference_type = std::ptrdiff_t;
24  using pointer = ExpandedIdentifier*; // or also value_type*
25  using reference = ExpandedIdentifier&; // or also value_type&
26 
27  RangeIterator() = default;
30 
31  RangeIterator begin() const;
32  RangeIterator end() const;
33 
34  pointer operator->() { return &m_id; }
36  bool operator == (const RangeIterator& other) const;
37 
38  private:
39  std::vector<std::size_t> m_indices;
43  const Range* m_range{};
44 };
45 
47  public:
48  using iterator_category = std::forward_iterator_tag;
49  using difference_type = std::ptrdiff_t;
51  using pointer = ExpandedIdentifier*; // or also value_type*
52  using reference = ExpandedIdentifier&; // or also value_type&
53 
54  ConstRangeIterator () = default;
55  ConstRangeIterator (const Range& range);
56  ConstRangeIterator begin() const;
57  ConstRangeIterator end() const;
58 
60 
61  const ExpandedIdentifier& operator *() const;
62  bool operator == (const ConstRangeIterator& other) const;
63 
64  private:
65  std::vector<std::size_t> m_indices;
69  const Range* m_range{};
70 };
71 
72 #endif
ConstRangeIterator::m_indices
std::vector< std::size_t > m_indices
Definition: RangeIterator.h:65
RangeIterator::m_indices
std::vector< std::size_t > m_indices
Definition: RangeIterator.h:39
ConstRangeIterator
Definition: RangeIterator.h:46
RangeIterator::difference_type
std::ptrdiff_t difference_type
Definition: RangeIterator.h:22
ConstRangeIterator::m_id
ExpandedIdentifier m_id
Definition: RangeIterator.h:66
ConstRangeIterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: RangeIterator.h:48
RangeIterator
This iterator is able to generate all possible identifiers, from a fully bounded Range.
Definition: RangeIterator.h:19
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
ExpandedIdentifier.h
ConstRangeIterator::m_range
const Range * m_range
Definition: RangeIterator.h:69
RangeIterator::operator==
bool operator==(const RangeIterator &other) const
Definition: RangeIterator.cxx:143
RangeIterator::begin
RangeIterator begin() const
Definition: RangeIterator.cxx:12
RangeIterator::m_max
ExpandedIdentifier m_max
Definition: RangeIterator.h:42
RangeIterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: RangeIterator.h:21
ConstRangeIterator::operator==
bool operator==(const ConstRangeIterator &other) const
Definition: RangeIterator.cxx:250
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
RangeIterator::m_range
const Range * m_range
Definition: RangeIterator.h:43
ConstRangeIterator::begin
ConstRangeIterator begin() const
Definition: RangeIterator.cxx:18
RangeIterator::operator->
pointer operator->()
Definition: RangeIterator.h:34
RangeIterator::operator*
ExpandedIdentifier & operator*()
Definition: RangeIterator.cxx:137
ConstRangeIterator::operator++
ConstRangeIterator operator++()
Definition: RangeIterator.cxx:181
ConstRangeIterator::operator*
const ExpandedIdentifier & operator*() const
Definition: RangeIterator.cxx:244
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
ConstRangeIterator::difference_type
std::ptrdiff_t difference_type
Definition: RangeIterator.h:49
RangeIterator::end
RangeIterator end() const
Definition: RangeIterator.cxx:24
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
ConstRangeIterator::ConstRangeIterator
ConstRangeIterator()=default
RangeIterator::m_min
ExpandedIdentifier m_min
Definition: RangeIterator.h:41
RangeIterator::operator++
RangeIterator & operator++()
Definition: RangeIterator.cxx:71
ConstRangeIterator::end
ConstRangeIterator end() const
Definition: RangeIterator.cxx:32
ConstRangeIterator::m_max
ExpandedIdentifier m_max
Definition: RangeIterator.h:68
RangeIterator::RangeIterator
RangeIterator()=default
ConstRangeIterator::m_min
ExpandedIdentifier m_min
Definition: RangeIterator.h:67
RangeIterator::m_id
ExpandedIdentifier m_id
Definition: RangeIterator.h:40