CMS 3D CMS Logo

outputmoduleAbilityToImplementor.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_global_outputmoduleAbilityToImplementor_h
2 #define FWCore_Framework_global_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 global {
34  namespace outputmodule {
35 
36  class InputFileWatcher : public virtual OutputModuleBase {
37  public:
39  InputFileWatcher(InputFileWatcher const&) = delete;
42 
43  private:
44  void doRespondToOpenInputFile_(FileBlock const&) final;
45  void doRespondToCloseInputFile_(FileBlock const&) final;
46 
47  virtual void respondToOpenInputFile(FileBlock const&) = 0;
48  virtual void respondToCloseInputFile(FileBlock const&) = 0;
49  };
50 
51  template <typename T, typename C>
52  class RunCacheHolder : public virtual T {
53  public:
55  RunCacheHolder(RunCacheHolder<T, C> const&) = delete;
58 
59  protected:
60  C const* runCache(edm::RunIndex iID) const { return cache_.get(); }
61 
62  private:
63  void doBeginRun_(RunForOutput const& rp) final { cache_ = globalBeginRun(rp); }
64  void doEndRun_(RunForOutput const& rp) final {
65  globalEndRun(rp);
66  cache_ = nullptr; // propagate_const<T> has no reset() function
67  }
68 
69  virtual std::shared_ptr<C> globalBeginRun(RunForOutput const&) const = 0;
70  virtual void globalEndRun(RunForOutput const&) const = 0;
71  //When threaded we will have a container for N items whre N is # of simultaneous runs
73  };
74 
75  template <typename T, typename C>
76  class LuminosityBlockCacheHolder : public virtual T {
77  public:
82 
83  protected:
84  void preallocLumis(unsigned int iNLumis) final { caches_.reset(new std::shared_ptr<C>[iNLumis]); }
85  C const* luminosityBlockCache(edm::LuminosityBlockIndex iID) const { return caches_[iID].get(); }
86 
87  private:
89  caches_[lp.index()] = globalBeginLuminosityBlock(lp);
90  }
92  globalEndLuminosityBlock(lp);
93  caches_[lp.index()].reset();
94  }
95 
96  virtual std::shared_ptr<C> globalBeginLuminosityBlock(LuminosityBlockForOutput const&) const = 0;
97  virtual void globalEndLuminosityBlock(LuminosityBlockForOutput const&) const = 0;
98  //When threaded we will have a container for N items whre N is # of simultaneous runs
99  std::unique_ptr<std::shared_ptr<C>[]> caches_;
100  };
101 
102  template <typename T>
104 
105  template <>
108  };
109 
110  template <typename C>
113  };
114 
115  template <typename C>
118  };
119 
120  } // namespace outputmodule
121  } // namespace global
122 } // namespace edm
123 
124 #endif
virtual void respondToOpenInputFile(FileBlock const &)=0
InputFileWatcher & operator=(InputFileWatcher const &)=delete
edm::global::outputmodule::LuminosityBlockCacheHolder< edm::global::OutputModuleBase, C > Type
C const * luminosityBlockCache(edm::LuminosityBlockIndex iID) const
edm::propagate_const< std::shared_ptr< C > > cache_
#define noexcept
void doBeginLuminosityBlock_(LuminosityBlockForOutput const &lp) final
void doRespondToOpenInputFile_(FileBlock const &) final
void doRespondToCloseInputFile_(FileBlock const &) final
edm::global::outputmodule::RunCacheHolder< edm::global::OutputModuleBase, C > Type
HLT enums.
void doEndLuminosityBlock_(LuminosityBlockForOutput const &lp) final
long double T
virtual void respondToCloseInputFile(FileBlock const &)=0