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.
1 #include "boost/mpl/if.hpp"
2 
5 
17 
21 
22 namespace edm{
23  namespace workerimpl {
24  template<typename T>
26  static bool constexpr value = false;
27  };
28 
29  template<>
31  static bool constexpr value = true;
32  };
33 
34  template<>
36  static bool constexpr value = true;
37  };
38 
39  template<>
41  static bool constexpr value = true;
42  };
43 
44  template<>
46  static bool constexpr value = true;
47  };
48 
49  template<>
51  static bool constexpr value = true;
52  };
53 
54  template<>
56  static bool constexpr value = true;
57  };
58 
59  struct DoNothing {
60  template< typename... T>
61  inline void operator()(const T&...) {}
62  };
63 
64  template<typename T>
65  struct DoBeginStream {
66  inline void operator()(WorkerT<T>* iWorker, StreamID id) {
67  iWorker->callWorkerBeginStream(0,id);
68  }
69  };
70 
71  template<typename T>
72  struct DoEndStream {
73  inline void operator()(WorkerT<T>* iWorker, StreamID id) {
74  iWorker->callWorkerEndStream(0,id);
75  }
76  };
77 
78  template<typename T, typename P>
80  inline void operator() (WorkerT<T>* iWorker, StreamID id, P& rp,
81  EventSetup const& c,
82  ModuleCallingContext const* mcc) {
83  iWorker->callWorkerStreamBegin(0,id,rp,c, mcc);
84  }
85  };
86 
87  template<typename T, typename P>
89  inline void operator() (WorkerT<T>* iWorker, StreamID id, P& rp,
90  EventSetup const& c,
91  ModuleCallingContext const* mcc) {
92  iWorker->callWorkerStreamEnd(0,id,rp,c, mcc);
93  }
94  };
95  }
96 
98  return ep.unscheduledHandler().get();
99  }
100 
101 
102  template<typename T>
103  inline
104  WorkerT<T>::WorkerT(std::shared_ptr<T> ed, ModuleDescription const& md, ExceptionToActionTable const* actions) :
105  Worker(md, actions),
106  module_(ed) {
107  assert(module_ != 0);
108  }
109 
110  template<typename T>
112  }
113 
114  template<typename T>
115  inline
116  bool
118  std::shared_ptr<Worker> sentry(this,[&ep](Worker* obj) {obj->postDoEvent(ep);});
119  return module_->doEvent(ep, c, activityRegistry(), mcc);
120  }
121 
122  template<typename T>
123  inline
124  bool
126  module_->doBeginRun(rp, c, mcc);
127  return true;
128  }
129 
130  template<typename T>
131  template<typename D>
132  void
134  EventSetup const& c,
135  ModuleCallingContext const* mcc) {
136  module_->doStreamBeginRun(id, rp, c, mcc);
137  }
138 
139  template<typename T>
140  template<typename D>
141  void
143  EventSetup const& c,
144  ModuleCallingContext const* mcc) {
145  module_->doStreamEndRun(id, rp, c, mcc);
146  }
147 
148 
149  template<typename T>
150  inline
151  bool
153  ModuleCallingContext const* mcc) {
156  workerimpl::DoNothing>::type might_call;
157  might_call(this,id,rp,c, mcc);
158  return true;
159  }
160 
161  template<typename T>
162  inline
163  bool
165  ModuleCallingContext const* mcc) {
168  workerimpl::DoNothing>::type might_call;
169  might_call(this,id,rp,c, mcc);
170  return true;
171  }
172 
173  template<typename T>
174  inline
175  bool
177  ModuleCallingContext const* mcc) {
178  module_->doEndRun(rp, c, mcc);
179  return true;
180  }
181 
182  template<typename T>
183  inline
184  bool
186  ModuleCallingContext const* mcc) {
187  module_->doBeginLuminosityBlock(lbp, c, mcc);
188  return true;
189  }
190 
191  template<typename T>
192  template<typename D>
193  void
195  EventSetup const& c,
196  ModuleCallingContext const* mcc) {
197  module_->doStreamBeginLuminosityBlock(id, rp, c, mcc);
198  }
199 
200  template<typename T>
201  template<typename D>
202  void
204  EventSetup const& c,
205  ModuleCallingContext const* mcc) {
206  module_->doStreamEndLuminosityBlock(id, rp, c, mcc);
207  }
208 
209 
210  template<typename T>
211  inline
212  bool
214  ModuleCallingContext const* mcc) {
217  workerimpl::DoNothing>::type might_call;
218  might_call(this,id,lbp,c, mcc);
219  return true;
220  }
221 
222  template<typename T>
223  inline
224  bool
226  ModuleCallingContext const* mcc) {
229  workerimpl::DoNothing>::type might_call;
230  might_call(this,id,lbp,c,mcc);
231 
232  return true;
233  }
234 
235  template<typename T>
236  inline
237  bool
239  ModuleCallingContext const* mcc) {
240  module_->doEndLuminosityBlock(lbp, c, mcc);
241  return true;
242  }
243 
244  template<typename T>
245  inline
248  return module_->workerType();
249  }
250 
251  template<typename T>
252  inline
253  void
255  module_->doBeginJob();
256  }
257 
258  template<typename T>
259  inline
260  void
262  module_->doEndJob();
263  }
264 
265  template<typename T>
266  template<typename D>
268  module_->doBeginStream(id);
269  }
270 
271  template<typename T>
272  inline
273  void
277  workerimpl::DoNothing>::type might_call;
278  might_call(this,id);
279  }
280 
281  template<typename T>
282  template<typename D>
284  module_->doEndStream(id);
285  }
286 
287  template<typename T>
288  inline
289  void
293  workerimpl::DoNothing>::type might_call;
294  might_call(this,id);
295  }
296 
297  template<typename T>
298  inline
299  void
301  module_->doRespondToOpenInputFile(fb);
302  }
303 
304  template<typename T>
305  inline
306  void
308  module_->doRespondToCloseInputFile(fb);
309  }
310 
311  template<typename T>
312  inline
313  void
315  module_->doPreForkReleaseResources();
316  }
317 
318  template<typename T>
319  inline
320  void
322  unsigned int iNumberOfChildren) {
323  module_->doPostForkReacquireResources(iChildIndex, iNumberOfChildren);
324  }
325 
326 
327  template<typename T>
328  inline
329  void
331  ThinnedAssociationsHelper& helper) {
332  module_->doRegisterThinnedAssociations(registry, helper);
333  }
334 
335  template<typename T>
337  ProductHolderIndexHelper const& iHelper) {
338  module_->updateLookup(iBranchType,iHelper);
339  }
340 
341  template<>
343  template<>
345  template<>
347  template<>
349  template<>
351  template<>
353  template<>
355  template<>
357 
358  template<>
360  template<>
362  template<>
364 
365 
366  template<>
368  template<>
370  template<>
372 
373  //Explicitly instantiate our needed templates to avoid having the compiler
374  // instantiate them in all of our libraries
375  template class WorkerT<EDProducer>;
376  template class WorkerT<EDFilter>;
377  template class WorkerT<EDAnalyzer>;
378  template class WorkerT<OutputModule>;
379  template class WorkerT<one::EDProducerBase>;
380  template class WorkerT<one::EDFilterBase>;
381  template class WorkerT<one::EDAnalyzerBase>;
382  template class WorkerT<one::OutputModuleBase>;
383  template class WorkerT<global::EDProducerBase>;
384  template class WorkerT<global::EDFilterBase>;
385  template class WorkerT<global::EDAnalyzerBase>;
389 }
static const char module_[]
type
Definition: HCALResponse.h:21
virtual bool implDo(EventPrincipal &ep, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:117
void operator()(WorkerT< T > *iWorker, StreamID id, P &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:80
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
assert(m_qm.get())
#define P
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
#define constexpr
BranchType
Definition: BranchType.h:11
virtual void implRespondToOpenInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:300
void operator()(WorkerT< T > *iWorker, StreamID id, P &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:89
virtual bool implDoStreamBegin(StreamID id, RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:152
void callWorkerEndStream(D, StreamID)
Definition: WorkerT.cc:283
void operator()(WorkerT< T > *iWorker, StreamID id)
Definition: WorkerT.cc:66
void operator()(const T &...)
Definition: WorkerT.cc:61
virtual void implBeginStream(StreamID) override
Definition: WorkerT.cc:274
UnscheduledHandler * getUnscheduledHandler(EventPrincipal const &ep)
Definition: WorkerT.cc:97
void operator()(WorkerT< T > *iWorker, StreamID id)
Definition: WorkerT.cc:73
void postDoEvent(EventPrincipal &)
Definition: Worker.cc:189
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
std::shared_ptr< UnscheduledHandler > unscheduledHandler() const
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:133
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
static Interceptor::Registry registry("Interceptor")
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