ATLAS Offline Software
DetectorDescription
Identifier
src
IdentifierFieldParser.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
#include "
src/IdentifierFieldParser.h
"
6
7
#include <string>
8
#include <iostream>
9
#include <charconv>
10
#include <cctype>
11
12
13
14
namespace
Identifier
{
15
bool
16
isDigit
(
const
char
c
){
17
return
std::isdigit(
c
) or
c
==
'-'
or
c
==
'+'
;
18
}
19
20
IdentifierField::element_type
21
parseStreamDigits
(std::istream & is){
22
static
constexpr std::errc ok{};
23
char
buffer
[20]{};
24
int
i
{};
25
IdentifierField::element_type
v
{};
26
for
(
int
c
{};
isDigit
(is.peek()) and
i
<20;++
i
){
27
if
(
c
==
'+'
) is.ignore();
28
c
=is.get();
29
buffer
[
i
] =
c
;
30
}
31
const
auto
[
ptr
,ec] = std::from_chars(
buffer
,
buffer
+
i
,
v
);
32
if
(ec != ok)
throw
std::invalid_argument(
"Invalid argument in parseStreamDigits"
);
33
return
v
;
34
}
35
36
IdentifierField::element_vector
37
parseStreamList
(std::istream & is){
38
IdentifierField::element_vector
result
;
39
for
(
int
c
{};(not is.eof());
c
=is.peek()){
40
while
(std::isspace(is.peek())){is.ignore();}
41
if
(
isDigit
(
c
)){
42
if
(
c
==
'+'
) is.ignore();
43
int
v
=
parseStreamDigits
(is);
44
result
.push_back(
v
);
45
}
else
if
(
c
==
','
){
46
is.ignore();
47
}
else
if
(
c
==
'/'
){
48
break
;
49
}
50
}
51
return
result
;
52
}
53
}
54
get_generator_info.result
result
Definition:
get_generator_info.py:21
IdentifierField::element_type
ExpandedIdentifier::element_type element_type
Definition:
IdentifierField.h:23
Identifier::parseStreamDigits
IdentifierField::element_type parseStreamDigits(std::istream &is)
Definition:
IdentifierFieldParser.cxx:21
dbg::ptr
void * ptr(T *p)
Definition:
SGImplSvc.cxx:74
Identifier::parseStreamList
IdentifierField::element_vector parseStreamList(std::istream &is)
Definition:
IdentifierFieldParser.cxx:37
IdentifierFieldParser.h
createCoolChannelIdFile.buffer
buffer
Definition:
createCoolChannelIdFile.py:12
Identifier::isDigit
bool isDigit(const char c)
Definition:
IdentifierFieldParser.cxx:16
lumiFormat.i
int i
Definition:
lumiFormat.py:85
IdentifierField::element_vector
std::vector< element_type > element_vector
Definition:
IdentifierField.h:25
python.PyAthena.v
v
Definition:
PyAthena.py:154
python.compressB64.c
def c
Definition:
compressB64.py:93
Identifier
Definition:
IdentifierFieldParser.cxx:14
Generated on Sat Nov 9 2024 21:16:34 for ATLAS Offline Software by
1.8.18