ATLAS Offline Software
Loading...
Searching...
No Matches
Identifier32.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef __Identifier32_h__
6#define __Identifier32_h__
7
8
9#include <vector>
10#include <string>
11#include <iostream>
12
13class MsgStream;
14
29public:
31 using value_type = unsigned int;
32 using size_type = unsigned int;
33
34 Identifier32 () = default;
35
37 inline explicit Identifier32 (value_type value):m_id(value){}
38
42
44 inline void clear () {m_id = m_maxValue;}
45
47 inline value_type get_compact () const{ return m_id;}
48
49 //All comparisons, since C++20
50 auto operator<=>(const Identifier32&) const = default;
51
53 inline bool is_valid () const {return m_id != m_maxValue;}
54
56 std::string getString() const;
57
59 void show (std::ostream & out = std::cout) const;
60 void show (MsgStream & out) const;
61
62 //convert to string representation
63 explicit operator std::string() const {return getString();}
64
65private:
66 static constexpr value_type m_maxValue{0xFFFFFFFF};
68};
69
70
71inline Identifier32&
72Identifier32::operator |= (unsigned int value){
73 m_id |= value;
74 return (*this);
75}
76
77inline Identifier32&
78Identifier32::operator &= (unsigned int value){
79 m_id &= value;
80 return (*this);
81}
82
83//stream insertion
84std::ostream & operator << (std::ostream &out, const Identifier32 &c);
85
86
87
88#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.
void show(std::ostream &out=std::cout) const
Print out in hex form.
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
unsigned int value_type
unsigned int size_type
value_type m_id