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;
41  ~InputFileWatcher() noexcept(false) override{};
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 
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:
81  ~LuminosityBlockCacheHolder() noexcept(false) override{};
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  }
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
edm::global::outputmodule::RunCacheHolder::doBeginRun_
void doBeginRun_(RunForOutput const &rp) final
Definition: outputmoduleAbilityToImplementor.h:63
edm::global::outputmodule::InputFileWatcher::~InputFileWatcher
~InputFileWatcher() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:41
edm::global::outputmodule::AbilityToImplementor< edm::WatchInputFiles >::Type
edm::global::outputmodule::InputFileWatcher Type
Definition: outputmoduleAbilityToImplementor.h:107
funct::false
false
Definition: Factorize.h:29
edm::global::OutputModuleBase
Definition: OutputModuleBase.h:64
edm::global::outputmodule::InputFileWatcher::respondToCloseInputFile
virtual void respondToCloseInputFile(FileBlock const &)=0
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::global::outputmodule::RunCacheHolder::~RunCacheHolder
~RunCacheHolder() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:57
edm::global::outputmodule::LuminosityBlockCacheHolder::preallocLumis
void preallocLumis(unsigned int iNLumis) final
Definition: outputmoduleAbilityToImplementor.h:84
edm::global::outputmodule::InputFileWatcher
Definition: outputmoduleAbilityToImplementor.h:36
edm::global::outputmodule::InputFileWatcher::doRespondToCloseInputFile_
void doRespondToCloseInputFile_(FileBlock const &) final
Definition: outputmoduleImplementors.cc:24
edm::propagate_const::get
constexpr element_type const * get() const
Definition: propagate_const.h:64
edm::WatchInputFiles
Definition: moduleAbilities.h:112
edm::global::outputmodule::InputFileWatcher::respondToOpenInputFile
virtual void respondToOpenInputFile(FileBlock const &)=0
edm::global::outputmodule::LuminosityBlockCacheHolder::globalEndLuminosityBlock
virtual void globalEndLuminosityBlock(LuminosityBlockForOutput const &) const =0
edm::global::outputmodule::InputFileWatcher::InputFileWatcher
InputFileWatcher(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:38
edm::LuminosityBlockForOutput
Definition: LuminosityBlockForOutput.h:40
edm::global::outputmodule::RunCacheHolder::runCache
C const * runCache(edm::RunIndex iID) const
Definition: outputmoduleAbilityToImplementor.h:60
edm::FileBlock
Definition: FileBlock.h:20
edm::global::outputmodule::LuminosityBlockCacheHolder::LuminosityBlockCacheHolder
LuminosityBlockCacheHolder(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:78
edm::RunForOutput
Definition: RunForOutput.h:39
edm::propagate_const
Definition: propagate_const.h:32
edm::LuminosityBlockIndex
Definition: LuminosityBlockIndex.h:33
edm::LuminosityBlockCache
Definition: moduleAbilities.h:60
edm::global::outputmodule::RunCacheHolder::globalEndRun
virtual void globalEndRun(RunForOutput const &) const =0
edm::global::outputmodule::AbilityToImplementor< edm::LuminosityBlockCache< C > >::Type
edm::global::outputmodule::LuminosityBlockCacheHolder< edm::global::OutputModuleBase, C > Type
Definition: outputmoduleAbilityToImplementor.h:117
edm::global::outputmodule::LuminosityBlockCacheHolder::caches_
std::unique_ptr< std::shared_ptr< C >[]> caches_
Definition: outputmoduleAbilityToImplementor.h:99
edm::RunCache
Definition: moduleAbilities.h:54
edm::global::outputmodule::RunCacheHolder::RunCacheHolder
RunCacheHolder(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:54
edm::global::outputmodule::RunCacheHolder::doEndRun_
void doEndRun_(RunForOutput const &rp) final
Definition: outputmoduleAbilityToImplementor.h:64
implementors.h
edm::ParameterSet
Definition: ParameterSet.h:47
edm::global::outputmodule::AbilityToImplementor< edm::RunCache< C > >::Type
edm::global::outputmodule::RunCacheHolder< edm::global::OutputModuleBase, C > Type
Definition: outputmoduleAbilityToImplementor.h:112
edm::global::outputmodule::LuminosityBlockCacheHolder::doBeginLuminosityBlock_
void doBeginLuminosityBlock_(LuminosityBlockForOutput const &lp) final
Definition: outputmoduleAbilityToImplementor.h:88
edm::global::outputmodule::AbilityToImplementor
Definition: outputmoduleAbilityToImplementor.h:103
edm::global::outputmodule::LuminosityBlockCacheHolder::doEndLuminosityBlock_
void doEndLuminosityBlock_(LuminosityBlockForOutput const &lp) final
Definition: outputmoduleAbilityToImplementor.h:91
gen::C
C
Definition: PomwigHadronizer.cc:78
T
long double T
Definition: Basic3DVectorLD.h:48
edm::global::outputmodule::LuminosityBlockCacheHolder::luminosityBlockCache
C const * luminosityBlockCache(edm::LuminosityBlockIndex iID) const
Definition: outputmoduleAbilityToImplementor.h:85
edm::global::outputmodule::RunCacheHolder::operator=
RunCacheHolder< T, C > & operator=(RunCacheHolder< T, C > const &)=delete
moduleAbilities.h
edm::global::outputmodule::LuminosityBlockCacheHolder
Definition: outputmoduleAbilityToImplementor.h:76
edm::global::outputmodule::LuminosityBlockCacheHolder::~LuminosityBlockCacheHolder
~LuminosityBlockCacheHolder() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:81
edm::RunIndex
Definition: RunIndex.h:32
edm::global::outputmodule::InputFileWatcher::operator=
InputFileWatcher & operator=(InputFileWatcher const &)=delete
OutputModuleBase.h
LuminosityBlockForOutput.h
edm::global::outputmodule::RunCacheHolder::cache_
edm::propagate_const< std::shared_ptr< C > > cache_
Definition: outputmoduleAbilityToImplementor.h:72
edm::global::outputmodule::LuminosityBlockCacheHolder::globalBeginLuminosityBlock
virtual std::shared_ptr< C > globalBeginLuminosityBlock(LuminosityBlockForOutput const &) const =0
edm::global::outputmodule::LuminosityBlockCacheHolder::operator=
LuminosityBlockCacheHolder< T, C > & operator=(LuminosityBlockCacheHolder< T, C > const &)=delete
edm::global::outputmodule::RunCacheHolder::globalBeginRun
virtual std::shared_ptr< C > globalBeginRun(RunForOutput const &) const =0
edm::global::outputmodule::RunCacheHolder
Definition: outputmoduleAbilityToImplementor.h:52
edm::global::outputmodule::InputFileWatcher::doRespondToOpenInputFile_
void doRespondToOpenInputFile_(FileBlock const &) final
Definition: outputmoduleImplementors.cc:23