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;
57  ~RunCacheHolder() noexcept(false) override {};
58  protected:
59  C const* runCache(edm::RunIndex iID) const { return cache_.get(); }
60  private:
61  void doBeginRun_(RunForOutput const& rp) final {
62  cache_ = globalBeginRun(rp);
63  }
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  protected:
83  void preallocLumis(unsigned int iNLumis) final {
84  caches_.reset(new std::shared_ptr<C>[iNLumis]);
85  }
86  C const* luminosityBlockCache(edm::LuminosityBlockIndex iID) const { return caches_[iID].get(); }
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> struct AbilityToImplementor;
103 
104  template<>
107  };
108 
109  template<typename C>
112  };
113 
114  template<typename C>
117  };
118 
119  }
120  }
121 }
122 
123 
124 #endif
virtual void respondToOpenInputFile(FileBlock const &)=0
edm::global::outputmodule::LuminosityBlockCacheHolder< edm::global::OutputModuleBase, C > Type
InputFileWatcher & operator=(InputFileWatcher const &)=delete
edm::global::outputmodule::RunCacheHolder< edm::global::OutputModuleBase, C > Type
#define noexcept
C const * luminosityBlockCache(edm::LuminosityBlockIndex iID) const
edm::propagate_const< std::shared_ptr< C > > cache_
void doBeginLuminosityBlock_(LuminosityBlockForOutput const &lp) final
void doRespondToOpenInputFile_(FileBlock const &) final
void doRespondToCloseInputFile_(FileBlock const &) final
HLT enums.
void doEndLuminosityBlock_(LuminosityBlockForOutput const &lp) final
long double T
virtual void respondToCloseInputFile(FileBlock const &)=0