CMS 3D CMS Logo

outputmoduleAbilityToImplementor.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_one_outputmoduleAbilityToImplementor_h
2 #define FWCore_Framework_one_outputmoduleAbilityToImplementor_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : outputmodule::AbilityToImplementor
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Thu, 09 May 2013 19:39:58 GMT
19 //
20 
21 // system include files
22 
23 // user include files
30 
31 // forward declarations
32 
33 namespace edm {
34  class FileBlock;
35  class ModuleCallingContext;
36 
37  namespace one {
38  namespace outputmodule {
39  class RunWatcher : public virtual OutputModuleBase {
40  public:
41  RunWatcher(edm::ParameterSet const& iPSet) : OutputModuleBase(iPSet) {}
42  RunWatcher(RunWatcher const&) = delete;
43  RunWatcher& operator=(RunWatcher const&) = delete;
44  ~RunWatcher() noexcept(false) override{};
45 
46  private:
47  void doBeginRun_(RunForOutput const& r) final;
48  void doEndRun_(RunForOutput const& r) final;
49 
50  virtual void beginRun(edm::RunForOutput const&) = 0;
51  virtual void endRun(edm::RunForOutput const&) = 0;
52  };
53 
54  class LuminosityBlockWatcher : public virtual OutputModuleBase {
55  public:
60 
61  private:
63  void doEndLuminosityBlock_(LuminosityBlockForOutput const& lb) final;
64 
65  virtual void beginLuminosityBlock(edm::LuminosityBlockForOutput const&) = 0;
66  virtual void endLuminosityBlock(edm::LuminosityBlockForOutput const&) = 0;
67  };
68 
69  class InputFileWatcher : public virtual OutputModuleBase {
70  public:
72  InputFileWatcher(InputFileWatcher const&) = delete;
75 
76  private:
77  void doRespondToOpenInputFile_(FileBlock const&) final;
78  void doRespondToCloseInputFile_(FileBlock const&) final;
79 
80  virtual void respondToOpenInputFile(FileBlock const&) = 0;
81  virtual void respondToCloseInputFile(FileBlock const&) = 0;
82  };
83 
84  template <typename C>
85  class RunCacheHolder : public virtual OutputModuleBase {
86  public:
88  RunCacheHolder(RunCacheHolder<C> const&) = delete;
91 
92  protected:
93  C* runCache(edm::RunIndex iID) { return cache_.get(); }
94  C const* runCache(edm::RunIndex iID) const { return cache_.get(); }
95 
96  private:
97  void doBeginRun_(edm::RunForOutput const& rp) final { cache_ = globalBeginRun(rp); }
98  void doEndRun_(edm::RunForOutput const& rp) final {
99  globalEndRun(rp);
100  cache_ = nullptr; // propagate_const<T> has no reset() function
101  }
102 
103  virtual std::shared_ptr<C> globalBeginRun(edm::RunForOutput const&) const = 0;
104  virtual void globalEndRun(edm::RunForOutput const&) = 0;
105  //When threaded we will have a container for N items whre N is # of simultaneous runs
107  };
108 
109  template <typename C>
111  public:
112  template <typename... A>
117 
118  protected:
119  void preallocLumis(unsigned int iNLumis) final { caches_.reset(new std::shared_ptr<C>[iNLumis]); }
120 
121  C const* luminosityBlockCache(edm::LuminosityBlockIndex iID) const { return caches_[iID].get(); }
122  C* luminosityBlockCache(edm::LuminosityBlockIndex iID) { return caches_[iID].get(); }
123 
124  private:
126  caches_[lp.index()] = globalBeginLuminosityBlock(lp);
127  }
129  globalEndLuminosityBlock(lp);
130  caches_[lp.index()].reset();
131  }
132 
133  virtual std::shared_ptr<C> globalBeginLuminosityBlock(edm::LuminosityBlockForOutput const&) const = 0;
134  virtual void globalEndLuminosityBlock(edm::LuminosityBlockForOutput const&) = 0;
135  std::unique_ptr<std::shared_ptr<C>[]> caches_;
136  };
137 
138  template <typename T>
140 
141  template <>
144  };
145 
146  template <>
149  };
150 
151  template <>
154  };
155 
156  template <>
159  };
160 
161  template <typename C>
164  };
165 
166  template <typename C>
169  };
170  } // namespace outputmodule
171  } // namespace one
172 } // namespace edm
173 
174 #endif
virtual void endRun(edm::RunForOutput const &)=0
void doEndRun_(RunForOutput const &r) final
virtual void beginRun(edm::RunForOutput const &)=0
void doBeginRun_(RunForOutput const &r) final
edm::one::impl::SharedResourcesUser< edm::one::OutputModuleBase > Type
void doEndLuminosityBlock_(edm::LuminosityBlockForOutput const &lp) final
virtual void doBeginLuminosityBlock_(LuminosityBlockForOutput const &)
virtual void doRespondToCloseInputFile_(FileBlock const &)
virtual void doRespondToOpenInputFile_(FileBlock const &)
void doBeginLuminosityBlock_(edm::LuminosityBlockForOutput const &lp) final
void doBeginRun_(edm::RunForOutput const &rp) final
edm::propagate_const< std::shared_ptr< C > > cache_
void doEndRun_(edm::RunForOutput const &rp) final
#define noexcept
virtual void doEndLuminosityBlock_(LuminosityBlockForOutput const &)
HLT enums.
RunWatcher & operator=(RunWatcher const &)=delete
C const * luminosityBlockCache(edm::LuminosityBlockIndex iID) const