ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
Identifier Class Reference

#include <Identifier.h>

Inheritance diagram for Identifier:
Collaboration diagram for Identifier:

Classes

class  get_compact_func
 A get_compact functional for use in STL algorithms. More...
 

Public Types

enum  bit_defs { NBITS = sizeof(value_type) * 8, MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1)), ALL_BITS = ~(static_cast<value_type>(0)) }
 
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)) }
 
typedef Identifier id_type
 
typedef IDENTIFIER_TYPE value_type
 
typedef IDENTIFIER_DIFF_TYPE diff_type
 
typedef IDENTIFIER_TYPE size_type
 
typedef Long64_t value_type
 
typedef enum Identifier::bit_defs_enum bit_defs
 
typedef enum Identifier::max_value_type_enum max_value_type
 

Public Member Functions

 Identifier ()=default
 Default constructor. More...
 
 Identifier (const Identifier &other)=default
 Default Copy constructor. More...
 
 Identifier (Identifier &&other)=default
 Default Move constructor. More...
 
Identifieroperator= (const Identifier &old)=default
 Default Assignment operators. More...
 
Identifieroperator= (Identifier &&old)=default
 Default Move Assignment operator. More...
 
 ~Identifier ()=default
 Default dtor. More...
 
 Identifier (value_type value)
 Additional ctors Constructor from value_type. More...
 
 Identifier (const Identifier32 &other)
 Constructor from Identifier32. More...
 
 Identifier (Identifier32::value_type value)
 Constructor from 32-bit value_type and int (to avoid common implicit conversions) More...
 
 Identifier (int value)
 
Identifieroperator= (const Identifier32 &old)
 Assignment operators overloads. More...
 
Identifieroperator= (value_type value)
 
Identifieroperator= (Identifier32::value_type value)
 Assignment to avoid common implicit conversions and shift properly. More...
 
Identifieroperator= (int value)
 
void set (const std::string &id)
 build from a string form - hexadecimal More...
 
void clear ()
 Reset to invalid state. More...
 
Identifierset_literal (value_type value)
 Set literal value. More...
 
Identifier32 get_identifier32 (void) const
 Get the 32-bit version Identifier, will be invalid if >32 bits needed. More...
 
value_type get_compact (void) const
 Get the compact id. More...
 
bool operator== (const Identifier &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
 
bool operator>= (const Identifier &other) const
 
bool operator== (value_type other) const
 Comparison operators with value_type. More...
 
bool operator!= (value_type other) const
 
bool operator== (Identifier32::value_type other) const
 
bool operator== (int other) const
 
bool operator!= (Identifier32::value_type other) const
 
bool operator!= (int other) const
 
bool is_valid () const
 Check if id is in a valid state. More...
 
std::string getString () const
 Provide a string form of the identifier - hexadecimal. More...
 
void show () const
 Print out in hex form. More...
 
 Identifier ()
 
 Identifier (const Identifier &value)
 
 Identifier (value_type value)
 
 operator value_type () const
 
Identifieroperator= (const Identifier &old)
 
Identifieroperator= (value_type value)
 
bool operator== (const Identifier &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
 
bool operator>= (const Identifier &other) const
 
bool operator== (Identifier::value_type other) const
 
bool operator!= (Identifier::value_type other) const
 

Private Types

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

Private Member Functions

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

Private Attributes

value_type m_id = max_value
 

Friends

class IdDictDictionary
 
class IdDictFieldImplementation
 
class AtlasDetectorID
 
class PixelID
 

Detailed Description


Identifier is a simple type-safe 64 bit unsigned integer. An Identifier relies on other classes - IdHelpers - to encode and decode its information.

The default constructor created an Identifier an invalid state which can be check with the "is_valid" method to allow some error checking.


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

Member Typedef Documentation

◆ bit_defs

◆ diff_type

◆ id_type


Define public typedefs

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

◆ max_value_type

◆ size_type

◆ value_type [1/2]

typedef Long64_t Identifier::value_type

◆ value_type [2/2]

Member Enumeration Documentation

◆ bit_defs

Enumerator
NBITS 
MAX_BIT 
ALL_BITS 

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

44  {
45  NBITS = sizeof(value_type) * 8, // bits per byte
46  MAX_BIT = (static_cast<value_type>(1) << (NBITS - 1)),
47  ALL_BITS = ~(static_cast<value_type>(0))
48  } bit_defs;

◆ bit_defs_enum

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;

◆ max_value_type

Enumerator
max_value 

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

187  {
188  //max_value = 0xFFFFFFFFFFFFFFFFULL
189  max_value = ~(static_cast<value_type>(0))
190  } max_value_type;

◆ max_value_type_enum

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))

Constructor & Destructor Documentation

◆ Identifier() [1/10]

Identifier::Identifier ( )
default

Default constructor.


Constructors

◆ Identifier() [2/10]

Identifier::Identifier ( const Identifier other)
default

Default Copy constructor.

◆ Identifier() [3/10]

Identifier::Identifier ( Identifier &&  other)
default

Default Move constructor.

◆ ~Identifier()

Identifier::~Identifier ( )
default

Default dtor.

◆ Identifier() [4/10]

Identifier::Identifier ( value_type  value)
explicit

Additional ctors Constructor from value_type.

◆ Identifier() [5/10]

Identifier::Identifier ( const Identifier32 other)

Constructor from Identifier32.

◆ Identifier() [6/10]

Identifier::Identifier ( Identifier32::value_type  value)
explicit

Constructor from 32-bit value_type and int (to avoid common implicit conversions)

◆ Identifier() [7/10]

Identifier::Identifier ( int  value)
explicit

◆ Identifier() [8/10]

Identifier::Identifier ( )
inline

◆ Identifier() [9/10]

Identifier::Identifier ( const Identifier value)
inline

◆ Identifier() [10/10]

Identifier::Identifier ( value_type  value)
inline

Member Function Documentation

◆ clear()

void Identifier::clear ( )

Reset to invalid state.

◆ extract() [1/2]

value_type Identifier::extract ( size_type  shift) const
private

extract field, no mask

◆ extract() [2/2]

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

extract field from identifier (shift first, then mask)

◆ get_compact()

value_type Identifier::get_compact ( void  ) const

Get the compact id.

◆ get_identifier32()

Identifier32 Identifier::get_identifier32 ( void  ) const

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


Accessors

◆ getString()

std::string Identifier::getString ( ) const

Provide a string form of the identifier - hexadecimal.


Utilities

Definition at line 25 of file Identifier.cxx.

26 {
27  std::string result;
28  char temp[20];
29 
30  sprintf (temp, "0x%" IDENTIFIER_PCODE "x", (Identifier::value_type)m_id);
31  result += temp;
32  return (result);
33 }

◆ is_valid()

bool Identifier::is_valid ( ) const

Check if id is in a valid state.


Error management

◆ mask_shift()

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

extract field(s) by masking first, then shifting

◆ operator value_type()

Identifier::operator value_type ( ) const
inline

◆ operator!=() [1/6]

bool Identifier::operator!= ( const Identifier other) const
inline

◆ operator!=() [2/6]

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

◆ operator!=() [3/6]

◆ operator!=() [4/6]

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

◆ operator!=() [5/6]

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

◆ operator!=() [6/6]

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

◆ operator&=()

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

◆ operator<() [1/2]

bool Identifier::operator< ( const Identifier other) const
inline

◆ operator<() [2/2]

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

◆ operator<=() [1/2]

bool Identifier::operator<= ( const Identifier other) const
inline

◆ operator<=() [2/2]

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

◆ operator=() [1/8]

Identifier& Identifier::operator= ( const Identifier old)
inline

◆ operator=() [2/8]

Identifier& Identifier::operator= ( const Identifier old)
default

Default Assignment operators.

◆ operator=() [3/8]

Identifier& Identifier::operator= ( const Identifier32 old)

Assignment operators overloads.


Modifications

◆ operator=() [4/8]

Identifier& Identifier::operator= ( Identifier &&  old)
default

Default Move Assignment operator.

◆ operator=() [5/8]

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

Assignment to avoid common implicit conversions and shift properly.

◆ operator=() [6/8]

Identifier& Identifier::operator= ( int  value)

◆ operator=() [7/8]

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

◆ operator=() [8/8]

Identifier& Identifier::operator= ( value_type  value)

◆ operator==() [1/6]

bool Identifier::operator== ( const Identifier other) const
inline

◆ operator==() [2/6]

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

Comparison operators

◆ operator==() [3/6]

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

◆ operator==() [4/6]

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

◆ operator==() [5/6]

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

◆ operator==() [6/6]

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

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>() [1/2]

bool Identifier::operator> ( const Identifier other) const
inline

◆ operator>() [2/2]

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

◆ operator>=() [1/2]

bool Identifier::operator>= ( const Identifier other) const
inline

◆ operator>=() [2/2]

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

◆ operator|=()

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

Bitwise operations.

◆ set()

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

build from a string form - hexadecimal

Definition at line 18 of file Identifier.cxx.

19 {
20  sscanf (id.c_str(), "0x%" IDENTIFIER_PCODE "x", &m_id);
21 }

◆ set_literal()

Identifier& Identifier::set_literal ( value_type  value)

Set literal value.

◆ show()

void Identifier::show ( ) const

Print out in hex form.

Definition at line 36 of file Identifier.cxx.

37 {
40  const Identifier& me = *this;
41  std::cout << me.getString();
42 }

Friends And Related Function Documentation

◆ AtlasDetectorID

friend class AtlasDetectorID
friend

◆ IdDictDictionary

friend class IdDictDictionary
friend

◆ IdDictFieldImplementation

friend class IdDictFieldImplementation
friend

◆ PixelID

friend class PixelID
friend

Member Data Documentation

◆ m_id

value_type Identifier::m_id = max_value
private

The documentation for this class was generated from the following files:
Identifier::value_type
IDENTIFIER_TYPE value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:39
get_generator_info.result
result
Definition: get_generator_info.py:21
Identifier::MAX_BIT
@ MAX_BIT
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:46
Identifier::max_value
@ max_value
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:189
athena.value
value
Definition: athena.py:122
Identifier::m_id
value_type m_id
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:195
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
Identifier::bit_defs
bit_defs
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:44
Identifier::ALL_BITS
@ ALL_BITS
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:47
Identifier::NBITS
@ NBITS
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:45
Identifier::getString
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition: Identifier.cxx:25
Identifier::max_value_type
max_value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:187
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
CSV_InDetExporter.old
old
Definition: CSV_InDetExporter.py:141
IDENTIFIER_PCODE
#define IDENTIFIER_PCODE
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:11
value_type
Definition: EDM_MasterSearch.h:11