CatalogInterface.h
Go to the documentation of this file.
1 #ifndef art_Framework_Services_FileServiceInterfaces_CatalogInterface_h
2 #define art_Framework_Services_FileServiceInterfaces_CatalogInterface_h
3 // vim: set sw=2 expandtab :
4 
5 // ======================================================================
6 // CatalogInterface
7 //
8 // Abstract base class for services that return URI's when asked to
9 // get next file in a series, and deal with declarations that output
10 // files have been written. We have in mind that SAMProtocol will
11 // inherit from this interface class.
12 // ======================================================================
13 
17 #include "fhiclcpp/fwd.h"
18 #include "hep_concurrency/assert_only_one_thread.h"
19 
20 #include <string>
21 #include <vector>
22 
23 namespace art {
24  class CatalogInterface;
25  class EventID;
26  class HLTGlobalStatus;
27 
29  public:
30  virtual ~CatalogInterface() noexcept = default;
31 
32  public:
33  void configure(std::vector<std::string> const& items);
34  int getNextFileURI(std::string& uri, double& waitTime);
36  void outputFileClosed(std::string const& module_label,
37  std::string const& fileFQname);
38  void outputFileOpened(std::string const& module_label);
39  void outputModuleInitiated(std::string const& module_label,
40  fhicl::ParameterSet const& pset);
41  void eventSelected(std::string const& module_label,
42  EventID const& event_id,
43  HLTGlobalStatus const& acceptance_info);
44  bool isSearchable();
45  void rewind();
46 
47  private:
48  virtual void doConfigure(std::vector<std::string> const& item) = 0;
49  virtual int doGetNextFileURI(std::string& uri, double& waitTime) = 0;
50  virtual void doUpdateStatus(std::string const& uri,
51  FileDisposition status) = 0;
52  virtual void doOutputFileOpened(std::string const& module_label) = 0;
53  virtual void doOutputModuleInitiated(std::string const& module_label,
54  fhicl::ParameterSet const& pset) = 0;
55  virtual void doOutputFileClosed(std::string const& module_label,
56  std::string const& fileFQname) = 0;
57  virtual void doEventSelected(std::string const& module_label,
58  EventID const& event_id,
59  HLTGlobalStatus const& acceptance_info) = 0;
60  virtual bool doIsSearchable() = 0;
61  virtual void doRewind() = 0;
62  };
63 
64  inline void
65  CatalogInterface::configure(std::vector<std::string> const& items)
66  {
67  HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
68  doConfigure(items);
69  }
70 
71  inline int
73  {
74  HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
75  return doGetNextFileURI(uri, waitTime);
76  }
77 
78  inline void
80  {
81  HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
82  doUpdateStatus(uri, status);
83  }
84 
85  inline void
87  std::string const& fileFQname)
88  {
89  HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
90  doOutputFileClosed(module_label, fileFQname);
91  }
92 
93  inline void
95  {
96  HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
97  doOutputFileOpened(module_label);
98  }
99 
100  inline void
102  fhicl::ParameterSet const& pset)
103  {
104  HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
105  doOutputModuleInitiated(module_label, pset);
106  }
107 
108  inline void
110  EventID const& event_id,
111  HLTGlobalStatus const& acceptance_info)
112  {
113  HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
114  doEventSelected(module_label, event_id, acceptance_info);
115  }
116 
117  inline bool
119  {
120  HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
121  return doIsSearchable();
122  }
123 
124  inline void
126  {
127  HEP_CONCURRENCY_ASSERT_ONLY_ONE_THREAD();
128  doRewind();
129  }
130 
131 } // namespace art
132 
134 
135 #endif /* art_Framework_Services_FileServiceInterfaces_CatalogInterface_h */
136 
137 // Local Variables:
138 // mode: c++
139 // End:
virtual void doEventSelected(std::string const &module_label, EventID const &event_id, HLTGlobalStatus const &acceptance_info)=0
void updateStatus(std::string const &uri, FileDisposition status)
void outputModuleInitiated(std::string const &module_label, fhicl::ParameterSet const &pset)
FileDisposition
std::string string
Definition: nybbler.cc:12
void configure(std::vector< std::string > const &items)
virtual void doOutputFileClosed(std::string const &module_label, std::string const &fileFQname)=0
virtual int doGetNextFileURI(std::string &uri, double &waitTime)=0
virtual void doOutputModuleInitiated(std::string const &module_label, fhicl::ParameterSet const &pset)=0
virtual void doConfigure(std::vector< std::string > const &item)=0
virtual void doUpdateStatus(std::string const &uri, FileDisposition status)=0
virtual bool doIsSearchable()=0
virtual void doRewind()=0
void outputFileClosed(std::string const &module_label, std::string const &fileFQname)
int getNextFileURI(std::string &uri, double &waitTime)
virtual ~CatalogInterface() noexcept=default
virtual void doOutputFileOpened(std::string const &module_label)=0
void eventSelected(std::string const &module_label, EventID const &event_id, HLTGlobalStatus const &acceptance_info)
#define DECLARE_ART_SERVICE_INTERFACE(svc, scope)
void outputFileOpened(std::string const &module_label)