ATLAS Offline Software
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 
11 namespace dqi {
12 
13  HanRuntimeConfigSingleton&
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 }
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:126
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
HanRuntimeConfigSingleton.h
dqi::HanRuntimeConfigSingleton
Definition: HanRuntimeConfigSingleton.h:15
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
dqi::HanRuntimeConfigSingleton::m_runNumber
uint32_t m_runNumber
Definition: HanRuntimeConfigSingleton.h:37
dqi::HanRuntimeConfigSingleton::getInstance
static HanRuntimeConfigSingleton & getInstance()
Definition: HanRuntimeConfigSingleton.cxx:15
LArCellConditions.sv
bool sv
Definition: LArCellConditions.py:45
dqi::HanRuntimeConfigSingleton::m_path
std::string m_path
Definition: HanRuntimeConfigSingleton.h:36
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
dqi::HanRuntimeConfigSingleton::parsePathRunNumber
ATLAS_NOT_THREAD_SAFE void parsePathRunNumber()
Definition: HanRuntimeConfigSingleton.cxx:27
dqi
Definition: CompositeAlgorithm.h:16