CMS 3D CMS Logo

outputmoduleAbilityToImplementor.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_limited_outputmoduleAbilityToImplementor_h
2 #define FWCore_Framework_limited_outputmoduleAbilityToImplementor_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : outputmodule::AbilityToImplementor
7 //
16 //
17 //
18 
19 // system include files
20 
21 // user include files
26 
27 // forward declarations
28 
29 namespace edm {
30  class FileBlock;
31  class ModuleCallingContext;
32 
33  namespace limited {
34  namespace outputmodule {
35  class InputFileWatcher : public virtual OutputModuleBase {
36  public:
38  InputFileWatcher(InputFileWatcher const&) = delete;
40  ~InputFileWatcher() noexcept(false) override{};
41 
42  private:
43  void doRespondToOpenInputFile_(FileBlock const&) final;
44  void doRespondToCloseInputFile_(FileBlock const&) final;
45 
46  virtual void respondToOpenInputFile(FileBlock const&) = 0;
47  virtual void respondToCloseInputFile(FileBlock const&) = 0;
48  };
49 
50  template <typename T, typename C>
51  class RunCacheHolder : public virtual T {
52  public:
54  RunCacheHolder(RunCacheHolder<T, C> const&) = delete;
56  ~RunCacheHolder() noexcept(false) override{};
57 
58  protected:
59  C const* runCache(edm::RunIndex iID) const { return cache_.get(); }
60 
61  private:
62  void doBeginRun_(RunForOutput const& rp) final { cache_ = globalBeginRun(rp); }
63  void doEndRun_(RunForOutput const& rp) final {
64  globalEndRun(rp);
65  cache_ = nullptr; // propagate_const<T> has no reset() function
66  }
67 
68  virtual std::shared_ptr<C> globalBeginRun(RunForOutput const&) const = 0;
69  virtual void globalEndRun(RunForOutput const&) const = 0;
70  //When threaded we will have a container for N items whre N is # of simultaneous runs
72  };
73 
74  template <typename T, typename C>
75  class LuminosityBlockCacheHolder : public virtual T {
76  public:
80  ~LuminosityBlockCacheHolder() noexcept(false) override{};
81 
82  protected:
83  C const* luminosityBlockCache(edm::LuminosityBlockIndex iID) const { return caches_[iID].get(); }
84 
85  private:
86  void preallocLumis(unsigned int iNLumis) final { caches_.reset(new std::shared_ptr<C>[iNLumis]); }
88  caches_[lp.index()] = globalBeginLuminosityBlock(lp);
89  }
92  caches_[lp.index()].reset();
93  }
94 
95  virtual std::shared_ptr<C> globalBeginLuminosityBlock(LuminosityBlockForOutput const&) const = 0;
96  virtual void globalEndLuminosityBlock(LuminosityBlockForOutput const&) const = 0;
97  //When threaded we will have a container for N items whre N is # of simultaneous runs
98  std::unique_ptr<std::shared_ptr<C>[]> caches_;
99  };
100 
101  template <typename T>
103 
104  template <>
107  };
108 
109  template <typename C>
112  };
113 
114  template <typename C>
117  };
118 
119  } // namespace outputmodule
120  } // namespace limited
121 } // namespace edm
122 
123 #endif
virtual void globalEndLuminosityBlock(LuminosityBlockForOutput const &) const =0
void doBeginLuminosityBlock_(LuminosityBlockForOutput const &lp) final
void doRespondToCloseInputFile_(FileBlock const &) final
virtual std::shared_ptr< C > globalBeginLuminosityBlock(LuminosityBlockForOutput const &) const =0
constexpr element_type const * get() const
virtual void respondToCloseInputFile(FileBlock const &)=0
InputFileWatcher & operator=(InputFileWatcher const &)=delete
edm::propagate_const< std::shared_ptr< C > > cache_
C const * luminosityBlockCache(edm::LuminosityBlockIndex iID) const
void doEndLuminosityBlock_(LuminosityBlockForOutput const &lp) final
edm::limited::outputmodule::RunCacheHolder< edm::limited::OutputModuleBase, C > Type
virtual void globalEndRun(RunForOutput const &) const =0
edm::limited::outputmodule::LuminosityBlockCacheHolder< edm::limited::OutputModuleBase, C > Type
LuminosityBlockCacheHolder< T, C > & operator=(LuminosityBlockCacheHolder< T, C > const &)=delete
RunCacheHolder< T, C > & operator=(RunCacheHolder< T, C > const &)=delete
HLT enums.
long double T
virtual void respondToOpenInputFile(FileBlock const &)=0
virtual std::shared_ptr< C > globalBeginRun(RunForOutput const &) const =0