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 
46  namespace maker {
47  template<typename T> class ModuleHolderT;
48  }
49 
50  namespace stream {
51  template<typename T>
52  class ProducingModuleAdaptorBase
53  {
54 
55  public:
56  template <typename U> friend class edm::WorkerT;
57  template <typename U> friend class edm::maker::ModuleHolderT;
58 
61 
62  // ---------- const member functions ---------------------
63 
64  // ---------- static member functions --------------------
65 
66  // ---------- member functions ---------------------------
68 
69  void
71 
72  void itemsToGet(BranchType, std::vector<ProductHolderIndexAndSkipBit>&) const;
73  void itemsMayGet(BranchType, std::vector<ProductHolderIndexAndSkipBit>&) const;
74  std::vector<ProductHolderIndexAndSkipBit> const& itemsToGetFromEvent() const;
75 
76  void updateLookup(BranchType iBranchType,
78 
79 
80  protected:
81  template<typename F> void createStreamModules(F iFunc) {
82  for(auto& m: m_streamModules) {
83  m = iFunc();
84  m->setModuleDescriptionPtr(&moduleDescription_);
85  }
86  }
87 
88  void commit(Run& iRun) {
89  iRun.commit_();
90  }
91  void commit(LuminosityBlock& iLumi) {
92  iLumi.commit_();
93  }
94  template<typename L, typename I>
95  void commit(Event& iEvent, L* iList, I* iID) {
96  iEvent.commit_(iList,iID);
97  }
98 
100  return m_streamModules[0];
101  }
102  private:
103  ProducingModuleAdaptorBase(const ProducingModuleAdaptorBase&) = delete; // stop default
104 
105  const ProducingModuleAdaptorBase& operator=(const ProducingModuleAdaptorBase&) = delete; // stop default
106 
108  virtual void setupStreamModules() = 0;
109  void doBeginJob();
110  virtual void doEndJob() = 0;
111 
112  void doBeginStream(StreamID id);
113  void doEndStream(StreamID id);
114  void doStreamBeginRun(StreamID id,
115  RunPrincipal& ep,
116  EventSetup const& c,
117  ModuleCallingContext const*);
118  virtual void setupRun(T*, RunIndex) = 0;
119  void doStreamEndRun(StreamID id,
120  RunPrincipal& ep,
121  EventSetup const& c,
122  ModuleCallingContext const*);
123  virtual void streamEndRunSummary(T*,edm::Run const&, edm::EventSetup const&) = 0;
124 
127  EventSetup const& c,
128  ModuleCallingContext const*);
129  virtual void setupLuminosityBlock(T*, LuminosityBlockIndex) = 0;
132  EventSetup const& c,
133  ModuleCallingContext const*);
134  virtual void streamEndLuminosityBlockSummary(T*,edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
135 
136 
137  virtual void doBeginRun(RunPrincipal& rp, EventSetup const& c,
138  ModuleCallingContext const*)=0;
139  virtual void doEndRun(RunPrincipal& rp, EventSetup const& c,
140  ModuleCallingContext const*)=0;
142  EventSetup const& c,
143  ModuleCallingContext const*)=0;
145  EventSetup const& c,
146  ModuleCallingContext const*)=0;
147 
148  //For now, the following are just dummy implemenations with no ability for users to override
152  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
153 
154  // ---------- member data --------------------------------
156  moduleDescription_ = md;
157  }
159  protected:
160  std::vector<T*> m_streamModules;
161 
162  };
163  }
164 }
165 
166 #endif
virtual void streamEndRunSummary(T *, edm::Run const &, edm::EventSetup const &)=0
void commit(Event &iEvent, L *iList, I *iID)
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:243
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:86
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:108
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 doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)