LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
FileNamesHandler.h
Go to the documentation of this file.
1 #ifndef art_Framework_IO_Sources_detail_FileNamesHandler_h
2 #define art_Framework_IO_Sources_detail_FileNamesHandler_h
3 
5 
6 #include <string>
7 #include <vector>
8 
9 namespace art {
10  namespace detail {
11 
12  template <bool wantFileServices>
14 
15  // Handle files when we want to use the official services.
16  template <>
17  class FileNamesHandler<true> {
18  public:
19  explicit FileNamesHandler(std::vector<std::string>&& fileNames,
20  size_t attempts = 5,
21  double waitBetweenAttempts = 5.0);
22 
23  std::string next();
24  void finish();
25 
26  private:
28  };
29 
30  // Handle files when we don't.
31  template <>
32  class FileNamesHandler<false> {
33  public:
34  explicit FileNamesHandler(std::vector<std::string>&& fileNames,
35  size_t = 0);
36 
37  std::string next();
38  void finish();
39 
40  private:
41  std::vector<std::string> fileNames_;
44  };
45  } // detail
46 } // art
47 
49  std::vector<std::string>&& fileNames,
50  size_t attempts,
51  double waitBetweenAttempts)
52  : fp_(std::move(fileNames), attempts, waitBetweenAttempts)
53 {}
54 
55 inline std::string
57 {
58  return fp_.next();
59 }
60 
61 inline void
63 {
64  fp_.finish();
65 }
66 
68  std::vector<std::string>&& fileNames,
69  size_t)
70  : fileNames_(std::move(fileNames))
71  , currentFile_(fileNames_.begin())
72  , end_(fileNames_.end())
73 {}
74 
75 inline std::string
77 {
78  return (currentFile_ == end_) ? std::string() : *(currentFile_++);
79 }
80 
81 inline void
83 {
84  currentFile_ = end_;
85 }
86 #endif /* art_Framework_IO_Sources_detail_FileNamesHandler_h */
87 
88 // Local Variables:
89 // mode: c++
90 // End:
std::vector< std::string > fileNames_
STL namespace.
intermediate_table::const_iterator const_iterator
std::vector< std::string >::const_iterator end_
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
HLT enums.
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
std::vector< std::string >::const_iterator currentFile_