2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 //-----------------------------------------------
6 inline ExpandedIdentifier::ExpandedIdentifier(const ExpandedIdentifier& other,
9 if (start < other.fields()) {
10 element_vector::const_iterator it = other.m_fields.begin();
13 m_fields.insert(m_fields.end(), it, other.m_fields.end());
18 //-----------------------------------------------
20 ExpandedIdentifier::add(element_type value)
22 // Max size of id levels should be < 12
23 m_fields.push_back(value);
26 //-----------------------------------------------
27 inline ExpandedIdentifier&
28 ExpandedIdentifier::operator<<(element_type value)
30 // Max size of id levels should be < 12
31 m_fields.push_back(value);
35 //-----------------------------------------------
36 inline ExpandedIdentifier::element_type& ExpandedIdentifier::operator[](
39 // Raises an exception if index is out-of-bounds.
40 return m_fields.at(index);
43 //-----------------------------------------------
45 ExpandedIdentifier::clear()
51 //-----------------------------------------------
52 inline ExpandedIdentifier::element_type ExpandedIdentifier::operator[](
53 size_type index) const
55 // Raises an exception if index is out-of-bounds.
56 return m_fields.at(index);
59 //-----------------------------------------------
60 inline ExpandedIdentifier::size_type
61 ExpandedIdentifier::fields() const
63 return (m_fields.size());
66 // Comparison operators
68 //----------------------------------------------------------------
70 ExpandedIdentifier::operator==(const ExpandedIdentifier& other) const
72 const ExpandedIdentifier& me = *this;
73 const size_type my_fields = fields();
74 const size_type other_fields = other.fields();
76 if (my_fields != other_fields)
80 for (; field < my_fields; ++field) {
81 if (me[field] != other[field])
88 //----------------------------------------------------------------
90 ExpandedIdentifier::operator!=(const ExpandedIdentifier& other) const
92 const ExpandedIdentifier& me = *this;
94 return (!(me == other));
97 //-----------------------------------------------
99 ExpandedIdentifier::operator<(const ExpandedIdentifier& other) const
101 const ExpandedIdentifier& me = *this;
102 const size_type my_fields = fields();
103 const size_type other_fields = other.fields();
107 if ((field == my_fields) || (field == other_fields)) {
108 // Someone has run out of fields. And up to now my_id ==
109 // other_id. If the lengths are different, the following
110 // then defines the "shorter" one to be "less than". If
111 // the lengths are the same, then the two are NOT "less
113 return (my_fields < other_fields);
116 element_type my_field = me[field];
117 element_type other_field = other[field];
119 if (my_field < other_field)
121 if (my_field > other_field)
130 //-----------------------------------------------
132 ExpandedIdentifier::operator>(const ExpandedIdentifier& other) const
134 const ExpandedIdentifier& me = *this;
139 //----------------------------------------------------------------
141 ExpandedIdentifier::match(const ExpandedIdentifier& other) const
143 const ExpandedIdentifier& me = *this;
144 const size_type my_fields = fields();
145 const size_type other_fields = other.fields();
147 const size_type fs = (my_fields < other_fields) ? my_fields : other_fields;
149 for (size_type field = 0; field < fs; ++field) {
150 if (me[field] != other[field])