ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7#include <charconv>
8#include <string_view>
9#include <system_error>
10
11namespace dqi {
12
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
22 return instance;
23 }
24
25 void
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}
std::map< std::string, double > instance
#define ATLAS_THREAD_SAFE
static HanRuntimeConfigSingleton & getInstance()
ATLAS_NOT_THREAD_SAFE void parsePathRunNumber()