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_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;
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  }
91  globalEndLuminosityBlock(lp);
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>
110  struct AbilityToImplementor<edm::RunCache<C>> {
112  };
113 
114  template <typename C>
117  };
118 
119  } // namespace outputmodule
120  } // namespace limited
121 } // namespace edm
122 
123 #endif
void doBeginLuminosityBlock_(LuminosityBlockForOutput const &lp) final
void doRespondToCloseInputFile_(FileBlock const &) final
C const * luminosityBlockCache(edm::LuminosityBlockIndex iID) const
virtual void respondToCloseInputFile(FileBlock const &)=0
InputFileWatcher & operator=(InputFileWatcher const &)=delete
edm::propagate_const< std::shared_ptr< C > > cache_
void doEndLuminosityBlock_(LuminosityBlockForOutput const &lp) final
edm::limited::outputmodule::RunCacheHolder< edm::limited::OutputModuleBase, C > Type
edm::limited::outputmodule::LuminosityBlockCacheHolder< edm::limited::OutputModuleBase, C > Type
long double T
virtual void respondToOpenInputFile(FileBlock const &)=0
def template
Definition: svgfig.py:521