CMS 3D CMS Logo

WorkerT.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_WorkerT_h
2 #define FWCore_Framework_WorkerT_h
3 
4 /*----------------------------------------------------------------------
5 
6 WorkerT: Code common to all workers.
7 
8 ----------------------------------------------------------------------*/
9 
15 
16 #include <map>
17 #include <memory>
18 #include <string>
19 #include <vector>
20 
21 namespace edm {
22 
23  class ModuleCallingContext;
24  class ModuleDescription;
25  class ProductResolverIndexAndSkipBit;
26  class ProductRegistry;
27  class ThinnedAssociationsHelper;
28 
29  template<typename T>
30  class WorkerT : public Worker {
31  public:
32  typedef T ModuleType;
34  WorkerT(std::shared_ptr<T>,
35  ModuleDescription const&,
37 
38  virtual ~WorkerT();
39 
40  void setModule( std::shared_ptr<T> iModule) {
41  module_ = iModule;
42  resetModuleDescription(&(module_->moduleDescription()));
43  }
44 
45  virtual Types moduleType() const override;
46 
47  virtual void updateLookup(BranchType iBranchType,
48  ProductResolverIndexHelper const&) override;
49  virtual void resolvePutIndicies(BranchType iBranchType,
50  std::unordered_multimap<std::string, edm::ProductResolverIndex> const& iIndicies) override;
51 
52  template<typename D>
54  template<typename D>
56  template<typename D>
57  void callWorkerStreamBegin(D, StreamID id, RunPrincipal const& rp,
58  EventSetup const& c,
59  ModuleCallingContext const* mcc);
60  template<typename D>
61  void callWorkerStreamEnd(D, StreamID id, RunPrincipal const& rp,
62  EventSetup const& c,
63  ModuleCallingContext const* mcc);
64  template<typename D>
66  EventSetup const& c,
67  ModuleCallingContext const* mcc);
68  template<typename D>
70  EventSetup const& c,
71  ModuleCallingContext const* mcc);
72 
73  protected:
74  T& module() {return *module_;}
75  T const& module() const {return *module_;}
76 
77  private:
78  virtual bool implDo(EventPrincipal const& ep, EventSetup const& c,
79  ModuleCallingContext const* mcc) override;
80  virtual bool implDoPrePrefetchSelection(StreamID id,
81  EventPrincipal const& ep,
82  ModuleCallingContext const* mcc) override;
83  virtual bool implDoBegin(RunPrincipal const& rp, EventSetup const& c,
84  ModuleCallingContext const* mcc) override;
85  virtual bool implDoStreamBegin(StreamID id, RunPrincipal const& rp, EventSetup const& c,
86  ModuleCallingContext const* mcc) override;
87  virtual bool implDoStreamEnd(StreamID id, RunPrincipal const& rp, EventSetup const& c,
88  ModuleCallingContext const* mcc) override;
89  virtual bool implDoEnd(RunPrincipal const& rp, EventSetup const& c,
90  ModuleCallingContext const* mcc) override;
91  virtual bool implDoBegin(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
92  ModuleCallingContext const* mcc) override;
93  virtual bool implDoStreamBegin(StreamID id, LuminosityBlockPrincipal const& lbp, EventSetup const& c,
94  ModuleCallingContext const* mcc) override;
95  virtual bool implDoStreamEnd(StreamID id, LuminosityBlockPrincipal const& lbp, EventSetup const& c,
96  ModuleCallingContext const* mcc) override;
97  virtual bool implDoEnd(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
98  ModuleCallingContext const* mcc) override;
99  virtual void implBeginJob() override;
100  virtual void implEndJob() override;
101  virtual void implBeginStream(StreamID) override;
102  virtual void implEndStream(StreamID) override;
103  virtual void implRespondToOpenInputFile(FileBlock const& fb) override;
104  virtual void implRespondToCloseInputFile(FileBlock const& fb) override;
106  virtual std::string workerType() const override;
107  virtual SerialTaskQueueChain* serializeRunModule() override;
108 
109 
110  virtual void modulesWhoseProductsAreConsumed(std::vector<ModuleDescription const*>& modules,
111  ProductRegistry const& preg,
112  std::map<std::string, ModuleDescription const*> const& labelsToDesc) const override {
113  module_->modulesWhoseProductsAreConsumed(modules, preg, labelsToDesc, module_->moduleDescription().processName());
114  }
115 
116  virtual void convertCurrentProcessAlias(std::string const& processName) override {
117  module_->convertCurrentProcessAlias(processName);
118  }
119 
120  virtual std::vector<ConsumesInfo> consumesInfo() const override {
121  return module_->consumesInfo();
122  }
123 
124  virtual void itemsToGet(BranchType branchType, std::vector<ProductResolverIndexAndSkipBit>& indexes) const override {
125  module_->itemsToGet(branchType, indexes);
126  }
127 
128  virtual void itemsMayGet(BranchType branchType, std::vector<ProductResolverIndexAndSkipBit>& indexes) const override {
129  module_->itemsMayGet(branchType, indexes);
130  }
131 
132  virtual std::vector<ProductResolverIndexAndSkipBit> const& itemsToGetFrom(BranchType iType) const override final { return module_->itemsToGetFrom(iType); }
133 
134  virtual std::vector<ProductResolverIndex> const& itemsShouldPutInEvent() const override;
135 
136  virtual void preActionBeforeRunEventAsync(WaitingTask* iTask, ModuleCallingContext const& iModuleCallingContext, Principal const& iPrincipal) const override {
137  module_->preActionBeforeRunEventAsync(iTask,iModuleCallingContext,iPrincipal);
138  }
139 
140 
142  };
143 
144 }
145 
146 #endif
virtual bool implDoStreamEnd(StreamID id, RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:196
virtual std::vector< ConsumesInfo > consumesInfo() const override
Definition: WorkerT.h:120
void resetModuleDescription(ModuleDescription const *)
Definition: Worker.cc:239
roAction_t actions[nactions]
Definition: GenABIO.cc:187
void callWorkerStreamEnd(D, StreamID id, RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:174
virtual void implEndJob() override
Definition: WorkerT.cc:293
virtual std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom(BranchType iType) const override final
Definition: WorkerT.h:132
virtual void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &) override
Definition: WorkerT.cc:408
T & module()
Definition: WorkerT.h:74
void setModule(std::shared_ptr< T > iModule)
Definition: WorkerT.h:40
virtual bool implDoStreamBegin(StreamID id, RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:184
T const & module() const
Definition: WorkerT.h:75
virtual bool implDo(EventPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:113
virtual ~WorkerT()
Definition: WorkerT.cc:107
BranchType
Definition: BranchType.h:11
virtual void itemsMayGet(BranchType branchType, std::vector< ProductResolverIndexAndSkipBit > &indexes) const override
Definition: WorkerT.h:128
edm::propagate_const< std::shared_ptr< T > > module_
Definition: WorkerT.h:141
virtual void convertCurrentProcessAlias(std::string const &processName) override
Definition: WorkerT.h:116
virtual void implRespondToOpenInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:332
virtual bool implDoPrePrefetchSelection(StreamID id, EventPrincipal const &ep, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:121
virtual SerialTaskQueueChain * serializeRunModule() override
Definition: WorkerT.cc:353
void callWorkerEndStream(D, StreamID)
Definition: WorkerT.cc:315
virtual void itemsToGet(BranchType branchType, std::vector< ProductResolverIndexAndSkipBit > &indexes) const override
Definition: WorkerT.h:124
virtual void preActionBeforeRunEventAsync(WaitingTask *iTask, ModuleCallingContext const &iModuleCallingContext, Principal const &iPrincipal) const override
Definition: WorkerT.h:136
virtual void implBeginStream(StreamID) override
Definition: WorkerT.cc:306
virtual void modulesWhoseProductsAreConsumed(std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc) const override
Definition: WorkerT.h:110
Definition: Types.py:1
void callWorkerStreamBegin(D, StreamID id, RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:165
virtual bool implDoBegin(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:157
T ModuleType
Definition: WorkerT.h:32
WorkerT< T > WorkerType
Definition: WorkerT.h:33
virtual std::vector< ProductResolverIndex > const & itemsShouldPutInEvent() const override
Definition: WorkerT.cc:470
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:151
virtual void implEndStream(StreamID) override
Definition: WorkerT.cc:322
virtual void implBeginJob() override
Definition: WorkerT.cc:286
virtual void implRespondToCloseInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:339
void callWorkerBeginStream(D, StreamID)
Definition: WorkerT.cc:299
HLT enums.
virtual void implRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &) override
Definition: WorkerT.cc:346
virtual bool implDoEnd(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:208
long double T
virtual std::string workerType() const override
Definition: WorkerT.cc:279
virtual void resolvePutIndicies(BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies) override
Definition: WorkerT.cc:462
WorkerT(std::shared_ptr< T >, ModuleDescription const &, ExceptionToActionTable const *actions)
Definition: WorkerT.cc:100
def branchType(schema, name)
Definition: revisionDML.py:112
virtual Types moduleType() const override