CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
WorkerT.cc
Go to the documentation of this file.
3 
10 
11 namespace edm{
13  return ep.unscheduledHandler().get();
14  }
15 
16 
17  template<typename T>
18  inline
19  WorkerT<T>::WorkerT(std::unique_ptr<T>&& ed, ModuleDescription const& md, WorkerParams const& wp) :
20  Worker(md, wp),
21  module_(std::move(ed)) {
22  assert(module_.get() != 0);
23  module_->setModuleDescription(md);
24  module_->registerProductsAndCallbacks(module_.get(), wp.reg_);
25  }
26 
27  template<typename T>
29  }
30 
31  template<typename T>
32  inline
33  bool
36  boost::shared_ptr<Worker> sentry(this,[&ep](Worker* obj) {obj->postDoEvent(ep);});
37  return module_->doEvent(ep, c, cpc);
38  }
39 
40  template<typename T>
41  inline
42  bool
44  return false;
45  }
46 
47  template<typename T>
48  inline
49  bool
51  module_->doBeginRun(rp, c, cpc);
52  return true;
53  }
54 
55  template<typename T>
56  inline
57  bool
59  module_->doEndRun(rp, c, cpc);
60  return true;
61  }
62 
63  template<typename T>
64  inline
65  bool
67  module_->doBeginLuminosityBlock(lbp, c, cpc);
68  return true;
69  }
70 
71  template<typename T>
72  inline
73  bool
75  module_->doEndLuminosityBlock(lbp, c, cpc);
76  return true;
77  }
78 
79  template<typename T>
80  inline
83  return module_->workerType();
84  }
85 
86  template<typename T>
87  inline
88  void
90  module_->doBeginJob();
91  }
92 
93  template<typename T>
94  inline
95  void
97  module_->doEndJob();
98  }
99 
100  template<typename T>
101  inline
102  void
104  module_->doRespondToOpenInputFile(fb);
105  }
106 
107  template<typename T>
108  inline
109  void
111  module_->doRespondToCloseInputFile(fb);
112  }
113 
114  template<typename T>
115  inline
116  void
118  module_->doRespondToOpenOutputFiles(fb);
119  }
120 
121  template<typename T>
122  inline
123  void
125  module_->doRespondToCloseOutputFiles(fb);
126  }
127 
128  template<typename T>
129  inline
130  void
132  module_->doPreForkReleaseResources();
133  }
134 
135  template<typename T>
136  inline
137  void
139  unsigned int iNumberOfChildren) {
140  module_->doPostForkReacquireResources(iChildIndex, iNumberOfChildren);
141  }
142 
143  template<typename T>
145  ProductHolderIndexHelper const& iHelper) {
146  module_->updateLookup(iBranchType,iHelper);
147  }
148 
149  template<typename T>
150  void WorkerT<T>::setEventSelectionInfo(std::map<std::string, std::vector<std::pair<std::string, int> > > const& outputModulePathPositions,
151  bool anyProductProduced) {
152  //do nothing for the regular case
153  }
154 
155 
156  template<>
157  void WorkerT<OutputModule>::setEventSelectionInfo(std::map<std::string, std::vector<std::pair<std::string, int> > > const& outputModulePathPositions,
158  bool anyProductProduced) {
159  module_->setEventSelectionInfo(outputModulePathPositions, anyProductProduced);
160  }
161 
162  template<>
163  Worker::Types WorkerT<EDAnalyzer>::moduleType() const { return Worker::kAnalyzer;}
164  template<>
165  Worker::Types WorkerT<EDProducer>::moduleType() const { return Worker::kProducer;}
166  template<>
168  template<>
169  Worker::Types WorkerT<OutputModule>::moduleType() const { return Worker::kOutputModule;}
170  template<>
172  template<>
174 
175 
176  //Explicitly instantiate our needed templates to avoid having the compiler
177  // instantiate them in all of our libraries
178  template class WorkerT<EDProducer>;
179  template class WorkerT<EDFilter>;
180  template class WorkerT<EDAnalyzer>;
181  template class WorkerT<OutputModule>;
182  template class WorkerT<one::EDProducerBase>;
183  template class WorkerT<one::EDFilterBase>;
184 }
static const char module_[]
WorkerT(std::unique_ptr< T > &&, ModuleDescription const &, WorkerParams const &)
Definition: WorkerT.cc:19
std::unique_ptr< T > module_
Definition: WorkerT.h:81
virtual void implRespondToOpenOutputFiles(FileBlock const &fb) override
Definition: WorkerT.cc:117
virtual bool implDoEnd(EventPrincipal &ep, EventSetup const &c, CurrentProcessingContext const *cpc) override
Definition: WorkerT.cc:43
virtual void implEndJob() override
Definition: WorkerT.cc:96
virtual std::string workerType() const override
Definition: WorkerT.cc:82
virtual void updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &) override
Definition: WorkerT.cc:144
virtual ~WorkerT()
Definition: WorkerT.cc:28
BranchType
Definition: BranchType.h:11
dictionary map
Definition: Association.py:205
virtual void implRespondToOpenInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:103
boost::shared_ptr< UnscheduledHandler > unscheduledHandler() const
void setEventSelectionInfo(std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
Definition: WorkerT.cc:150
UnscheduledHandler * getUnscheduledHandler(EventPrincipal const &ep)
Definition: WorkerT.cc:12
ProductRegistry * reg_
Definition: WorkerParams.h:39
void postDoEvent(EventPrincipal &)
Definition: Worker.cc:125
virtual bool implDoBegin(EventPrincipal &ep, EventSetup const &c, CurrentProcessingContext const *cpc) override
Definition: WorkerT.cc:34
virtual void implBeginJob() override
Definition: WorkerT.cc:89
virtual void implPreForkReleaseResources() override
Definition: WorkerT.cc:131
virtual void implRespondToCloseInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:110
virtual void implRespondToCloseOutputFiles(FileBlock const &fb) override
Definition: WorkerT.cc:124
virtual void implPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) override
Definition: WorkerT.cc:138