CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
14 
15 #include <memory>
16 
17 namespace edm {
18 
19  class ModuleCallingContext;
20  class ProductHolderIndexAndSkipBit;
21  class ProductRegistry;
22  class ThinnedAssociationsHelper;
23 
24  UnscheduledHandler* getUnscheduledHandler(EventPrincipal const& ep);
25 
26  template<typename T>
27  class WorkerT : public Worker {
28  public:
29  typedef T ModuleType;
31  WorkerT(std::shared_ptr<T>,
32  ModuleDescription const&,
34 
35  virtual ~WorkerT();
36 
37  void setModule( std::shared_ptr<T> iModule) {
38  module_ = iModule;
39  resetModuleDescription(&(module_->moduleDescription()));
40  }
41 
42  virtual Types moduleType() const override;
43 
44  virtual void updateLookup(BranchType iBranchType,
45  ProductHolderIndexHelper const&) override;
46 
47 
48  template<typename D>
50  template<typename D>
52  template<typename D>
54  EventSetup const& c,
55  ModuleCallingContext const* mcc);
56  template<typename D>
58  EventSetup const& c,
59  ModuleCallingContext const* mcc);
60  template<typename D>
62  EventSetup const& c,
63  ModuleCallingContext const* mcc);
64  template<typename D>
66  EventSetup const& c,
67  ModuleCallingContext const* mcc);
68 
69  protected:
70  T& module() {return *module_;}
71  T const& module() const {return *module_;}
72 
73  private:
74  virtual bool implDo(EventPrincipal& ep, EventSetup const& c,
75  ModuleCallingContext const* mcc) override;
76  virtual bool implDoBegin(RunPrincipal& rp, EventSetup const& c,
77  ModuleCallingContext const* mcc) override;
78  virtual bool implDoStreamBegin(StreamID id, RunPrincipal& rp, EventSetup const& c,
79  ModuleCallingContext const* mcc) override;
80  virtual bool implDoStreamEnd(StreamID id, RunPrincipal& rp, EventSetup const& c,
81  ModuleCallingContext const* mcc) override;
82  virtual bool implDoEnd(RunPrincipal& rp, EventSetup const& c,
83  ModuleCallingContext const* mcc) override;
84  virtual bool implDoBegin(LuminosityBlockPrincipal& lbp, EventSetup const& c,
85  ModuleCallingContext const* mcc) override;
86  virtual bool implDoStreamBegin(StreamID id, LuminosityBlockPrincipal& lbp, EventSetup const& c,
87  ModuleCallingContext const* mcc) override;
88  virtual bool implDoStreamEnd(StreamID id, LuminosityBlockPrincipal& lbp, EventSetup const& c,
89  ModuleCallingContext const* mcc) override;
90  virtual bool implDoEnd(LuminosityBlockPrincipal& lbp, EventSetup const& c,
91  ModuleCallingContext const* mcc) override;
92  virtual void implBeginJob() override;
93  virtual void implEndJob() override;
94  virtual void implBeginStream(StreamID) override;
95  virtual void implEndStream(StreamID) override;
96  virtual void implRespondToOpenInputFile(FileBlock const& fb) override;
97  virtual void implRespondToCloseInputFile(FileBlock const& fb) override;
98  virtual void implPreForkReleaseResources() override;
99  virtual void implPostForkReacquireResources(unsigned int iChildIndex,
100  unsigned int iNumberOfChildren) override;
102  virtual std::string workerType() const override;
103 
104  virtual void modulesDependentUpon(std::vector<const char*>& oModuleLabels) const override {
105  module_->modulesDependentUpon(module_->moduleDescription().processName(),oModuleLabels);
106  }
107 
108  virtual void itemsToGet(BranchType branchType, std::vector<ProductHolderIndexAndSkipBit>& indexes) const override {
109  module_->itemsToGet(branchType, indexes);
110  }
111 
112  virtual void itemsMayGet(BranchType branchType, std::vector<ProductHolderIndexAndSkipBit>& indexes) const override {
113  module_->itemsMayGet(branchType, indexes);
114  }
115 
116  virtual std::vector<ProductHolderIndexAndSkipBit> const& itemsToGetFromEvent() const override { return module_->itemsToGetFromEvent(); }
117 
118  std::shared_ptr<T> module_;
119  };
120 
121 }
122 
123 #endif
virtual bool implDo(EventPrincipal &ep, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:117
void resetModuleDescription(ModuleDescription const *)
Definition: Worker.cc:98
virtual Types moduleType() const override
virtual void implEndJob() override
Definition: WorkerT.cc:261
void callWorkerStreamEnd(D, StreamID id, RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:142
virtual std::string workerType() const override
Definition: WorkerT.cc:247
virtual std::vector< ProductHolderIndexAndSkipBit > const & itemsToGetFromEvent() const override
Definition: WorkerT.h:116
T & module()
Definition: WorkerT.h:70
void setModule(std::shared_ptr< T > iModule)
Definition: WorkerT.h:37
T const & module() const
Definition: WorkerT.h:71
virtual void itemsToGet(BranchType branchType, std::vector< ProductHolderIndexAndSkipBit > &indexes) const override
Definition: WorkerT.h:108
actions
Definition: Schedule.cc:370
virtual bool implDoBegin(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:125
virtual void updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &) override
Definition: WorkerT.cc:336
virtual ~WorkerT()
Definition: WorkerT.cc:111
BranchType
Definition: BranchType.h:11
virtual void implRespondToOpenInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:300
virtual bool implDoStreamBegin(StreamID id, RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:152
virtual void itemsMayGet(BranchType branchType, std::vector< ProductHolderIndexAndSkipBit > &indexes) const override
Definition: WorkerT.h:112
void callWorkerEndStream(D, StreamID)
Definition: WorkerT.cc:283
virtual void implBeginStream(StreamID) override
Definition: WorkerT.cc:274
UnscheduledHandler * getUnscheduledHandler(EventPrincipal const &ep)
Definition: WorkerT.cc:97
T ModuleType
Definition: WorkerT.h:29
WorkerT< T > WorkerType
Definition: WorkerT.h:30
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
virtual void implEndStream(StreamID) override
Definition: WorkerT.cc:290
virtual void implBeginJob() override
Definition: WorkerT.cc:254
virtual void implPreForkReleaseResources() override
Definition: WorkerT.cc:314
virtual bool implDoStreamEnd(StreamID id, RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:164
std::shared_ptr< T > module_
Definition: WorkerT.h:118
virtual void implRespondToCloseInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:307
void callWorkerBeginStream(D, StreamID)
Definition: WorkerT.cc:267
virtual bool implDoEnd(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:176
void callWorkerStreamBegin(D, StreamID id, RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:133
virtual void implRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &) override
Definition: WorkerT.cc:330
virtual void modulesDependentUpon(std::vector< const char * > &oModuleLabels) const override
Definition: WorkerT.h:104
long double T
WorkerT(std::shared_ptr< T >, ModuleDescription const &, ExceptionToActionTable const *actions)
Definition: WorkerT.cc:104
virtual void implPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) override
Definition: WorkerT.cc:321