ATLAS Offline Software
Identifier.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #include "Identifier/Identifier.h"
7 #include <charconv>
8 #include <iostream>
9 #include <format>
10 
11 
12 void Identifier::set (const std::string& id){
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 }
22 
23 
24 std::string
26  return std::format("0x{:0x}", m_id);
27 }
28 
29 void
31  const Identifier& me = *this;
32  std::cout << me.getString();
33 }
34 
35 
base
std::string base
Definition: hcg.cxx:78
Identifier::set
void set(const std::string &id)
build from a string form - hexadecimal
Definition: Identifier.cxx:12
vtune_athena.format
format
Definition: vtune_athena.py:14
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
Identifier::m_id
value_type m_id
The only data member.
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:132
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Identifier::show
void show() const
Print out in hex form.
Definition: Identifier.cxx:30
Identifier::getString
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition: Identifier.cxx:25
Identifier
Definition: IdentifierFieldParser.cxx:14