ATLAS Offline Software
Loading...
Searching...
No Matches
HWIdentifier Class Reference

#include <HWIdentifier.h>

Inheritance diagram for HWIdentifier:
Collaboration diagram for HWIdentifier:

Public Types

typedef enum Identifier::max_value_type_enum max_value_type
enum  bit_defs_enum { NBITS = sizeof(value_type) * 8 , MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1)) , ALL_BITS = ~(static_cast<value_type>(0)) }
enum  max_value_type_enum { max_value = ~(static_cast<value_type>(0)) }
using id_type = Identifier
using value_type = unsigned long long
typedef Long64_t value_type
using diff_type = long long
using size_type = unsigned long long
typedef enum Identifier::bit_defs_enum bit_defs

Public Member Functions

 HWIdentifier ()=default
 Default constructor.
 HWIdentifier (value_type value)
 Constructor from value_type.
 HWIdentifier (const Identifier &old)
 Constructor from Identifier.
 HWIdentifier (Identifier32::value_type value)
 Constructor from Identifier32 value_type (unsigned int)
 HWIdentifier (int value)
void set (const std::string &id)
 build from a string form - hexadecimal
void clear ()
 Reset to invalid state.
Identifierset_literal (value_type value)
 Set literal value.
Identifier32 get_identifier32 () const
 Get the 32-bit version Identifier, will be invalid if >32 bits needed.
value_type get_compact () const
 Get the compact id.
bool operator== (const Identifier &other) const =default
bool operator== (value_type other) const
 Comparison operators with value_type.
bool operator== (Identifier32::value_type other) const
bool operator== (int other) const
bool operator== (const Identifier &other) const
bool operator== (Identifier::value_type other) const
auto operator<=> (const Identifier &other) const
bool is_valid () const
 Check if id is in a valid state.
std::string getString () const
 Provide a string form of the identifier - hexadecimal.
void show () const
 Print out in hex form.
 operator value_type () const
bool operator!= (const Identifier &other) const
bool operator!= (Identifier::value_type other) const
bool operator< (const Identifier &other) const
bool operator> (const Identifier &other) const
bool operator<= (const Identifier &other) const
bool operator>= (const Identifier &other) const

Static Public Attributes

static constexpr unsigned int NBITS = sizeof(value_type) * 8
static constexpr value_type MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1))
static constexpr value_type ALL_BITS = ~(static_cast<value_type>(0))

Private Types

enum  max_value_type { max_value = ~(static_cast<value_type>(0)) }

Private Member Functions

Identifieroperator|= (value_type value)
 Bitwise operations.
Identifieroperator&= (value_type value)
value_type extract (size_type shift, size_type mask) const
 extract field from identifier (shift first, then mask)
value_type extract (size_type shift) const
 extract field, no mask
value_type mask_shift (value_type mask, size_type shift) const
 extract field(s) by masking first, then shifting

Private Attributes

value_type m_id = max_value
 The only data member.

Detailed Description

Definition at line 13 of file HWIdentifier.h.

Member Typedef Documentation

◆ bit_defs

typedef enum Identifier::bit_defs_enum Identifier::bit_defs
inherited

◆ diff_type

using Identifier::diff_type = long long
inherited

◆ id_type

using Identifier::id_type = Identifier
inherited

◆ max_value_type

typedef enum Identifier::max_value_type_enum Identifier::max_value_type
inherited

◆ size_type

using Identifier::size_type = unsigned long long
inherited

◆ value_type [1/2]

using Identifier::value_type = unsigned long long
inherited

◆ value_type [2/2]

typedef Long64_t Identifier::value_type
inherited

Member Enumeration Documentation

◆ bit_defs_enum

enum Identifier::bit_defs_enum
inherited
Enumerator
NBITS 
MAX_BIT 
ALL_BITS 

Definition at line 20 of file Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Identifier/Identifier.h.

21 {
22 NBITS = sizeof(value_type) * 8, // bits per byte
23 MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1)),
24 ALL_BITS = ~(static_cast<value_type>(0))
25 } bit_defs;
#define NBITS

◆ max_value_type

enum Identifier::max_value_type
privateinherited
Enumerator
max_value 

Definition at line 126 of file DetectorDescription/Identifier/Identifier/Identifier.h.

126 {
127 max_value = ~(static_cast<value_type>(0))
128 };

◆ max_value_type_enum

enum Identifier::max_value_type_enum
inherited
Enumerator
max_value 

Definition at line 27 of file Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Identifier/Identifier.h.

27 {
28 //max_value = 0xFFFFFFFFFFFFFFFFULL
29 max_value = ~(static_cast<value_type>(0))
30 } max_value_type;

Constructor & Destructor Documentation

◆ HWIdentifier() [1/5]

HWIdentifier::HWIdentifier ( )
default

Default constructor.

◆ HWIdentifier() [2/5]

HWIdentifier::HWIdentifier ( value_type value)
inlineexplicit

Constructor from value_type.

Definition at line 45 of file HWIdentifier.h.

47{}
Identifier()=default
Default constructor.

◆ HWIdentifier() [3/5]

HWIdentifier::HWIdentifier ( const Identifier & old)
inlineexplicit

Constructor from Identifier.

Definition at line 49 of file HWIdentifier.h.

51{}

◆ HWIdentifier() [4/5]

HWIdentifier::HWIdentifier ( Identifier32::value_type value)
inlineexplicit

Constructor from Identifier32 value_type (unsigned int)

Definition at line 53 of file HWIdentifier.h.

55{}

◆ HWIdentifier() [5/5]

HWIdentifier::HWIdentifier ( int value)
inlineexplicit

Definition at line 57 of file HWIdentifier.h.

59{}

Member Function Documentation

◆ clear()

void Identifier::clear ( )
inherited

Reset to invalid state.

◆ extract() [1/2]

value_type Identifier::extract ( size_type shift) const
privateinherited

extract field, no mask

◆ extract() [2/2]

value_type Identifier::extract ( size_type shift,
size_type mask ) const
privateinherited

extract field from identifier (shift first, then mask)

◆ get_compact()

value_type Identifier::get_compact ( ) const
inherited

Get the compact id.

◆ get_identifier32()

Identifier32 Identifier::get_identifier32 ( ) const
inherited

Get the 32-bit version Identifier, will be invalid if >32 bits needed.

◆ getString()

std::string Identifier::getString ( ) const
inherited

Provide a string form of the identifier - hexadecimal.

Definition at line 25 of file Identifier.cxx.

25 {
26 return std::format("0x{:0x}", m_id);
27}

◆ is_valid()

bool Identifier::is_valid ( ) const
inherited

Check if id is in a valid state.

◆ mask_shift()

value_type Identifier::mask_shift ( value_type mask,
size_type shift ) const
privateinherited

extract field(s) by masking first, then shifting

◆ operator value_type()

Identifier::operator value_type ( ) const
inlineinherited

◆ operator!=() [1/2]

bool Identifier::operator!= ( const Identifier & other) const
inlineinherited

Definition at line 41 of file Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Identifier/Identifier.h.

41{return (m_id != other.m_id);}

◆ operator!=() [2/2]

bool Identifier::operator!= ( Identifier::value_type other) const
inlineinherited

◆ operator&=()

Identifier & Identifier::operator&= ( value_type value)
privateinherited

◆ operator<()

bool Identifier::operator< ( const Identifier & other) const
inlineinherited

Definition at line 42 of file Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Identifier/Identifier.h.

42{return (m_id < other.m_id);}

◆ operator<=()

bool Identifier::operator<= ( const Identifier & other) const
inlineinherited

Definition at line 44 of file Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Identifier/Identifier.h.

44{return (m_id <= other.m_id);}

◆ operator<=>()

auto Identifier::operator<=> ( const Identifier & other) const
inlineinherited

Definition at line 90 of file DetectorDescription/Identifier/Identifier/Identifier.h.

90{return m_id <=> other.m_id;}

◆ operator==() [1/6]

bool Identifier::operator== ( const Identifier & other) const
inlineinherited

Definition at line 40 of file Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Identifier/Identifier.h.

40{return (m_id == other.m_id);}

◆ operator==() [2/6]

bool Identifier::operator== ( const Identifier & other) const
defaultinherited

◆ operator==() [3/6]

bool Identifier::operator== ( Identifier32::value_type other) const
inherited

◆ operator==() [4/6]

bool Identifier::operator== ( Identifier::value_type other) const
inlineinherited

◆ operator==() [5/6]

bool Identifier::operator== ( int other) const
inherited

◆ operator==() [6/6]

bool Identifier::operator== ( value_type other) const
inherited

Comparison operators with value_type.

This is a hack, only because GeoAdaptors/GeoMuonHits wants to to compare explicitly with 0 as a test of whether the identifier has been constructed properly. But is_valid() here compares with max_value, not 0, since presumably it is possible to have a zero value - just not in muons.

◆ operator>()

bool Identifier::operator> ( const Identifier & other) const
inlineinherited

Definition at line 43 of file Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Identifier/Identifier.h.

43{return (m_id > other.m_id);}

◆ operator>=()

bool Identifier::operator>= ( const Identifier & other) const
inlineinherited

Definition at line 45 of file Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/Identifier/Identifier.h.

45{return (m_id >= other.m_id);}

◆ operator|=()

Identifier & Identifier::operator|= ( value_type value)
privateinherited

Bitwise operations.

◆ set()

void Identifier::set ( const std::string & id)
inherited

build from a string form - hexadecimal

Definition at line 12 of file Identifier.cxx.

12 {
13 const auto start = id.data();
14 const auto end = start + id.size();
15 static constexpr int base = 16;
16 //add 2 to start to get past the Ox prefix.
17 const auto [p,ec] = std::from_chars(start+2, end, m_id, base);
18 if (ec != std::errc()){
19 throw std::runtime_error("Number was not parsed in Identifier::set");
20 }
21}
std::string base
Definition hcg.cxx:81

◆ set_literal()

Identifier & Identifier::set_literal ( value_type value)
inherited

Set literal value.

◆ show()

void Identifier::show ( ) const
inherited

Print out in hex form.

Definition at line 30 of file Identifier.cxx.

30 {
31 const Identifier& me = *this;
32 std::cout << me.getString();
33}
std::string getString() const
Provide a string form of the identifier - hexadecimal.

Member Data Documentation

◆ ALL_BITS

value_type Identifier::ALL_BITS = ~(static_cast<value_type>(0))
staticconstexprinherited

◆ m_id

value_type Identifier::m_id = max_value
privateinherited

The only data member.

Definition at line 130 of file DetectorDescription/Identifier/Identifier/Identifier.h.

◆ MAX_BIT

value_type Identifier::MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1))
staticconstexprinherited

◆ NBITS

unsigned int Identifier::NBITS = sizeof(value_type) * 8
staticconstexprinherited

The documentation for this class was generated from the following file: