artdaq_core  v3_04_02
SimpleLookupPolicy.hh
1 #ifndef artdaq_core_Utilities_SimpleLookupPolicy_h
2 #define artdaq_core_Utilities_SimpleLookupPolicy_h
3 
4 #include "cetlib/filepath_maker.h"
5 #include "cetlib/search_path.h"
6 #include <memory>
7 
8 namespace artdaq
9 {
10  class SimpleLookupPolicy;
11 }
12 
21 class artdaq::SimpleLookupPolicy : public cet::filepath_maker
22 {
23 public:
24 
28  enum class ArgType : int
29  {
30  ENV_VAR = 0,
31  PATH_STRING = 1
32  };
33 
41  SimpleLookupPolicy(std::string const& paths, ArgType argType = ArgType::ENV_VAR);
42 
53  std::string operator()(std::string const& filename) override;
54 
58  virtual ~SimpleLookupPolicy() noexcept;
59 
60 private:
64  std::unique_ptr<cet::search_path> cwdPath_;
68  std::unique_ptr<cet::search_path> fallbackPaths_;
69 };
70 
71 #endif /* artdaq_core_Utilities_SimpleLookupPolicy_h */
72 
73 // Local Variables:
74 // mode: c++
75 // End:
SimpleLookupPolicy(std::string const &paths, ArgType argType=ArgType::ENV_VAR)
Constructor.
Constructor argument is a list of directories.
virtual ~SimpleLookupPolicy() noexcept
Default destructor.
ArgType
Flag if the constructor argument is a list of paths or the name of an environment variable...
This class is intended to find files using a set lookup order.
std::string operator()(std::string const &filename) override
Perform the file lookup.
Constructor argument is environment variable name.