test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProducingModuleAdaptorBase.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_stream_ProducingModuleAdaptorBase_h
2 #define FWCore_Framework_stream_ProducingModuleAdaptorBase_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : ProducingModuleAdaptorBase
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Fri, 02 Aug 2013 18:09:15 GMT
19 //
20 
21 // system include files
22 #include <map>
23 #include <string>
24 #include <vector>
25 
26 // user include files
39 
40 // forward declarations
41 
42 namespace edm {
43  class Event;
44  class ModuleCallingContext;
45  class ProductHolderIndexHelper;
46  class EDConsumerBase;
47  class PreallocationConfiguration;
48  class ProductHolderIndexAndSkipBit;
49  class ProductRegistry;
50  class ThinnedAssociationsHelper;
51 
52  namespace maker {
53  template<typename T> class ModuleHolderT;
54  }
55 
56  namespace stream {
57  template<typename T>
58  class ProducingModuleAdaptorBase
59  {
60 
61  public:
62  template <typename U> friend class edm::WorkerT;
63  template <typename U> friend class edm::maker::ModuleHolderT;
64 
67 
68  // ---------- const member functions ---------------------
69 
70  // ---------- static member functions --------------------
71 
72  // ---------- member functions ---------------------------
74 
75  void
77 
78  void itemsToGet(BranchType, std::vector<ProductHolderIndexAndSkipBit>&) const;
79  void itemsMayGet(BranchType, std::vector<ProductHolderIndexAndSkipBit>&) const;
80  std::vector<ProductHolderIndexAndSkipBit> const& itemsToGetFromEvent() const;
81 
82  void updateLookup(BranchType iBranchType,
84 
85  void modulesDependentUpon(const std::string& iProcessName,
86  std::vector<const char*>& oModuleLabels) const;
87 
88  void modulesWhoseProductsAreConsumed(std::vector<ModuleDescription const*>& modules,
89  ProductRegistry const& preg,
90  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
91  std::string const& processName) const;
92 
93  std::vector<ConsumesInfo> consumesInfo() const;
94 
95  protected:
96  template<typename F> void createStreamModules(F iFunc) {
97  for(auto& m: m_streamModules) {
98  m = iFunc();
99  m->setModuleDescriptionPtr(&moduleDescription_);
100  }
101  }
102 
103  void commit(Run& iRun) {
104  iRun.commit_();
105  }
106  void commit(LuminosityBlock& iLumi) {
107  iLumi.commit_();
108  }
109  template<typename L, typename I>
110  void commit(Event& iEvent, L* iList, I* iID) {
111  iEvent.commit_(iList,iID);
112  }
113 
115  return m_streamModules[0];
116  }
117  private:
118  ProducingModuleAdaptorBase(const ProducingModuleAdaptorBase&) = delete; // stop default
119 
120  const ProducingModuleAdaptorBase& operator=(const ProducingModuleAdaptorBase&) = delete; // stop default
121 
123  virtual void setupStreamModules() = 0;
124  void doBeginJob();
125  virtual void doEndJob() = 0;
126 
127  void doBeginStream(StreamID id);
128  void doEndStream(StreamID id);
129  void doStreamBeginRun(StreamID id,
130  RunPrincipal& ep,
131  EventSetup const& c,
132  ModuleCallingContext const*);
133  virtual void setupRun(T*, RunIndex) = 0;
134  void doStreamEndRun(StreamID id,
135  RunPrincipal& ep,
136  EventSetup const& c,
137  ModuleCallingContext const*);
138  virtual void streamEndRunSummary(T*,edm::Run const&, edm::EventSetup const&) = 0;
139 
142  EventSetup const& c,
143  ModuleCallingContext const*);
144  virtual void setupLuminosityBlock(T*, LuminosityBlockIndex) = 0;
147  EventSetup const& c,
148  ModuleCallingContext const*);
149  virtual void streamEndLuminosityBlockSummary(T*,edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
150 
151 
152  virtual void doBeginRun(RunPrincipal& rp, EventSetup const& c,
153  ModuleCallingContext const*)=0;
154  virtual void doEndRun(RunPrincipal& rp, EventSetup const& c,
155  ModuleCallingContext const*)=0;
157  EventSetup const& c,
158  ModuleCallingContext const*)=0;
160  EventSetup const& c,
161  ModuleCallingContext const*)=0;
162 
164  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
165 
166  //For now, the following are just dummy implemenations with no ability for users to override
171 
172  // ---------- member data --------------------------------
175  }
177  protected:
178  std::vector<T*> m_streamModules;
179 
180  };
181  }
182 }
183 
184 #endif
virtual void streamEndRunSummary(T *, edm::Run const &, edm::EventSetup const &)=0
void commit(Event &iEvent, L *iList, I *iID)
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
void doStreamEndRun(StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
void doPreallocate(PreallocationConfiguration const &)
virtual void doEndLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, ModuleCallingContext const *)=0
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
BranchType
Definition: BranchType.h:11
std::vector< ConsumesInfo > consumesInfo() const
virtual void doBeginRun(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *)=0
int iEvent
Definition: GenABIO.cc:230
virtual void setupRun(T *, RunIndex)=0
void itemsToGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
void registerProductsAndCallbacks(ProducingModuleAdaptorBase const *, ProductRegistry *reg)
void setModuleDescription(ModuleDescription const &md)
virtual void streamEndLuminosityBlockSummary(T *, edm::LuminosityBlock const &, edm::EventSetup const &)=0
void commit_()
Definition: Run.cc:83
const ProducingModuleAdaptorBase & operator=(const ProducingModuleAdaptorBase &)=delete
const std::complex< double > I
Definition: I.h:8
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
void itemsMayGet(BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
virtual void setupLuminosityBlock(T *, LuminosityBlockIndex)=0
void updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &)
void modulesWhoseProductsAreConsumed(std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
void commit_(std::vector< BranchID > *previousParentage=0, ParentageID *previousParentageId=0)
Definition: Event.cc:117
std::vector< ProductHolderIndexAndSkipBit > const & itemsToGetFromEvent() const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
void doStreamBeginRun(StreamID id, RunPrincipal &ep, EventSetup const &c, ModuleCallingContext const *)
preg
Definition: Schedule.cc:369
long double T
virtual void doEndRun(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *)=0
virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal &lbp, EventSetup const &c, ModuleCallingContext const *)=0
Definition: Run.h:43
void modulesDependentUpon(const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)