ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
DataQualityInterfaces
src
HanRuntimeConfigSingleton.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
DataQualityInterfaces/HanRuntimeConfigSingleton.h
"
6
7
#include <charconv>
8
#include <string_view>
9
#include <system_error>
10
11
namespace
dqi
{
12
13
HanRuntimeConfigSingleton
&
14
HanRuntimeConfigSingleton::
15
getInstance
()
16
{
17
//Thread safe according to:
18
// - paragraph 6.7.4 of C++11 and C++14 standards
19
// - paragraph 9.7.4 of C++17 standard
20
// - paragraph 8.8.4 of C++20 standard
21
static
HanRuntimeConfigSingleton
instance
ATLAS_THREAD_SAFE
;
22
return
instance
;
23
}
24
25
void
26
HanRuntimeConfigSingleton::
27
parsePathRunNumber
()
28
{
29
std::string_view path =
m_path
;
30
while
( !path.empty() && path.front() ==
'/'
) path.remove_prefix( 1 );
31
while
( !path.empty() && path.back() ==
'/'
) path.remove_suffix( 1 );
32
if
( path.empty() )
return
;
33
34
using
std::operator
""
sv;
35
// Replace by starts_with in C++20
36
if
( path.substr( 0, 4 ) !=
"run_"
sv )
return
;
37
path.remove_prefix( 4 );
38
auto
begin = path.data();
39
auto
end = begin + path.size();
40
auto
[ptr, err] = std::from_chars( begin, end,
m_runNumber
);
41
if
( err != std::errc() && ptr != end )
m_runNumber
= 0;
42
}
43
}
HanRuntimeConfigSingleton.h
instance
std::map< std::string, double > instance
Definition
Run_To_Get_Tags.h:8
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition
checker_macros.h:211
dqi::HanRuntimeConfigSingleton
Definition
HanRuntimeConfigSingleton.h:15
dqi::HanRuntimeConfigSingleton::m_runNumber
uint32_t m_runNumber
Definition
HanRuntimeConfigSingleton.h:37
dqi::HanRuntimeConfigSingleton::m_path
std::string m_path
Definition
HanRuntimeConfigSingleton.h:36
dqi::HanRuntimeConfigSingleton::getInstance
static HanRuntimeConfigSingleton & getInstance()
Definition
HanRuntimeConfigSingleton.cxx:15
dqi::HanRuntimeConfigSingleton::HanRuntimeConfigSingleton
HanRuntimeConfigSingleton()=default
dqi::HanRuntimeConfigSingleton::parsePathRunNumber
ATLAS_NOT_THREAD_SAFE void parsePathRunNumber()
Definition
HanRuntimeConfigSingleton.cxx:27
dqi
Definition
CompositeAlgorithm.h:16
Generated on
for ATLAS Offline Software by
1.17.0