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 
22  UnscheduledHandler* getUnscheduledHandler(EventPrincipal const& ep);
23 
24  template<typename T>
25  class WorkerT : public Worker {
26  public:
27  typedef T ModuleType;
29  WorkerT(T*,
30  ModuleDescription const&,
32 
33  virtual ~WorkerT();
34 
35  void setModule( T* iModule) {
36  module_ = iModule;
37  resetModuleDescription(&(module_->moduleDescription()));
38  }
39 
40  virtual Types moduleType() const override;
41 
42  virtual void updateLookup(BranchType iBranchType,
43  ProductHolderIndexHelper const&) override;
44 
45 
46  template<typename D>
48  template<typename D>
50  template<typename D>
52  EventSetup const& c,
53  ModuleCallingContext const* mcc);
54  template<typename D>
56  EventSetup const& c,
57  ModuleCallingContext const* mcc);
58  template<typename D>
60  EventSetup const& c,
61  ModuleCallingContext const* mcc);
62  template<typename D>
64  EventSetup const& c,
65  ModuleCallingContext const* mcc);
66 
67  protected:
68  T& module() {return *module_;}
69  T const& module() const {return *module_;}
70 
71  private:
72  virtual bool implDo(EventPrincipal& ep, EventSetup const& c,
73  ModuleCallingContext const* mcc) override;
74  virtual bool implDoBegin(RunPrincipal& rp, EventSetup const& c,
75  ModuleCallingContext const* mcc) override;
76  virtual bool implDoStreamBegin(StreamID id, RunPrincipal& rp, EventSetup const& c,
77  ModuleCallingContext const* mcc) override;
78  virtual bool implDoStreamEnd(StreamID id, RunPrincipal& rp, EventSetup const& c,
79  ModuleCallingContext const* mcc) override;
80  virtual bool implDoEnd(RunPrincipal& rp, EventSetup const& c,
81  ModuleCallingContext const* mcc) override;
82  virtual bool implDoBegin(LuminosityBlockPrincipal& lbp, EventSetup const& c,
83  ModuleCallingContext const* mcc) override;
84  virtual bool implDoStreamBegin(StreamID id, LuminosityBlockPrincipal& lbp, EventSetup const& c,
85  ModuleCallingContext const* mcc) override;
86  virtual bool implDoStreamEnd(StreamID id, LuminosityBlockPrincipal& lbp, EventSetup const& c,
87  ModuleCallingContext const* mcc) override;
88  virtual bool implDoEnd(LuminosityBlockPrincipal& lbp, EventSetup const& c,
89  ModuleCallingContext const* mcc) override;
90  virtual void implBeginJob() override;
91  virtual void implEndJob() override;
92  virtual void implBeginStream(StreamID) override;
93  virtual void implEndStream(StreamID) override;
94  virtual void implRespondToOpenInputFile(FileBlock const& fb) override;
95  virtual void implRespondToCloseInputFile(FileBlock const& fb) override;
96  virtual void implPreForkReleaseResources() override;
97  virtual void implPostForkReacquireResources(unsigned int iChildIndex,
98  unsigned int iNumberOfChildren) override;
99  virtual std::string workerType() const override;
100 
101  virtual void modulesDependentUpon(std::vector<const char*>& oModuleLabels) const override {
102  module_->modulesDependentUpon(module_->moduleDescription().processName(),oModuleLabels);
103  }
104 
105  virtual void itemsToGet(BranchType branchType, std::vector<ProductHolderIndexAndSkipBit>& indexes) const override {
106  module_->itemsToGet(branchType, indexes);
107  }
108 
109  virtual void itemsMayGet(BranchType branchType, std::vector<ProductHolderIndexAndSkipBit>& indexes) const override {
110  module_->itemsMayGet(branchType, indexes);
111  }
112 
113  virtual std::vector<ProductHolderIndexAndSkipBit> const& itemsToGetFromEvent() const override { return module_->itemsToGetFromEvent(); }
114 
116  };
117 
118 }
119 
120 #endif
virtual bool implDo(EventPrincipal &ep, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:117
void resetModuleDescription(ModuleDescription const *)
Definition: Worker.cc:99
T * module_
Definition: WorkerT.h:115
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:113
void setModule(T *iModule)
Definition: WorkerT.h:35
T & module()
Definition: WorkerT.h:68
T const & module() const
Definition: WorkerT.h:69
virtual void itemsToGet(BranchType branchType, std::vector< ProductHolderIndexAndSkipBit > &indexes) const override
Definition: WorkerT.h:105
actions
Definition: Schedule.cc:369
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:327
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:109
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:27
WorkerT< T > WorkerType
Definition: WorkerT.h:28
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
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 modulesDependentUpon(std::vector< const char * > &oModuleLabels) const override
Definition: WorkerT.h:101
long double T
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
virtual void implPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) override
Definition: WorkerT.cc:321
WorkerT(T *, ModuleDescription const &, ExceptionToActionTable const *actions)
Definition: WorkerT.cc:104