ATLAS Offline Software
PathResolver.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PATHRESOLVER_PATHRESOLVER_H
6 #define PATHRESOLVER_PATHRESOLVER_H
7 
9 
10 #include <filesystem>
11 #include <string>
12 #include <atomic>
13 
14 
15 class PathResolver {
16 public:
17 
18  PathResolver() = default; // need a constructor to link the dictionary library with the implementation library
19 
26  static std::string find_file (const std::string& logical_file_name,
27  const std::string& search_path);
28 
35  static std::string find_file_from_list (const std::string& logical_file_name,
36  const std::string& search_list);
37 
44  static std::string find_directory (const std::string& logical_file_name,
45  const std::string& search_path);
46 
53  static std::string find_directory_from_list (const std::string& logical_file_name,
54  const std::string& search_list);
55 
56 
57  static std::string find_calib_file(const std::string& logical_file_name);
58  static std::string find_calib_directory(const std::string& logical_file_name);
59 
60  static void setOutputLevel(MSG::Level level);
61  static void SetOutputLevel(int lvl) { setOutputLevel(MSG::Level(lvl)); }
62 
63  static std::string FindCalibFile(const std::string& logical_file_name) { return find_calib_file(logical_file_name); }
64  static std::string FindCalibDirectory(const std::string& logical_file_name) { return find_calib_directory(logical_file_name); }
65 
66 private:
67 
68  static bool PR_find( const std::string& logical_file_name, const std::string& search_list,
69  std::filesystem::file_type file_type, std::string& result );
70 
71  inline static std::atomic<MSG::Level> m_level{MSG::INFO};
72  static bool msgLvl( const MSG::Level lvl ) { return asgMsg().msgLvl(lvl); }
73  static MsgStream& msg() { return asgMsg().msg(); }
74  static MsgStream& msg( const MSG::Level lvl ) { return asgMsg().msg(lvl); }
75  static asg::AsgMessaging& asgMsg();
76 };
77 
78 
79 std::string PathResolverFindXMLFile (const std::string& logical_file_name);
80 std::string PathResolverFindDataFile (const std::string& logical_file_name);
81 std::string PathResolverFindCalibFile (const std::string& logical_file_name);
82 std::string PathResolverFindCalibDirectory (const std::string& logical_file_name);
83 void PathResolverSetOutputLevel(int lvl);
84 
85 #endif
PathResolver::find_calib_file
static std::string find_calib_file(const std::string &logical_file_name)
Definition: PathResolver.cxx:235
PathResolver::asgMsg
static asg::AsgMessaging & asgMsg()
Definition: PathResolver.cxx:79
PathResolver::FindCalibFile
static std::string FindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.h:63
get_generator_info.result
result
Definition: get_generator_info.py:21
asg::AsgMessaging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Test the output level of the object.
Definition: AsgMessaging.cxx:41
PathResolver::find_directory
static std::string find_directory(const std::string &logical_file_name, const std::string &search_path)
Definition: PathResolver.cxx:212
PathResolver::find_calib_directory
static std::string find_calib_directory(const std::string &logical_file_name)
Definition: PathResolver.cxx:257
PathResolver::find_file_from_list
static std::string find_file_from_list(const std::string &logical_file_name, const std::string &search_list)
Definition: PathResolver.cxx:202
PathResolver::msg
static MsgStream & msg(const MSG::Level lvl)
Definition: PathResolver.h:74
PathResolver::FindCalibDirectory
static std::string FindCalibDirectory(const std::string &logical_file_name)
Definition: PathResolver.h:64
PathResolver::PathResolver
PathResolver()=default
PathResolver::msgLvl
static bool msgLvl(const MSG::Level lvl)
Definition: PathResolver.h:72
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
PathResolverFindCalibDirectory
std::string PathResolverFindCalibDirectory(const std::string &logical_file_name)
Definition: PathResolver.cxx:288
AsgMessaging.h
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
PathResolver::msg
static MsgStream & msg()
Definition: PathResolver.h:73
PathResolver::PR_find
static bool PR_find(const std::string &logical_file_name, const std::string &search_list, std::filesystem::file_type file_type, std::string &result)
Main private search method used by all public methods.
Definition: PathResolver.cxx:98
PathResolver::SetOutputLevel
static void SetOutputLevel(int lvl)
Definition: PathResolver.h:61
PathResolverFindXMLFile
std::string PathResolverFindXMLFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:273
PathResolver::find_directory_from_list
static std::string find_directory_from_list(const std::string &logical_file_name, const std::string &search_list)
Definition: PathResolver.cxx:225
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
PathResolver::m_level
static std::atomic< MSG::Level > m_level
Definition: PathResolver.h:71
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:283
PathResolverFindDataFile
std::string PathResolverFindDataFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:278
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Definition: PathResolver.cxx:183
PathResolver::setOutputLevel
static void setOutputLevel(MSG::Level level)
Definition: PathResolver.cxx:269
PathResolver
Definition: PathResolver.h:15
PathResolverSetOutputLevel
void PathResolverSetOutputLevel(int lvl)
Definition: PathResolver.cxx:293