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:
59  ~LuminosityBlockWatcher() noexcept(false) override{};
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;
74  ~InputFileWatcher() noexcept(false) override{};
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;
90  ~RunCacheHolder() noexcept(false) override{};
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>
116  ~LuminosityBlockCacheHolder() noexcept(false) override{};
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(); }
123 
124  private:
126  caches_[lp.index()] = globalBeginLuminosityBlock(lp);
127  }
130  caches_[lp.index()].reset();
131  }
132 
133  virtual std::shared_ptr<C> globalBeginLuminosityBlock(edm::LuminosityBlockForOutput const&) 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
LuminosityBlockCacheHolder< C > & operator=(LuminosityBlockCacheHolder< C > const &)=delete
virtual void endRun(edm::RunForOutput const &)=0
RunCacheHolder< C > & operator=(RunCacheHolder< C > const &)=delete
virtual std::shared_ptr< C > globalBeginLuminosityBlock(edm::LuminosityBlockForOutput const &) const =0
virtual void respondToCloseInputFile(FileBlock const &)=0
void doEndRun_(RunForOutput const &r) final
virtual void globalEndRun(edm::RunForOutput const &)=0
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 endLuminosityBlock(edm::LuminosityBlockForOutput const &)=0
constexpr element_type const * get() const
void doRespondToCloseInputFile_(FileBlock const &) final
virtual void respondToOpenInputFile(FileBlock const &)=0
void doEndLuminosityBlock_(LuminosityBlockForOutput const &lb) final
void doBeginLuminosityBlock_(edm::LuminosityBlockForOutput const &lp) final
void doBeginRun_(edm::RunForOutput const &rp) final
InputFileWatcher & operator=(InputFileWatcher const &)=delete
edm::propagate_const< std::shared_ptr< C > > cache_
void doRespondToOpenInputFile_(FileBlock const &) final
void doEndRun_(edm::RunForOutput const &rp) final
virtual void globalEndLuminosityBlock(edm::LuminosityBlockForOutput const &)=0
virtual std::shared_ptr< C > globalBeginRun(edm::RunForOutput const &) const =0
LuminosityBlockWatcher & operator=(LuminosityBlockWatcher const &)=delete
HLT enums.
C const * luminosityBlockCache(edm::LuminosityBlockIndex iID) const
RunWatcher & operator=(RunWatcher const &)=delete
Definition: APVGainStruct.h:7
void doBeginLuminosityBlock_(LuminosityBlockForOutput const &lb) final
virtual void beginLuminosityBlock(edm::LuminosityBlockForOutput const &)=0