| The Gaudi Framework v32r1 (f65d50dc)

DirSearchPath.h
Go to the documentation of this file.
1 #ifndef JOBOPTIONS_DIRSEARCHPATH_H
2 #define JOBOPTIONS_DIRSEARCHPATH_H
3
7 #include "GaudiKernel/Kernel.h" /* GAUDI_API */
8 #include "boost/filesystem/exception.hpp" /*filesystem_error*/
9 #include "boost/filesystem/path.hpp"
10 #include <functional> /* binary_function */
11 #include <string>
12 #include <vector>
17 class GAUDI_API DirSearchPath {
18 public:
19 typedef boost::filesystem::path path;
20
22
23 DirSearchPath() { addCWD(); }
25 #ifdef _WIN32
26 DirSearchPath( const std::string& stringifiedPath, const char* separator = ",;" );
27 #else
28 DirSearchPath( const std::string& stringifiedPath, const char* separator = ",:" );
29 #endif
30
31
33
34 // bool add(const std::string& dirName); ///< \throws filesystem_error
35 bool add( const path& dir );
36 bool addCWD();
37
38
40
41 bool find( const std::string& fileName, std::string& fullFileName ) const;
45 bool find( const path& file, path& fileFound ) const;
47 std::list<path> find_all( const path& file ) const;
49
51
52 static bool existsDir( const std::string& dirName );
53 static bool existsDir( const path& dir );
54
55
56 private:
57 //
59 struct eqPath {
60 eqPath( const path& ref ) : m_ref( ref ) {}
61 bool operator()( const path& p ) const { return p.string() == m_ref.string(); }
62
63 private:
64 path m_ref;
65 };
66 // @class lessPath order paths by (system-independent) name
67 // struct lessPath : public std::binary_function<const path&,const path&,bool> {
68 // bool operator() (const path& lhs, const path& rhs) const {
69 // return lhs.string() < rhs.string();
70 // }
71 //};
73
74 // typedef std::set<path, lessPath> PathSet; ///<a set ordered by path name
75 // PathSet m_dirs; ///<the dir container
76 //
77 std::vector<path> m_dirs;
78 };
79 #endif // JOBOPTIONS_DIRSEARCHPATH_H
Kernel.h
DirSearchPath::eqPath::operator()
bool operator()(const path &p) const
Definition: DirSearchPath.h:61
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
DirSearchPath
search for files in a list of directories
Definition: DirSearchPath.h:17
DirSearchPath::path
boost::filesystem::path path
Definition: DirSearchPath.h:19
DirSearchPath::eqPath
name
Definition: DirSearchPath.h:59
DirSearchPath::eqPath::eqPath
eqPath(const path &ref)
Definition: DirSearchPath.h:60
std::string
STL class.
compareRootHistos.ref
string ref
Definition: compareRootHistos.py:14
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:39
DirSearchPath::m_dirs
std::vector< path > m_dirs
the dir container
Definition: DirSearchPath.h:77
std::list
STL class.
std::vector< path >
DirSearchPath::eqPath::m_ref
path m_ref
Definition: DirSearchPath.h:64
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:71
DirSearchPath::DirSearchPath
DirSearchPath()
Definition: DirSearchPath.h:23