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(std::string const& iProcessName,
86  std::string const& iModuleLabel,
87  bool iPrint,
88  std::vector<char const*>& oModuleLabels) const;
89 
90  void modulesWhoseProductsAreConsumed(std::vector<ModuleDescription const*>& modules,
91  ProductRegistry const& preg,
92  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
93  std::string const& processName) const;
94 
95  std::vector<ConsumesInfo> consumesInfo() const;
96 
97  protected:
98  template<typename F> void createStreamModules(F iFunc) {
99  for(auto& m: m_streamModules) {
100  m = iFunc();
101  m->setModuleDescriptionPtr(&moduleDescription_);
102  }
103  }
104 
105  void commit(Run& iRun) {
106  iRun.commit_();
107  }
108  void commit(LuminosityBlock& iLumi) {
109  iLumi.commit_();
110  }
111  template<typename L, typename I>
112  void commit(Event& iEvent, L* iList, I* iID) {
113  iEvent.commit_(iList,iID);
114  }
115 
117  return m_streamModules[0];
118  }
119  private:
120  ProducingModuleAdaptorBase(const ProducingModuleAdaptorBase&) = delete; // stop default
121 
122  const ProducingModuleAdaptorBase& operator=(const ProducingModuleAdaptorBase&) = delete; // stop default
123 
125  virtual void setupStreamModules() = 0;
126  void doBeginJob();
127  virtual void doEndJob() = 0;
128 
129  void doBeginStream(StreamID id);
130  void doEndStream(StreamID id);
131  void doStreamBeginRun(StreamID id,
132  RunPrincipal const& ep,
133  EventSetup const& c,
134  ModuleCallingContext const*);
135  virtual void setupRun(T*, RunIndex) = 0;
136  void doStreamEndRun(StreamID id,
137  RunPrincipal const& ep,
138  EventSetup const& c,
139  ModuleCallingContext const*);
140  virtual void streamEndRunSummary(T*,edm::Run const&, edm::EventSetup const&) = 0;
141 
143  LuminosityBlockPrincipal const& ep,
144  EventSetup const& c,
145  ModuleCallingContext const*);
146  virtual void setupLuminosityBlock(T*, LuminosityBlockIndex) = 0;
148  LuminosityBlockPrincipal const& ep,
149  EventSetup const& c,
150  ModuleCallingContext const*);
151  virtual void streamEndLuminosityBlockSummary(T*,edm::LuminosityBlock const&, edm::EventSetup const&) = 0;
152 
153 
154  virtual void doBeginRun(RunPrincipal const& rp, EventSetup const& c,
155  ModuleCallingContext const*)=0;
156  virtual void doEndRun(RunPrincipal const& rp, EventSetup const& c,
157  ModuleCallingContext const*)=0;
158  virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp,
159  EventSetup const& c,
160  ModuleCallingContext const*)=0;
161  virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp,
162  EventSetup const& c,
163  ModuleCallingContext const*)=0;
164 
166  void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren);
167 
168  //For now, the following are just dummy implemenations with no ability for users to override
173 
174  // ---------- member data --------------------------------
176  moduleDescription_ = md;
177  }
179  protected:
180  std::vector<T*> m_streamModules;
181 
182  };
183  }
184 }
185 
186 #endif
virtual void streamEndRunSummary(T *, edm::Run const &, edm::EventSetup const &)=0
void doStreamBeginRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
void commit(Event &iEvent, L *iList, I *iID)
void doRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &)
void modulesDependentUpon(std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
void doPreallocate(PreallocationConfiguration const &)
virtual void doBeginRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)=0
BranchType
Definition: BranchType.h:11
std::vector< ConsumesInfo > consumesInfo() const
void doStreamEndLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
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:79
const ProducingModuleAdaptorBase & operator=(const ProducingModuleAdaptorBase &)=delete
virtual void doEndRun(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *)=0
const std::complex< double > I
Definition: I.h:8
virtual void doBeginLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)=0
void doStreamEndRun(StreamID id, RunPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
const ModuleDescription & moduleDescription() 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:112
std::vector< ProductHolderIndexAndSkipBit > const & itemsToGetFromEvent() const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
preg
Definition: Schedule.cc:374
long double T
void doStreamBeginLuminosityBlock(StreamID id, LuminosityBlockPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *)
virtual void doEndLuminosityBlock(LuminosityBlockPrincipal const &lbp, EventSetup const &c, ModuleCallingContext const *)=0
Definition: Run.h:43
void doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren)