ATLAS Offline Software
Loading...
Searching...
No Matches
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
26public:
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
61private:
62 static constexpr value_type m_maxValue{0xFFFFFFFF};
64};
65
66
67inline Identifier32&
68Identifier32::operator |= (unsigned int value){
69 m_id |= value;
70 return (*this);
71}
72
73inline Identifier32&
74Identifier32::operator &= (unsigned int value){
75 m_id &= value;
76 return (*this);
77}
78
79//stream insertion
80std::ostream & operator << (std::ostream &out, const Identifier32 &c);
81
82
83
84#endif
std::ostream & operator<<(std::ostream &out, const Identifier32 &c)
void clear()
Reset to invalid state.
bool is_valid() const
Check if id is in a valid state.
Identifier32(value_type value)
Constructor from value_type (unsigned int)
auto operator<=>(const Identifier32 &) const =default
Identifier32 & operator&=(value_type value)
value_type get_compact() const
Get the compact id.
Identifier32 id_type
Identifier32()=default
Identifier32 & operator|=(value_type value)
Bitwise operations.
std::string getString() const
Provide a string form of the identifier - hexadecimal.
static constexpr value_type m_maxValue
void show() const
Print out in hex form.
unsigned int value_type
unsigned int size_type
value_type m_id