ATLAS Offline Software
Identifier.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #include "Identifier/Identifier.h"
7 #include <algorithm>
8 #include <cstdarg>
9 #include <cstdio>
10 
11 #include <iostream>
12 #include <iomanip>
13 
14 
15 
16 
17 //-----------------------------------------------
18 void Identifier::set (const std::string& id)
19 {
20  sscanf (id.c_str(), "0x%" IDENTIFIER_PCODE "x", &m_id);
21 }
22 
23 
24 //-----------------------------------------------
25 std::string Identifier::getString() const
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 }
34 
35 //-----------------------------------------------
36 void Identifier::show () const
37 {
40  const Identifier& me = *this;
41  std::cout << me.getString();
42 }
43 
44 
Identifier::value_type
IDENTIFIER_TYPE value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:39
Identifier::set
void set(const std::string &id)
build from a string form - hexadecimal
Definition: Identifier.cxx:18
get_generator_info.result
result
Definition: get_generator_info.py:21
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::show
void show() const
Print out in hex form.
Definition: Identifier.cxx:36
Identifier::getString
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition: Identifier.cxx:25
IDENTIFIER_PCODE
#define IDENTIFIER_PCODE
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:11