ATLAS Offline Software
DetectorDescription
Identifier
src
DetectorDescription/Identifier/src/ExpandedIdentifier.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/ExpandedIdentifier.h
"
7
#include <cstdio>
8
#include <cstring>
9
#include <iomanip>
10
#include <iostream>
11
#include <charconv>
12
#include <stdexcept>
13
#include <ranges>
14
15
static
std::string
16
show_vector (
const
ExpandedIdentifier::element_vector
&
v
,
const
std::string &
sep
=
"/"
){
17
if
(
v
.empty())
return
{};
18
std::string
result
=
std::to_string
(
v
.front());
19
for
(
auto
value
:
v
| std::views::drop(1)){
20
result
+=
sep
+
std::to_string
(
value
);
21
}
22
return
result
;
23
}
24
25
26
ExpandedIdentifier::ExpandedIdentifier
(
const
std::string&
text
){
27
set
(
text
);
28
}
29
30
31
void
32
ExpandedIdentifier::set
(
const
std::string&
text
){
33
clear
();
34
if
(
text
.empty())
return
;
35
const
char
*
start
=
text
.c_str();
36
const
char
*last =
start
+
text
.size();
37
static
constexpr
auto
ok=std::errc{};
38
int
v
{};
39
bool
foundNumber{};
40
for
(
const
char
*
p
=
start
;
p
<last;++
p
){
41
auto
[
ptr
,ec] = std::from_chars(
p
, last,
v
);
42
p
=
ptr
;
43
if
(ec != ok)
continue
;
44
add
((
element_type
)
v
);
45
foundNumber =
true
;
46
}
47
if
(not foundNumber){
48
const
std::string
msg
=
"ExpandedIdentifier::set: '"
+
text
+
"' is not a valid input string."
;
49
throw
std::invalid_argument(
msg
);
50
}
51
}
52
53
54
55
ExpandedIdentifier::operator
std::string ()
const
{
56
return
show_vector(m_fields);
57
}
58
59
void
60
ExpandedIdentifier::show
()
const
{
61
std::cout<<
"["
<< show_vector (
m_fields
,
"."
) <<
"]"
;
62
}
63
64
std::ostream &
operator <<
(std::ostream &
out
,
const
ExpandedIdentifier
&
x
){
65
out
<<std::string(
x
);
66
return
out
;
67
}
68
69
get_generator_info.result
result
Definition:
get_generator_info.py:21
mergePhysValFiles.start
start
Definition:
DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
ExpandedIdentifier::add
void add(element_type value)
Append a value into a new field.
python.AthDsoLogger.out
out
Definition:
AthDsoLogger.py:71
ExpandedIdentifier
Definition:
DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
ExpandedIdentifier::show
void show() const
Send to std::cout.
Definition:
DetectorDescription/Identifier/src/ExpandedIdentifier.cxx:60
athena.value
value
Definition:
athena.py:124
ExpandedIdentifier.h
dbg::ptr
void * ptr(T *p)
Definition:
SGImplSvc.cxx:74
x
#define x
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
ExpandedIdentifier::set
void set(const std::string &text)
build from a textual description
Definition:
DetectorDescription/Identifier/src/ExpandedIdentifier.cxx:32
ExpandedIdentifier::m_fields
element_vector m_fields
Definition:
DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:163
grepfile.sep
sep
Definition:
grepfile.py:38
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition:
GeometryDefs.h:34
python.PyAthena.v
v
Definition:
PyAthena.py:154
ExpandedIdentifier::ExpandedIdentifier
ExpandedIdentifier()=default
ExpandedIdentifier::clear
void clear()
Erase all fields.
makeTransCanvas.text
text
Definition:
makeTransCanvas.py:11
operator<<
std::ostream & operator<<(std::ostream &out, const ExpandedIdentifier &x)
Definition:
DetectorDescription/Identifier/src/ExpandedIdentifier.cxx:64
ExpandedIdentifier::element_type
int element_type
Definition:
DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:106
python.AutoConfigFlags.msg
msg
Definition:
AutoConfigFlags.py:7
ExpandedIdentifier::element_vector
boost::container::small_vector< element_type, 12 > element_vector
Definition:
DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:107
ExpandedIdentifier::operator
auto operator(const ExpandedIdentifier &other) const
Comparison operators.
Generated on Sat Jun 21 2025 21:09:54 for ATLAS Offline Software by
1.8.18