CMS 3D CMS Logo

outputmoduleAbilityToImplementor.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_one_outputmoduleAbilityToImplementor_h
2 #define FWCore_Framework_one_outputmoduleAbilityToImplementor_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : outputmodule::AbilityToImplementor
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Thu, 09 May 2013 19:39:58 GMT
19 //
20 
21 // system include files
22 
23 // user include files
30 
31 // forward declarations
32 
33 namespace edm {
34  class FileBlock;
35  class ModuleCallingContext;
36 
37  namespace one {
38  namespace outputmodule {
39  class RunWatcher : public virtual OutputModuleBase {
40  public:
41  RunWatcher(edm::ParameterSet const& iPSet) : OutputModuleBase(iPSet) {}
42  RunWatcher(RunWatcher const&) = delete;
43  RunWatcher& operator=(RunWatcher const&) = delete;
44  ~RunWatcher() noexcept(false) override{};
45 
46  private:
47  void doBeginRun_(RunForOutput const& r) final;
48  void doEndRun_(RunForOutput const& r) final;
49 
50  virtual void beginRun(edm::RunForOutput const&) = 0;
51  virtual void endRun(edm::RunForOutput const&) = 0;
52  };
53 
54  class LuminosityBlockWatcher : public virtual OutputModuleBase {
55  public:
59  ~LuminosityBlockWatcher() noexcept(false) override{};
60 
61  private:
63  void doEndLuminosityBlock_(LuminosityBlockForOutput const& lb) final;
64 
65  virtual void beginLuminosityBlock(edm::LuminosityBlockForOutput const&) = 0;
66  virtual void endLuminosityBlock(edm::LuminosityBlockForOutput const&) = 0;
67  };
68 
69  class InputFileWatcher : public virtual OutputModuleBase {
70  public:
72  InputFileWatcher(InputFileWatcher const&) = delete;
74  ~InputFileWatcher() noexcept(false) override{};
75 
76  private:
77  void doRespondToOpenInputFile_(FileBlock const&) final;
78  void doRespondToCloseInputFile_(FileBlock const&) final;
79 
80  virtual void respondToOpenInputFile(FileBlock const&) = 0;
81  virtual void respondToCloseInputFile(FileBlock const&) = 0;
82  };
83 
84  template <typename C>
85  class RunCacheHolder : public virtual OutputModuleBase {
86  public:
88  RunCacheHolder(RunCacheHolder<C> const&) = delete;
90  ~RunCacheHolder() noexcept(false) override{};
91 
92  protected:
93  C* runCache(edm::RunIndex iID) { return cache_.get(); }
94  C const* runCache(edm::RunIndex iID) const { return cache_.get(); }
95 
96  private:
97  void doBeginRun_(edm::RunForOutput const& rp) final { cache_ = globalBeginRun(rp); }
98  void doEndRun_(edm::RunForOutput const& rp) final {
99  globalEndRun(rp);
100  cache_ = nullptr; // propagate_const<T> has no reset() function
101  }
102 
103  virtual std::shared_ptr<C> globalBeginRun(edm::RunForOutput const&) const = 0;
104  virtual void globalEndRun(edm::RunForOutput const&) = 0;
105  //When threaded we will have a container for N items whre N is # of simultaneous runs
107  };
108 
109  template <typename C>
111  public:
112  template <typename... A>
116  ~LuminosityBlockCacheHolder() noexcept(false) override{};
117 
118  protected:
119  void preallocLumis(unsigned int iNLumis) final { caches_.reset(new std::shared_ptr<C>[iNLumis]); }
120 
121  C const* luminosityBlockCache(edm::LuminosityBlockIndex iID) const { return caches_[iID].get(); }
123 
124  private:
126  caches_[lp.index()] = globalBeginLuminosityBlock(lp);
127  }
130  caches_[lp.index()].reset();
131  }
132 
133  virtual std::shared_ptr<C> globalBeginLuminosityBlock(edm::LuminosityBlockForOutput const&) const = 0;
135  std::unique_ptr<std::shared_ptr<C>[]> caches_;
136  };
137 
138  template <typename T>
140 
141  template <>
144  };
145 
146  template <>
149  };
150 
151  template <>
154  };
155 
156  template <>
159  };
160 
161  template <typename C>
164  };
165 
166  template <typename C>
169  };
170  } // namespace outputmodule
171  } // namespace one
172 } // namespace edm
173 
174 #endif
edm::one::outputmodule::RunWatcher::~RunWatcher
~RunWatcher() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:44
SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
edm::one::outputmodule::LuminosityBlockWatcher::~LuminosityBlockWatcher
~LuminosityBlockWatcher() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:59
edm::one::outputmodule::InputFileWatcher::operator=
InputFileWatcher & operator=(InputFileWatcher const &)=delete
funct::false
false
Definition: Factorize.h:29
moduleAbilities.h
edm::one::SharedResources
Definition: moduleAbilities.h:30
edm::one::outputmodule::LuminosityBlockWatcher::LuminosityBlockWatcher
LuminosityBlockWatcher(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:56
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::one::outputmodule::RunCacheHolder::~RunCacheHolder
~RunCacheHolder() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:90
edm::one::impl::SharedResourcesUser
Definition: implementors.h:64
edm::one::outputmodule::AbilityToImplementor
Definition: outputmoduleAbilityToImplementor.h:139
RunForOutput.h
edm::one::WatchLuminosityBlocks
Definition: moduleAbilities.h:40
edm::one::outputmodule::LuminosityBlockWatcher::operator=
LuminosityBlockWatcher & operator=(LuminosityBlockWatcher const &)=delete
edm::one::outputmodule::RunCacheHolder::globalBeginRun
virtual std::shared_ptr< C > globalBeginRun(edm::RunForOutput const &) const =0
edm::propagate_const::get
constexpr element_type const * get() const
Definition: propagate_const.h:64
edm::one::outputmodule::RunCacheHolder::doBeginRun_
void doBeginRun_(edm::RunForOutput const &rp) final
Definition: outputmoduleAbilityToImplementor.h:97
edm::one::outputmodule::RunCacheHolder::runCache
C * runCache(edm::RunIndex iID)
Definition: outputmoduleAbilityToImplementor.h:93
edm::one::outputmodule::RunCacheHolder::runCache
C const * runCache(edm::RunIndex iID) const
Definition: outputmoduleAbilityToImplementor.h:94
edm::WatchInputFiles
Definition: moduleAbilities.h:111
edm::one::outputmodule::LuminosityBlockWatcher
Definition: outputmoduleAbilityToImplementor.h:54
edm::one::outputmodule::RunCacheHolder
Definition: outputmoduleAbilityToImplementor.h:85
edm::one::outputmodule::LuminosityBlockCacheHolder::globalBeginLuminosityBlock
virtual std::shared_ptr< C > globalBeginLuminosityBlock(edm::LuminosityBlockForOutput const &) const =0
edm::one::outputmodule::RunCacheHolder::operator=
RunCacheHolder< C > & operator=(RunCacheHolder< C > const &)=delete
edm::LuminosityBlockForOutput
Definition: LuminosityBlockForOutput.h:40
edm::one::outputmodule::InputFileWatcher::InputFileWatcher
InputFileWatcher(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:71
edm::FileBlock
Definition: FileBlock.h:22
edm::RunForOutput
Definition: RunForOutput.h:40
edm::propagate_const
Definition: propagate_const.h:32
edm::LuminosityBlockIndex
Definition: LuminosityBlockIndex.h:33
edm::one::outputmodule::RunCacheHolder::globalEndRun
virtual void globalEndRun(edm::RunForOutput const &)=0
edm::one::outputmodule::LuminosityBlockCacheHolder::~LuminosityBlockCacheHolder
~LuminosityBlockCacheHolder() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:116
edm::one::outputmodule::RunWatcher
Definition: outputmoduleAbilityToImplementor.h:39
edm::LuminosityBlockCache
Definition: moduleAbilities.h:59
edm::one::outputmodule::RunWatcher::endRun
virtual void endRun(edm::RunForOutput const &)=0
edm::one::outputmodule::AbilityToImplementor< edm::LuminosityBlockCache< C > >::Type
edm::one::outputmodule::LuminosityBlockCacheHolder< C > Type
Definition: outputmoduleAbilityToImplementor.h:168
edm::one::outputmodule::LuminosityBlockWatcher::endLuminosityBlock
virtual void endLuminosityBlock(edm::LuminosityBlockForOutput const &)=0
edm::one::OutputModuleBase
Definition: OutputModuleBase.h:69
edm::one::outputmodule::RunWatcher::beginRun
virtual void beginRun(edm::RunForOutput const &)=0
edm::RunCache
Definition: moduleAbilities.h:53
edm::one::outputmodule::RunWatcher::operator=
RunWatcher & operator=(RunWatcher const &)=delete
edm::one::outputmodule::RunWatcher::doEndRun_
void doEndRun_(RunForOutput const &r) final
Definition: outputmoduleImplementors.cc:29
edm::one::outputmodule::LuminosityBlockWatcher::beginLuminosityBlock
virtual void beginLuminosityBlock(edm::LuminosityBlockForOutput const &)=0
edm::one::outputmodule::LuminosityBlockCacheHolder
Definition: outputmoduleAbilityToImplementor.h:110
edm::one::outputmodule::AbilityToImplementor< edm::one::WatchRuns >::Type
edm::one::outputmodule::RunWatcher Type
Definition: outputmoduleAbilityToImplementor.h:148
edm::ParameterSet
Definition: ParameterSet.h:47
edm::one::outputmodule::LuminosityBlockCacheHolder::doBeginLuminosityBlock_
void doBeginLuminosityBlock_(edm::LuminosityBlockForOutput const &lp) final
Definition: outputmoduleAbilityToImplementor.h:125
edm::one::outputmodule::InputFileWatcher::respondToCloseInputFile
virtual void respondToCloseInputFile(FileBlock const &)=0
edm::one::outputmodule::LuminosityBlockCacheHolder::caches_
std::unique_ptr< std::shared_ptr< C >[]> caches_
Definition: outputmoduleAbilityToImplementor.h:135
edm::one::outputmodule::InputFileWatcher
Definition: outputmoduleAbilityToImplementor.h:69
A
edm::one::outputmodule::LuminosityBlockCacheHolder::preallocLumis
void preallocLumis(unsigned int iNLumis) final
Definition: outputmoduleAbilityToImplementor.h:119
edm::one::outputmodule::RunCacheHolder::doEndRun_
void doEndRun_(edm::RunForOutput const &rp) final
Definition: outputmoduleAbilityToImplementor.h:98
edm::one::WatchRuns
Definition: moduleAbilities.h:35
edm::one::outputmodule::LuminosityBlockWatcher::doEndLuminosityBlock_
void doEndLuminosityBlock_(LuminosityBlockForOutput const &lb) final
Definition: outputmoduleImplementors.cc:34
edm::one::outputmodule::LuminosityBlockCacheHolder::luminosityBlockCache
C const * luminosityBlockCache(edm::LuminosityBlockIndex iID) const
Definition: outputmoduleAbilityToImplementor.h:121
edm::one::outputmodule::AbilityToImplementor< edm::one::SharedResources >::Type
edm::one::impl::SharedResourcesUser< edm::one::OutputModuleBase > Type
Definition: outputmoduleAbilityToImplementor.h:143
edm::one::outputmodule::InputFileWatcher::~InputFileWatcher
~InputFileWatcher() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:74
alignCSCRings.r
r
Definition: alignCSCRings.py:93
OutputModuleBase.h
edm::one::outputmodule::RunCacheHolder::cache_
edm::propagate_const< std::shared_ptr< C > > cache_
Definition: outputmoduleAbilityToImplementor.h:106
edm::one::outputmodule::LuminosityBlockCacheHolder::globalEndLuminosityBlock
virtual void globalEndLuminosityBlock(edm::LuminosityBlockForOutput const &)=0
gen::C
C
Definition: PomwigHadronizer.cc:78
moduleAbilities.h
edm::one::outputmodule::LuminosityBlockWatcher::doBeginLuminosityBlock_
void doBeginLuminosityBlock_(LuminosityBlockForOutput const &lb) final
Definition: outputmoduleImplementors.cc:31
edm::one::outputmodule::AbilityToImplementor< edm::WatchInputFiles >::Type
edm::one::outputmodule::InputFileWatcher Type
Definition: outputmoduleAbilityToImplementor.h:158
edm::one::outputmodule::LuminosityBlockCacheHolder::doEndLuminosityBlock_
void doEndLuminosityBlock_(edm::LuminosityBlockForOutput const &lp) final
Definition: outputmoduleAbilityToImplementor.h:128
edm::RunIndex
Definition: RunIndex.h:32
edm::one::outputmodule::RunWatcher::RunWatcher
RunWatcher(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:41
edm::one::outputmodule::InputFileWatcher::respondToOpenInputFile
virtual void respondToOpenInputFile(FileBlock const &)=0
edm::one::outputmodule::AbilityToImplementor< edm::one::WatchLuminosityBlocks >::Type
edm::one::outputmodule::LuminosityBlockWatcher Type
Definition: outputmoduleAbilityToImplementor.h:153
edm::one::outputmodule::LuminosityBlockCacheHolder::operator=
LuminosityBlockCacheHolder< C > & operator=(LuminosityBlockCacheHolder< C > const &)=delete
edm::one::outputmodule::LuminosityBlockCacheHolder::LuminosityBlockCacheHolder
LuminosityBlockCacheHolder(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:113
edm::one::outputmodule::RunCacheHolder::RunCacheHolder
RunCacheHolder(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:87
LuminosityBlockForOutput.h
edm::one::outputmodule::AbilityToImplementor< edm::RunCache< C > >::Type
edm::one::outputmodule::RunCacheHolder< C > Type
Definition: outputmoduleAbilityToImplementor.h:163
edm::one::outputmodule::InputFileWatcher::doRespondToCloseInputFile_
void doRespondToCloseInputFile_(FileBlock const &) final
Definition: outputmoduleImplementors.cc:36
edm::one::outputmodule::LuminosityBlockCacheHolder::luminosityBlockCache
C * luminosityBlockCache(edm::LuminosityBlockIndex iID)
Definition: outputmoduleAbilityToImplementor.h:122
implementors.h
edm::one::outputmodule::RunWatcher::doBeginRun_
void doBeginRun_(RunForOutput const &r) final
Definition: outputmoduleImplementors.cc:28
edm::one::outputmodule::InputFileWatcher::doRespondToOpenInputFile_
void doRespondToOpenInputFile_(FileBlock const &) final
Definition: outputmoduleImplementors.cc:35