filepath_maker.h
Go to the documentation of this file.
1 #ifndef cetlib_filepath_maker_h
2 #define cetlib_filepath_maker_h
3 
4 // ======================================================================
5 //
6 // filepath_maker: A family of related policies governing the translation
7 // of a filename into a fully-qualified filepath
8 //
9 // The semantics of each of the policies are as follows:
10 //
11 // filepath_maker: No lookup at all.
12 //
13 // filepath_lookup: Only lookup permitted.
14 
15 // filepath_lookup_nonabsolute: Absolute paths are allowed, but lookup
16 // occurs for non-absolute paths.
17 //
18 // filepath_lookup_after1: No lookup for the first file, and only
19 // lookup for all subsequent files.
20 //
21 // filepath_first_absolute_or_lookup_with_dot: The first file can be
22 // an absolute path, a path relative to '.', or a path that can be
23 // looked up; all subsequent files must be looked up.
24 //
25 // ======================================================================
26 
27 #include "cetlib/search_path.h"
28 #include <string>
29 
30 namespace cet {
31  class filepath_maker;
32  class filepath_lookup;
33  class filepath_lookup_nonabsolute;
34  class filepath_lookup_after1;
35  class filepath_first_absolute_or_lookup_with_dot;
36 }
37 
38 // ----------------------------------------------------------------------
39 
41 public:
43 
44  virtual ~filepath_maker() noexcept = default;
45 
46 }; // filepath_maker
47 
48 // ----------------------------------------------------------------------
49 
51 public:
53 
54  std::string operator()(std::string const& filename) override;
55 
56 private:
58 
59 }; // filepath_lookup
60 
61 // ----------------------------------------------------------------------
62 
64 public:
66 
67  std::string operator()(std::string const& filename) override;
68 
69 private:
71 
72 }; // filepath_lookup_nonabsolute
73 
74 // ----------------------------------------------------------------------
75 
77 public:
79 
80  std::string operator()(std::string const& filename) override;
81 
82  void reset();
83 
84 private:
85  bool after1{false};
87 
88 }; // filepath_lookup_after1
89 
90 // ----------------------------------------------------------------------
91 
93  : public cet::filepath_maker {
94 public:
95  // The provided string must be the *value* of the environment
96  // variable, *not* its name.
98  std::string operator()(std::string const& filename) override;
99  void reset();
100 
101 private:
102  bool first{true};
105 }; // filepath_first_absolute_or_lookup_with_dot
106 
107 // ======================================================================
108 
109 #endif /* cetlib_filepath_maker_h */
110 
111 // Local Variables:
112 // mode: c++
113 // End:
string filename
Definition: shutoffs.py:106
cet::search_path paths
virtual ~filepath_maker() noexcept=default
virtual std::string operator()(std::string const &filename)
enum BeamMode string