FileCatalog.h
Go to the documentation of this file.
1 #ifndef art_Framework_IO_Catalog_FileCatalog_h
2 #define art_Framework_IO_Catalog_FileCatalog_h
3 
4 // ======================================================================
5 //
6 // Class FileCatalog. Common services to manage File catalog
7 //
8 // ======================================================================
9 
10 #include <string>
11 
12 namespace art {
13 
15  public:
16  FileCatalogItem() = default;
17 
19  std::string const& lfn,
20  std::string const& uri)
21  : pfn_{pfn}, lfn_{lfn}, uri_{uri}
22  {}
23 
24  std::string const&
25  fileName() const
26  {
27  return pfn_;
28  }
29  std::string const&
31  {
32  return lfn_;
33  }
34  std::string const&
35  uri() const
36  {
37  return uri_;
38  }
39  bool
40  skipped() const
41  {
42  return skipped_;
43  }
44  bool
45  consumed() const
46  {
47  return consumed_;
48  }
49 
50  void
51  fileName(std::string const& pfn)
52  {
53  pfn_ = pfn;
54  }
55  void
57  {
58  lfn_ = lfn;
59  }
60  void
62  {
63  uri_ = uri;
64  }
65  void
66  skip()
67  {
68  skipped_ = true;
69  }
70  void
72  {
73  consumed_ = true;
74  }
75 
76  private:
80  bool skipped_{false};
81  bool consumed_{false};
82  }; // FileCatalogItem
83 
84  // ----------------------------------------------------------------------
85 
86  class FileCatalog {
87  public:
88  virtual ~FileCatalog() = default;
89  void
91  {}
92  static bool
94  {
95  return (name.empty() || name.find(':') != std::string::npos);
96  }
98  url()
99  {
100  return url_;
101  }
102  std::string const&
103  url() const
104  {
105  return url_;
106  }
107  void
109  {
110  active_ = true;
111  }
112  bool
113  active() const
114  {
115  return active_;
116  }
117 
118  private:
119  std::string url_{};
120  bool active_{false};
121  }; // FileCatalog
122 
123 } // namespace art
124 
125 // ======================================================================
126 
127 #endif /* art_Framework_IO_Catalog_FileCatalog_h */
128 
129 // Local Variables:
130 // mode: c++
131 // End:
static QCString name
Definition: declinfo.cpp:673
void logicalFileName(std::string const &lfn)
Definition: FileCatalog.h:56
FileCatalogItem()=default
bool active() const
Definition: FileCatalog.h:113
void commitCatalog()
Definition: FileCatalog.h:90
std::string string
Definition: nybbler.cc:12
void fileName(std::string const &pfn)
Definition: FileCatalog.h:51
std::string & url()
Definition: FileCatalog.h:98
std::string const & logicalFileName() const
Definition: FileCatalog.h:30
bool skipped() const
Definition: FileCatalog.h:40
static bool isPhysical(std::string const &name)
Definition: FileCatalog.h:93
bool consumed() const
Definition: FileCatalog.h:45
std::string uri_
Definition: FileCatalog.h:79
FileCatalogItem(std::string const &pfn, std::string const &lfn, std::string const &uri)
Definition: FileCatalog.h:18
std::string const & url() const
Definition: FileCatalog.h:103
std::string const & fileName() const
Definition: FileCatalog.h:25
std::string lfn_
Definition: FileCatalog.h:78
std::string pfn_
Definition: FileCatalog.h:77
std::string const & uri() const
Definition: FileCatalog.h:35
void uri(std::string const &uri)
Definition: FileCatalog.h:61