2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5/// Constructor from Identifier32
6inline Identifier::Identifier(const Identifier32& other)
8 if (other.is_valid()) {
9 m_id = (static_cast<value_type>(other.get_compact()) << 32);
13/// Constructor from Identifier32 value_type (unsigned int)
14/// (only use in id64 case since otherwise redundant)
15inline Identifier::Identifier(Identifier32::value_type value)
17 if (value == ~static_cast<Identifier32::value_type>(0)) {
20 m_id = (static_cast<value_type>(value) << 32);
24inline Identifier::Identifier(int value)
25 : m_id(static_cast<value_type>(value) << 32)
28//-----------------------------------------------
29inline Identifier::Identifier(value_type value)
32 // Print out warning for potential call with value for a 32-bit id
33 // I.e. if lower bits are set and no upper bit set
34 const value_type upper = 0XFFFFFFFF00000000LL;
35 const value_type lower = 0X00000000FFFFFFFFLL;
36 const value_type testUpper = value & upper;
37 const value_type testLower = value & lower;
38 if (testUpper == 0 && testLower > 0) {
39 std::cout << "Identifier::Identifier - WARNING Constructing 64-bit id "
40 "with empty upper and non-empty lower: "
41 << std::hex << testUpper << " " << testLower << std::dec << std::endl;
48Identifier::operator=(const Identifier32& old){
49 m_id = (static_cast<value_type>(old.get_compact()) << 32);
54Identifier::operator=(value_type value){
55 // Print out warning for potential call with value for a 32-bit id
56 // I.e. if lower bits are set and no upper bit set
57 const value_type upper = 0XFFFFFFFF00000000LL;
58 const value_type lower = 0X00000000FFFFFFFFLL;
59 const value_type testUpper = value & upper;
60 const value_type testLower = value & lower;
61 if (testUpper == 0 && testLower > 0) {
62 std::cout << "Identifier::operator = - WARNING Constructing 64-bit id "
63 "with empty upper and non-empty lower: "
64 << std::hex << testUpper << " " << testLower << std::dec << std::endl;
73Identifier::operator=(Identifier32::value_type value){
74 if (value == ~static_cast<Identifier32::value_type>(0)) {
77 m_id = static_cast<value_type>(value) << 32;
83Identifier::operator=(int value){
84 m_id = static_cast<value_type>(value) << 32;
89Identifier::operator|=(value_type value){
95Identifier::operator&=(value_type value){
101Identifier::set_literal(value_type value){
111inline Identifier::value_type
112Identifier::extract(Identifier::size_type shift,
113 Identifier::size_type mask) const{
114 return (m_id >> shift) & static_cast<Identifier::value_type>(mask);
117inline Identifier::value_type
118Identifier::mask_shift(Identifier::value_type mask,
119 Identifier::size_type shift) const{
120 return (m_id & mask) >> shift;
123inline Identifier::value_type
124Identifier::extract(Identifier::size_type shift) const{
125 return (m_id >> shift);
129Identifier::get_identifier32() const{
130 // test for bit set in lower 32
131 if (extract(0, 0xFFFFFFFF)) return (Identifier32());
132 return (Identifier32(extract(32)));
135inline Identifier::value_type
136Identifier::get_compact() const{
142Identifier::operator==(Identifier::value_type other) const{
143 return (m_id == other);
147Identifier::operator==(Identifier32::value_type other) const{
148 return ((*this) == Identifier(other));
152Identifier::operator==(int other) const{
153 return ((*this) == Identifier(other));
156/// This is for logging
159operator<<(MsgStream& f, const Identifier& id){
165operator<<(std::ostream& os, const Identifier& id){
166 os << id.getString();
171Identifier::is_valid() const{
172 return (!(max_value == m_id));