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;
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  protected:
58  C const* runCache(edm::RunIndex iID) const { return cache_.get(); }
59  private:
60  void doBeginRun_(RunForOutput const& rp) final {
61  cache_ = globalBeginRun(rp);
62  }
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:
81  protected:
82  C const* luminosityBlockCache(edm::LuminosityBlockIndex iID) const { return caches_[iID].get(); }
83  private:
84  void preallocLumis(unsigned int iNLumis) final {
85  caches_.reset(new std::shared_ptr<C>[iNLumis]);
86  }
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> struct AbilityToImplementor;
102 
103  template<>
106  };
107 
108  template<typename C>
111  };
112 
113  template<typename C>
116  };
117 
118  }
119  }
120 }
121 
122 
123 #endif
void doBeginLuminosityBlock_(LuminosityBlockForOutput const &lp) final
#define noexcept
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
HLT enums.
long double T
virtual void respondToOpenInputFile(FileBlock const &)=0