ATLAS Offline Software
Identifier32.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef __Identifier32_h__
6 #define __Identifier32_h__
7 
8 #include <vector>
9 #include <string>
10 #include <iosfwd>
11 
26 public:
28  using value_type = unsigned int;
29  using size_type = unsigned int;
30 
31  Identifier32 () = default;
32 
34  inline explicit Identifier32 (value_type value):m_id(value){}
35 
39 
41  inline void clear () {m_id = m_maxValue;}
42 
44  inline value_type get_compact () const{ return m_id;}
45 
46  //All comparisons, since C++20
47  auto operator<=>(const Identifier32&) const = default;
48 
50  inline bool is_valid () const {return m_id != m_maxValue;}
51 
53  std::string getString() const;
54 
56  void show () const;
57 
58  //convert to string representation
59  explicit operator std::string() const {return getString();}
60 
61 private:
62  static constexpr value_type m_maxValue{0xFFFFFFFF};
64 };
65 
66 
67 inline Identifier32&
69  m_id |= value;
70  return (*this);
71 }
72 
73 inline Identifier32&
75  m_id &= value;
76  return (*this);
77 }
78 
79 //stream insertion
80 std::ostream & operator << (std::ostream &out, const Identifier32 &c);
81 
82 
83 
84 #endif
Identifier32::show
void show() const
Print out in hex form.
Definition: Identifier32.cxx:17
Identifier32::is_valid
bool is_valid() const
Check if id is in a valid state.
Definition: Identifier32.h:50
Identifier32
Definition: Identifier32.h:25
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
operator<<
std::ostream & operator<<(std::ostream &out, const Identifier32 &c)
Definition: Identifier32.cxx:21
Identifier32::m_maxValue
static constexpr value_type m_maxValue
Definition: Identifier32.h:62
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
athena.value
value
Definition: athena.py:124
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
Identifier32::Identifier32
Identifier32(value_type value)
Constructor from value_type (unsigned int)
Definition: Identifier32.h:34
Identifier32::operator|=
Identifier32 & operator|=(value_type value)
Bitwise operations.
Definition: Identifier32.h:68
Identifier32::size_type
unsigned int size_type
Definition: Identifier32.h:29
Identifier32::operator&=
Identifier32 & operator&=(value_type value)
Definition: Identifier32.h:74
Identifier32::clear
void clear()
Reset to invalid state.
Definition: Identifier32.h:41
value_type
Definition: EDM_MasterSearch.h:11
python.compressB64.c
def c
Definition: compressB64.py:93
Identifier32::m_id
value_type m_id
Definition: Identifier32.h:63
Identifier32::getString
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition: Identifier32.cxx:12
Identifier32::Identifier32
Identifier32()=default