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  void modulesDependentUpon(const std::string& iProcessName,
80  std::vector<const char*>& oModuleLabels) const;
81 
82 
83  protected:
84  template<typename F> void createStreamModules(F iFunc) {
85  for(auto& m: m_streamModules) {
86  m = iFunc();
87  m->setModuleDescriptionPtr(&moduleDescription_);
88  }
89  }
90 
91  void commit(Run& iRun) {
92  iRun.commit_();
93  }
94  void commit(LuminosityBlock& iLumi) {
95  iLumi.commit_();
96  }
97  template<typename L, typename I>
98  void commit(Event& iEvent, L* iList, I* iID) {
99  iEvent.commit_(iList,iID);
100  }
101 
103  return m_streamModules[0];
104  }
105  private:
106  ProducingModuleAdaptorBase(const ProducingModuleAdaptorBase&) = delete; // stop default
107 
108  const ProducingModuleAdaptorBase& operator=(const ProducingModuleAdaptorBase&) = delete; // stop default
109 
111  virtual void setupStreamModules() = 0;
112  void doBeginJob();
113  virtual void doEndJob() = 0;
114 
115  void doBeginStream(StreamID id);
116  void doEndStream(StreamID id);
117  void doStreamBeginRun(StreamID id,
118  RunPrincipal& ep,
119  EventSetup const& c,
120  ModuleCallingContext const*);
121  virtual void setupRun(T*, RunIndex) = 0;
122  void doStreamEndRun(StreamID id,
123  RunPrincipal& ep,
124  EventSetup const& c,
125  ModuleCallingContext const*);
126  virtual void streamEndRunSummary(T*,edm::Run const&, edm::EventSetup const&) = 0;
127 
130  EventSetup const& c,
131  ModuleCallingContext const*);
132  virtual void setupLuminosityBlock(T*, LuminosityBlockIndex) = 0;
135  EventSetup const& c,
136  ModuleCallingContext const*);
137  virtual void streamEndLuminosityBlockSummary(T*,edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
138 
139 
140  virtual void doBeginRun(RunPrincipal& rp, EventSetup const& c,
141  ModuleCallingContext const*)=0;
142  virtual void doEndRun(RunPrincipal& rp, EventSetup const& c,
143  ModuleCallingContext const*)=0;
145  EventSetup const& c,
146  ModuleCallingContext const*)=0;
148  EventSetup const& c,
149  ModuleCallingContext const*)=0;
150 
151  //For now, the following are just dummy implemenations with no ability for users to override
155  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
156 
157  // ---------- member data --------------------------------
159  moduleDescription_ = md;
160  }
162  protected:
163  std::vector<T*> m_streamModules;
164 
165  };
166  }
167 }
168 
169 #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: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: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 modulesDependentUpon(const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)