The Gaudi Framework  v40r0 (475e45c1)
DirSearchPath.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 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 #pragma once
12 
16 #include <GaudiKernel/Kernel.h> /* GAUDI_API */
17 #include <boost/filesystem/exception.hpp> /*filesystem_error*/
18 #include <boost/filesystem/path.hpp>
19 #include <functional> /* binary_function */
20 #include <list>
21 #include <string>
22 #include <vector>
23 
29 public:
31 
33 
34  DirSearchPath() { addCWD(); }
36 #ifdef _WIN32
37  DirSearchPath( const std::string& stringifiedPath, const char* separator = ",;" );
38 #else
39  DirSearchPath( const std::string& stringifiedPath, const char* separator = ",:" );
40 #endif
41 
42 
44 
45  // bool add(const std::string& dirName); ///< \throws filesystem_error
46  bool add( const path& dir );
47  bool addCWD();
48 
49 
51 
52  bool find( const std::string& fileName, std::string& fullFileName ) const;
56  bool find( const path& file, path& fileFound ) const;
58  std::list<path> find_all( const path& file ) const;
60 
62 
63  static bool existsDir( const std::string& dirName );
64  static bool existsDir( const path& dir );
65 
66 
67 private:
68  //
70  struct eqPath {
71  eqPath( const path& ref ) : m_ref( ref ) {}
72  bool operator()( const path& p ) const { return p.string() == m_ref.string(); }
73 
74  private:
76  };
77  // @class lessPath order paths by (system-independent) name
78  // struct lessPath : public std::binary_function<const path&,const path&,bool> {
79  // bool operator() (const path& lhs, const path& rhs) const {
80  // return lhs.string() < rhs.string();
81  // }
82  //};
84 
85  // typedef std::set<path, lessPath> PathSet; ///<a set ordered by path name
86  // PathSet m_dirs; ///<the dir container
87  //
88  std::vector<path> m_dirs;
89 };
DirSearchPath::m_dirs
std::vector< path > m_dirs
the dir container
Definition: DirSearchPath.h:88
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
DirSearchPath::eqPath::eqPath
eqPath(const path &ref)
Definition: DirSearchPath.h:71
DirSearchPath::eqPath
Definition: DirSearchPath.h:70
DirSearchPath::path
boost::filesystem::path path
Definition: DirSearchPath.h:30
DirSearchPath
search for files in a list of directories
Definition: DirSearchPath.h:28
DirSearchPath::DirSearchPath
DirSearchPath()
Definition: DirSearchPath.h:34
DirSearchPath::eqPath::m_ref
path m_ref
Definition: DirSearchPath.h:75
Kernel.h
DirSearchPath::eqPath::operator()
bool operator()(const path &p) const
Definition: DirSearchPath.h:72
compareRootHistos.ref
ref
Definition: compareRootHistos.py:27
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:83
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:50