ATLAS Offline Software
Loading...
Searching...
No Matches
MultiRange.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef IDENTIFIER_MULTIRANGE_H
6#define IDENTIFIER_MULTIRANGE_H
7
8
10#include "Identifier/Range.h"
12#include <vector>
13#include <iosfwd>
14#include <string>
15
17class MultiRange {
18public:
19 using range_vector = std::vector<Range> ;
22 using const_iterator = range_vector::const_iterator;
23
31 public:
32 identifier_factory () = default;
33 identifier_factory (const MultiRange& multirange);
34 void operator ++ ();
35 const ExpandedIdentifier& operator * () const;
36 bool operator == (const identifier_factory& other) const;
37
38 private:
39 using id_vec = std::vector<ExpandedIdentifier>;
40 using id_iterator = id_vec::iterator;
41 using id_const_iterator = id_vec::const_iterator;
42
46 range_vector::const_iterator m_range_it{};
47 range_vector::const_iterator m_range_end{};
50 };
51
53 public:
55 const_identifier_factory (const MultiRange& multirange);
56 void operator ++ ();
57 const ExpandedIdentifier& operator * () const;
58 bool operator == (const const_identifier_factory& other) const;
59
60 private:
61 using id_vec = std::vector<ExpandedIdentifier>;
62 using id_iterator = id_vec::iterator;
63 using id_const_iterator = id_vec::const_iterator;
64
68 range_vector::const_iterator m_range_it{};
69 range_vector::const_iterator m_range_end{};
72 };
73
74 MultiRange () = default;
79 MultiRange (const Range& r, const Range& s);
80
81 void clear ();
82
83 void add (const Range& range);
84
86 void add (Range&& range);
87
89 void add (const ExpandedIdentifier& id);
90
92 void remove_range (const ExpandedIdentifier& id);
93
95 Range& back ();
96
98 int match (const ExpandedIdentifier& id) const;
99
101 const Range& operator [] (size_type index) const;
102 size_type size () const;
103 const_iterator begin () const;
104 const_iterator end () const;
105
109 size_type cardinality () const;
110
111 // Up to a given id
113
115 bool has_overlap() const;
116
117 // identifier_factory management
122 void show () const;
123 void show (std::ostream& s) const;
125 operator std::string () const;
126
127 private:
128 friend class identifier_factory;
130 using id_vec = std::vector<ExpandedIdentifier>;
132};
133
134#endif
boost::container::small_vector< element_type, 12 >::size_type size_type
range_vector::const_iterator m_range_end
Definition MultiRange.h:69
const ExpandedIdentifier & operator*() const
bool operator==(const const_identifier_factory &other) const
std::vector< ExpandedIdentifier > id_vec
Definition MultiRange.h:61
id_vec::const_iterator id_const_iterator
Definition MultiRange.h:63
range_vector::const_iterator m_range_it
Definition MultiRange.h:68
This factory is able to generate all possible identifiers, from a fully bounded Range.
Definition MultiRange.h:30
range_vector::const_iterator m_range_it
Definition MultiRange.h:46
bool operator==(const identifier_factory &other) const
range_vector::const_iterator m_range_end
Definition MultiRange.h:47
id_vec::const_iterator id_const_iterator
Definition MultiRange.h:41
ConstRangeIterator m_id_fac_it
Definition MultiRange.h:44
std::vector< ExpandedIdentifier > id_vec
Definition MultiRange.h:39
ConstRangeIterator m_id_fac_end
Definition MultiRange.h:45
id_vec::iterator id_iterator
Definition MultiRange.h:40
const ExpandedIdentifier & operator*() const
ExpandedIdentifier m_id
Definition MultiRange.h:43
void clear()
std::vector< ExpandedIdentifier > id_vec
Definition MultiRange.h:130
size_type cardinalityUpTo(const ExpandedIdentifier &id) const
bool has_overlap() const
Check if there are overlaps between any couple of Ranges.
range_vector::const_iterator const_iterator
Definition MultiRange.h:22
identifier_factory factory_end()
const Range & operator[](size_type index) const
Accessors.
void remove_range(const ExpandedIdentifier &id)
Remove a Range made from a single ExpandedIdentifier.
range_vector m_ranges
Definition MultiRange.h:131
ExpandedIdentifier::element_type element_type
Definition MultiRange.h:20
size_type cardinality() const
Computes a possible cardinality from all ranges.
const_iterator begin() const
Range & back()
Get the last entered Range.
ExpandedIdentifier::size_type size_type
Definition MultiRange.h:21
identifier_factory factory_begin()
const_iterator end() const
std::vector< Range > range_vector
Definition MultiRange.h:19
void add(const Range &range)
int match(const ExpandedIdentifier &id) const
Match an identifier.
void show() const
MultiRange()=default
size_type size() const
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
int r
Definition globals.cxx:22
Definition index.py:1