LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
FileNameComponents.h
Go to the documentation of this file.
1 #ifndef art_Framework_IO_detail_FileNameComponents_h
2 #define art_Framework_IO_detail_FileNameComponents_h
3 
4 //=====================================================================
5 // The FileNameComponents class breaks the following type of pattern:
6 //
7 // "run1_aladdin_%#_and_jasmine_%03#.root"
8 //
9 // into the components:
10 //
11 // ("run1_aladdin_", "")
12 // ("_and_jasmine_", "03")
13 //
14 // with the suffix ".root". With these components and suffix, the
15 // following filename is assembled whenever a call of (e.g.)
16 // fileNameWithIndex(4) is made:
17 //
18 // "run1_aladdin_4_and_jasmine_004.root"
19 //
20 //=====================================================================
21 
22 #include <string>
23 #include <utility>
24 #include <vector>
25 
26 namespace art {
27  namespace detail {
28 
30  public:
31  void add(std::string const& prefix, std::string const& digitFormat);
32 
33  void setSuffix(std::string suffix);
34 
35  std::string fileNameWithIndex(std::size_t index) const;
36 
37  bool operator<(FileNameComponents const& fnc) const;
38 
39  private:
40  std::vector<std::pair<std::string, std::string>> components_;
41  std::string suffix_{};
42  };
43 
44  FileNameComponents componentsFromPattern(std::string const& pattern);
45  }
46 }
47 
48 #endif /* art_Framework_IO_detail_FileNameComponents_h */
49 
50 // Local Variables:
51 // mode: c++
52 // End:
bool operator<(FileNameComponents const &fnc) const
void setSuffix(std::string suffix)
FileNameComponents componentsFromPattern(std::string const &pattern)
std::string fileNameWithIndex(std::size_t index) const
void add(std::string const &prefix, std::string const &digitFormat)
HLT enums.
std::vector< std::pair< std::string, std::string > > components_