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;
40  ~InputFileWatcher() noexcept(false) override{};
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 
58  protected:
59  C const* runCache(edm::RunIndex iID) const { return cache_.get(); }
60 
61  private:
62  void doBeginRun_(RunForOutput const& rp) final { cache_ = globalBeginRun(rp); }
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:
80  ~LuminosityBlockCacheHolder() noexcept(false) override{};
81 
82  protected:
83  C const* luminosityBlockCache(edm::LuminosityBlockIndex iID) const { return caches_[iID].get(); }
84 
85  private:
86  void preallocLumis(unsigned int iNLumis) final { caches_.reset(new std::shared_ptr<C>[iNLumis]); }
88  caches_[lp.index()] = globalBeginLuminosityBlock(lp);
89  }
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>
103 
104  template <>
107  };
108 
109  template <typename C>
112  };
113 
114  template <typename C>
117  };
118 
119  } // namespace outputmodule
120  } // namespace limited
121 } // namespace edm
122 
123 #endif
edm::limited::outputmodule::LuminosityBlockCacheHolder::globalEndLuminosityBlock
virtual void globalEndLuminosityBlock(LuminosityBlockForOutput const &) const =0
edm::limited::outputmodule::InputFileWatcher::InputFileWatcher
InputFileWatcher(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:37
funct::false
false
Definition: Factorize.h:34
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::limited::outputmodule::RunCacheHolder::~RunCacheHolder
~RunCacheHolder() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:56
edm::limited::outputmodule::LuminosityBlockCacheHolder
Definition: outputmoduleAbilityToImplementor.h:75
implementors.h
edm::WatchInputFiles
Definition: moduleAbilities.h:91
edm::limited::outputmodule::LuminosityBlockCacheHolder::globalBeginLuminosityBlock
virtual std::shared_ptr< C > globalBeginLuminosityBlock(LuminosityBlockForOutput const &) const =0
edm::limited::outputmodule::LuminosityBlockCacheHolder::preallocLumis
void preallocLumis(unsigned int iNLumis) final
Definition: outputmoduleAbilityToImplementor.h:86
edm::LuminosityBlockForOutput
Definition: LuminosityBlockForOutput.h:40
edm::limited::outputmodule::LuminosityBlockCacheHolder::operator=
LuminosityBlockCacheHolder< T, C > & operator=(LuminosityBlockCacheHolder< T, C > const &)=delete
edm::FileBlock
Definition: FileBlock.h:20
edm::RunForOutput
Definition: RunForOutput.h:39
edm::propagate_const::get
element_type const * get() const
Definition: propagate_const.h:64
edm::propagate_const
Definition: propagate_const.h:32
edm::limited::outputmodule::RunCacheHolder::globalBeginRun
virtual std::shared_ptr< C > globalBeginRun(RunForOutput const &) const =0
edm::LuminosityBlockIndex
Definition: LuminosityBlockIndex.h:33
edm::LuminosityBlockCache
Definition: moduleAbilities.h:54
edm::limited::outputmodule::InputFileWatcher::operator=
InputFileWatcher & operator=(InputFileWatcher const &)=delete
edm::limited::outputmodule::InputFileWatcher
Definition: outputmoduleAbilityToImplementor.h:35
edm::RunCache
Definition: moduleAbilities.h:48
edm::limited::outputmodule::RunCacheHolder::RunCacheHolder
RunCacheHolder(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:53
edm::limited::outputmodule::AbilityToImplementor< edm::RunCache< C > >::Type
edm::limited::outputmodule::RunCacheHolder< edm::limited::OutputModuleBase, C > Type
Definition: outputmoduleAbilityToImplementor.h:111
edm::limited::outputmodule::InputFileWatcher::respondToCloseInputFile
virtual void respondToCloseInputFile(FileBlock const &)=0
edm::ParameterSet
Definition: ParameterSet.h:36
edm::limited::outputmodule::LuminosityBlockCacheHolder::doBeginLuminosityBlock_
void doBeginLuminosityBlock_(LuminosityBlockForOutput const &lp) final
Definition: outputmoduleAbilityToImplementor.h:87
edm::limited::outputmodule::RunCacheHolder::doBeginRun_
void doBeginRun_(RunForOutput const &rp) final
Definition: outputmoduleAbilityToImplementor.h:62
edm::limited::outputmodule::InputFileWatcher::doRespondToOpenInputFile_
void doRespondToOpenInputFile_(FileBlock const &) final
Definition: outputmoduleImplementors.cc:23
edm::limited::OutputModuleBase
Definition: OutputModuleBase.h:66
edm::limited::outputmodule::RunCacheHolder::runCache
C const * runCache(edm::RunIndex iID) const
Definition: outputmoduleAbilityToImplementor.h:59
edm::limited::outputmodule::LuminosityBlockCacheHolder::caches_
std::unique_ptr< std::shared_ptr< C >[]> caches_
Definition: outputmoduleAbilityToImplementor.h:98
edm::limited::outputmodule::RunCacheHolder::operator=
RunCacheHolder< T, C > & operator=(RunCacheHolder< T, C > const &)=delete
edm::limited::outputmodule::LuminosityBlockCacheHolder::doEndLuminosityBlock_
void doEndLuminosityBlock_(LuminosityBlockForOutput const &lp) final
Definition: outputmoduleAbilityToImplementor.h:90
edm::limited::outputmodule::RunCacheHolder
Definition: outputmoduleAbilityToImplementor.h:51
edm::limited::outputmodule::InputFileWatcher::doRespondToCloseInputFile_
void doRespondToCloseInputFile_(FileBlock const &) final
Definition: outputmoduleImplementors.cc:24
edm::limited::outputmodule::LuminosityBlockCacheHolder::luminosityBlockCache
C const * luminosityBlockCache(edm::LuminosityBlockIndex iID) const
Definition: outputmoduleAbilityToImplementor.h:83
gen::C
C
Definition: PomwigHadronizer.cc:76
T
long double T
Definition: Basic3DVectorLD.h:48
edm::limited::outputmodule::AbilityToImplementor
Definition: outputmoduleAbilityToImplementor.h:102
moduleAbilities.h
edm::limited::outputmodule::LuminosityBlockCacheHolder::LuminosityBlockCacheHolder
LuminosityBlockCacheHolder(edm::ParameterSet const &iPSet)
Definition: outputmoduleAbilityToImplementor.h:77
edm::limited::outputmodule::AbilityToImplementor< edm::LuminosityBlockCache< C > >::Type
edm::limited::outputmodule::LuminosityBlockCacheHolder< edm::limited::OutputModuleBase, C > Type
Definition: outputmoduleAbilityToImplementor.h:116
edm::limited::outputmodule::InputFileWatcher::~InputFileWatcher
~InputFileWatcher() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:40
edm::limited::outputmodule::InputFileWatcher::respondToOpenInputFile
virtual void respondToOpenInputFile(FileBlock const &)=0
edm::RunIndex
Definition: RunIndex.h:32
edm::limited::outputmodule::AbilityToImplementor< edm::WatchInputFiles >::Type
edm::limited::outputmodule::InputFileWatcher Type
Definition: outputmoduleAbilityToImplementor.h:106
edm::limited::outputmodule::LuminosityBlockCacheHolder::~LuminosityBlockCacheHolder
~LuminosityBlockCacheHolder() noexcept(false) override
Definition: outputmoduleAbilityToImplementor.h:80
OutputModuleBase.h
LuminosityBlockForOutput.h
edm::limited::outputmodule::RunCacheHolder::cache_
edm::propagate_const< std::shared_ptr< C > > cache_
Definition: outputmoduleAbilityToImplementor.h:71
edm::limited::outputmodule::RunCacheHolder::globalEndRun
virtual void globalEndRun(RunForOutput const &) const =0
edm::limited::outputmodule::RunCacheHolder::doEndRun_
void doEndRun_(RunForOutput const &rp) final
Definition: outputmoduleAbilityToImplementor.h:63