LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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 
4 // ======================================================================
5 // CatalogInterface
6 //
7 // Abstract base class for services that return URI's when asked to
8 // get next file in a series, and deal with declarations that output
9 // files have been written. We have in mind that SAMProtocol will
10 // inherit from this interface class.
11 // ======================================================================
12 
16 #include "cetlib/assert_only_one_thread.h"
17 #include "fhiclcpp/fwd.h"
18 
19 #include <string>
20 #include <vector>
21 
22 namespace art {
23  class CatalogInterface;
24  class EventID;
25  class HLTGlobalStatus;
26 }
27 
29 public:
30  virtual ~CatalogInterface() noexcept = default;
31 
32  void configure(std::vector<std::string> const& items);
33  int getNextFileURI(std::string& uri, double& waitTime);
34  void updateStatus(std::string const& uri, FileDisposition status);
35  void outputFileClosed(std::string const& module_label,
36  std::string const& fileFQname);
37  void outputFileOpened(std::string const& module_label);
38  void outputModuleInitiated(std::string const& module_label,
39  fhicl::ParameterSet const& pset);
40  void eventSelected(std::string const& module_label,
41  EventID const& event_id,
42  HLTGlobalStatus const& acceptance_info);
43  bool isSearchable();
44  void rewind();
45 
46 private:
47  // Classes inheriting this interface must provide the following methods:
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 art::CatalogInterface::configure(std::vector<std::string> const& items)
66 {
67  CET_ASSERT_ONLY_ONE_THREAD();
68  doConfigure(items);
69 }
70 
71 inline int
72 art::CatalogInterface::getNextFileURI(std::string& uri, double& waitTime)
73 {
74  CET_ASSERT_ONLY_ONE_THREAD();
75  return doGetNextFileURI(uri, waitTime);
76 }
77 
78 inline void
79 art::CatalogInterface::updateStatus(std::string const& uri,
80  FileDisposition status)
81 {
82  CET_ASSERT_ONLY_ONE_THREAD();
83  doUpdateStatus(uri, status);
84 }
85 
86 inline void
87 art::CatalogInterface::outputFileClosed(std::string const& module_label,
88  std::string const& fileFQname)
89 {
90  CET_ASSERT_ONLY_ONE_THREAD();
91  doOutputFileClosed(module_label, fileFQname);
92 }
93 
94 inline void
95 art::CatalogInterface::outputFileOpened(std::string const& module_label)
96 {
97  CET_ASSERT_ONLY_ONE_THREAD();
98  doOutputFileOpened(module_label);
99 }
100 
101 inline void
102 art::CatalogInterface::outputModuleInitiated(std::string const& module_label,
103  fhicl::ParameterSet const& pset)
104 {
105  CET_ASSERT_ONLY_ONE_THREAD();
106  doOutputModuleInitiated(module_label, pset);
107 }
108 
109 inline void
110 art::CatalogInterface::eventSelected(std::string const& module_label,
111  EventID const& event_id,
112  HLTGlobalStatus const& acceptance_info)
113 {
114  CET_ASSERT_ONLY_ONE_THREAD();
115  doEventSelected(module_label, event_id, acceptance_info);
116 }
117 
118 inline bool
120 {
121  CET_ASSERT_ONLY_ONE_THREAD();
122  return doIsSearchable();
123 }
124 
125 inline void
127 {
128  CET_ASSERT_ONLY_ONE_THREAD();
129  doRewind();
130 }
131 
133 #endif /* art_Framework_Services_FileServiceInterfaces_CatalogInterface_h */
134 
135 // Local Variables:
136 // mode: c++
137 // 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
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
#define DECLARE_ART_SERVICE_INTERFACE(svc, scope)
Definition: ServiceMacros.h:99
void eventSelected(std::string const &module_label, EventID const &event_id, HLTGlobalStatus const &acceptance_info)
HLT enums.
void outputFileOpened(std::string const &module_label)