The Gaudi Framework  master (37c0b60a)
DirSearchPath.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef JOBOPTIONS_DIRSEARCHPATH_H
12 #define JOBOPTIONS_DIRSEARCHPATH_H
13 
17 #include <GaudiKernel/Kernel.h> /* GAUDI_API */
18 #include <boost/filesystem/exception.hpp> /*filesystem_error*/
19 #include <boost/filesystem/path.hpp>
20 #include <functional> /* binary_function */
21 #include <list>
22 #include <string>
23 #include <vector>
24 
30 public:
32 
34 
35  DirSearchPath() { addCWD(); }
37 #ifdef _WIN32
38  DirSearchPath( const std::string& stringifiedPath, const char* separator = ",;" );
39 #else
40  DirSearchPath( const std::string& stringifiedPath, const char* separator = ",:" );
41 #endif
42 
43 
45 
46  // bool add(const std::string& dirName); ///< \throws filesystem_error
47  bool add( const path& dir );
48  bool addCWD();
49 
50 
52 
53  bool find( const std::string& fileName, std::string& fullFileName ) const;
57  bool find( const path& file, path& fileFound ) const;
59  std::list<path> find_all( const path& file ) const;
61 
63 
64  static bool existsDir( const std::string& dirName );
65  static bool existsDir( const path& dir );
66 
67 
68 private:
69  //
71  struct eqPath {
72  eqPath( const path& ref ) : m_ref( ref ) {}
73  bool operator()( const path& p ) const { return p.string() == m_ref.string(); }
74 
75  private:
77  };
78  // @class lessPath order paths by (system-independent) name
79  // struct lessPath : public std::binary_function<const path&,const path&,bool> {
80  // bool operator() (const path& lhs, const path& rhs) const {
81  // return lhs.string() < rhs.string();
82  // }
83  //};
85 
86  // typedef std::set<path, lessPath> PathSet; ///<a set ordered by path name
87  // PathSet m_dirs; ///<the dir container
88  //
90 };
91 #endif // JOBOPTIONS_DIRSEARCHPATH_H
std::string
STL class.
DirSearchPath::m_dirs
std::vector< path > m_dirs
the dir container
Definition: DirSearchPath.h:89
std::list
STL class.
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
std::vector< path >
DirSearchPath::eqPath::eqPath
eqPath(const path &ref)
Definition: DirSearchPath.h:72
DirSearchPath::eqPath
Definition: DirSearchPath.h:71
DirSearchPath::path
boost::filesystem::path path
Definition: DirSearchPath.h:31
DirSearchPath
search for files in a list of directories
Definition: DirSearchPath.h:29
DirSearchPath::DirSearchPath
DirSearchPath()
Definition: DirSearchPath.h:35
DirSearchPath::eqPath::m_ref
path m_ref
Definition: DirSearchPath.h:76
Kernel.h
DirSearchPath::eqPath::operator()
bool operator()(const path &p) const
Definition: DirSearchPath.h:73
compareRootHistos.ref
ref
Definition: compareRootHistos.py:27
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:50