CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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;
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:
87  RunCacheHolder(edm::ParameterSet const& iPSet) : OutputModuleBase(iPSet) {}
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(); }
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>
162  struct AbilityToImplementor<edm::RunCache<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
virtual void respondToCloseInputFile(FileBlock 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 endLuminosityBlock(edm::LuminosityBlockForOutput const &)=0
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
LuminosityBlockWatcher & operator=(LuminosityBlockWatcher const &)=delete
RunWatcher & operator=(RunWatcher const &)=delete
Definition: APVGainStruct.h:7
C const * luminosityBlockCache(edm::LuminosityBlockIndex iID) const
def template
Definition: svgfig.py:521
void doBeginLuminosityBlock_(LuminosityBlockForOutput const &lb) final
virtual void beginLuminosityBlock(edm::LuminosityBlockForOutput const &)=0