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 
23 // user include files
35 
36 // forward declarations
37 
38 namespace edm {
39  class Event;
40  class ModuleCallingContext;
41  class ProductHolderIndexHelper;
42  class EDConsumerBase;
43  class PreallocationConfiguration;
44  class ProductHolderIndexAndSkipBit;
45  class ProductRegistry;
46  class ThinnedAssociationsHelper;
47 
48  namespace maker {
49  template<typename T> class ModuleHolderT;
50  }
51 
52  namespace stream {
53  template<typename T>
54  class ProducingModuleAdaptorBase
55  {
56 
57  public:
58  template <typename U> friend class edm::WorkerT;
59  template <typename U> friend class edm::maker::ModuleHolderT;
60 
63 
64  // ---------- const member functions ---------------------
65 
66  // ---------- static member functions --------------------
67 
68  // ---------- member functions ---------------------------
70 
71  void
73 
74  void itemsToGet(BranchType, std::vector<ProductHolderIndexAndSkipBit>&) const;
75  void itemsMayGet(BranchType, std::vector<ProductHolderIndexAndSkipBit>&) const;
76  std::vector<ProductHolderIndexAndSkipBit> const& itemsToGetFromEvent() const;
77 
78  void updateLookup(BranchType iBranchType,
80 
81  void modulesDependentUpon(const std::string& iProcessName,
82  std::vector<const char*>& oModuleLabels) const;
83 
84 
85  protected:
86  template<typename F> void createStreamModules(F iFunc) {
87  for(auto& m: m_streamModules) {
88  m = iFunc();
89  m->setModuleDescriptionPtr(&moduleDescription_);
90  }
91  }
92 
93  void commit(Run& iRun) {
94  iRun.commit_();
95  }
96  void commit(LuminosityBlock& iLumi) {
97  iLumi.commit_();
98  }
99  template<typename L, typename I>
100  void commit(Event& iEvent, L* iList, I* iID) {
101  iEvent.commit_(iList,iID);
102  }
103 
105  return m_streamModules[0];
106  }
107  private:
108  ProducingModuleAdaptorBase(const ProducingModuleAdaptorBase&) = delete; // stop default
109 
110  const ProducingModuleAdaptorBase& operator=(const ProducingModuleAdaptorBase&) = delete; // stop default
111 
113  virtual void setupStreamModules() = 0;
114  void doBeginJob();
115  virtual void doEndJob() = 0;
116 
117  void doBeginStream(StreamID id);
118  void doEndStream(StreamID id);
119  void doStreamBeginRun(StreamID id,
120  RunPrincipal& ep,
121  EventSetup const& c,
122  ModuleCallingContext const*);
123  virtual void setupRun(T*, RunIndex) = 0;
124  void doStreamEndRun(StreamID id,
125  RunPrincipal& ep,
126  EventSetup const& c,
127  ModuleCallingContext const*);
128  virtual void streamEndRunSummary(T*,edm::Run const&, edm::EventSetup const&) = 0;
129 
132  EventSetup const& c,
133  ModuleCallingContext const*);
134  virtual void setupLuminosityBlock(T*, LuminosityBlockIndex) = 0;
137  EventSetup const& c,
138  ModuleCallingContext const*);
139  virtual void streamEndLuminosityBlockSummary(T*,edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
140 
141 
142  virtual void doBeginRun(RunPrincipal& rp, EventSetup const& c,
143  ModuleCallingContext const*)=0;
144  virtual void doEndRun(RunPrincipal& rp, EventSetup const& c,
145  ModuleCallingContext const*)=0;
147  EventSetup const& c,
148  ModuleCallingContext const*)=0;
150  EventSetup const& c,
151  ModuleCallingContext const*)=0;
152 
154  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
155 
156  //For now, the following are just dummy implemenations with no ability for users to override
161 
162  // ---------- member data --------------------------------
165  }
167  protected:
168  std::vector<T*> m_streamModules;
169 
170  };
171  }
172 }
173 
174 #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
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 commit_(std::vector< BranchID > *previousParentage=0, ParentageID *previousParentageId=0)
Definition: Event.cc:105
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 *)
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:41
void modulesDependentUpon(const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)