Producer.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_detail_Producer_h
2 #define art_Framework_Core_detail_Producer_h
3 // vim: set sw=2 expandtab :
4 
5 //=====================================================
6 // The base class of modules whose main purpose is to
7 // insert products into an Event.
8 //=====================================================
9 
16 
17 #include <cstddef>
18 
19 namespace art::detail {
20  class SharedResources;
21 
22  class Producer : public Modifier {
23  public:
24  template <typename UserConfig, typename KeysToIgnore = void>
26 
27  virtual ~Producer() noexcept;
28  explicit Producer(fhicl::ParameterSet const&);
29  Producer(Producer const&) = delete;
30  Producer(Producer&&) = delete;
31  Producer& operator=(Producer const&) = delete;
32  Producer& operator=(Producer&&) = delete;
33 
34  // Interface provided for the worker.
35  void doBeginJob(SharedResources const& resources);
36  void doEndJob();
37  void doRespondToOpenInputFile(FileBlock const& fb);
38  void doRespondToCloseInputFile(FileBlock const& fb);
39  void doRespondToOpenOutputFiles(FileBlock const& fb);
40  void doRespondToCloseOutputFiles(FileBlock const& fb);
41  bool doBeginRun(RunPrincipal& rp, ModuleContext const& mc);
42  bool doEndRun(RunPrincipal& rp, ModuleContext const& mc);
43  bool doBeginSubRun(SubRunPrincipal& srp, ModuleContext const& mc);
44  bool doEndSubRun(SubRunPrincipal& srp, ModuleContext const& mc);
45  bool doEvent(EventPrincipal& ep,
46  ModuleContext const& mc,
47  std::atomic<std::size_t>& counts_run,
48  std::atomic<std::size_t>& counts_passed,
49  std::atomic<std::size_t>& counts_failed);
50 
51  private:
52  virtual void setupQueues(SharedResources const&) = 0;
53  virtual void beginJobWithFrame(ProcessingFrame const&) = 0;
54  virtual void endJobWithFrame(ProcessingFrame const&) = 0;
55  virtual void respondToOpenInputFileWithFrame(FileBlock const&,
56  ProcessingFrame const&) = 0;
57  virtual void respondToCloseInputFileWithFrame(FileBlock const&,
58  ProcessingFrame const&) = 0;
59  virtual void respondToOpenOutputFilesWithFrame(FileBlock const&,
60  ProcessingFrame const&) = 0;
62  ProcessingFrame const&) = 0;
63  virtual void beginRunWithFrame(Run&, ProcessingFrame const&) = 0;
64  virtual void endRunWithFrame(Run&, ProcessingFrame const&) = 0;
65  virtual void beginSubRunWithFrame(SubRun&, ProcessingFrame const&) = 0;
66  virtual void endSubRunWithFrame(SubRun&, ProcessingFrame const&) = 0;
67  virtual void produceWithFrame(Event&, ProcessingFrame const&) = 0;
68 
69  bool const checkPutProducts_;
70  };
71 
72 } // namespace art::detail
73 
74 #endif /* art_Framework_Core_detail_Producer_h */
75 
76 // Local Variables:
77 // mode: c++
78 // End:
void doBeginJob(SharedResources const &resources)
Definition: Producer.cc:22
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
void doRespondToOpenInputFile(FileBlock const &fb)
Definition: Producer.cc:37
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void doRespondToOpenOutputFiles(FileBlock const &fb)
Definition: Producer.cc:51
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
STL namespace.
bool doBeginRun(RunPrincipal &rp, ModuleContext const &mc)
Definition: Producer.cc:65
Definition: Run.h:17
virtual void endJobWithFrame(ProcessingFrame const &)=0
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
void doRespondToCloseOutputFiles(FileBlock const &fb)
Definition: Producer.cc:58
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
bool const checkPutProducts_
Definition: Producer.h:69
bool doEndSubRun(SubRunPrincipal &srp, ModuleContext const &mc)
Definition: Producer.cc:95
void doRespondToCloseInputFile(FileBlock const &fb)
Definition: Producer.cc:44
bool doEndRun(RunPrincipal &rp, ModuleContext const &mc)
Definition: Producer.cc:75
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
bool doBeginSubRun(SubRunPrincipal &srp, ModuleContext const &mc)
Definition: Producer.cc:85
bool doEvent(EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
Definition: Producer.cc:105
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
virtual ~Producer() noexcept
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0