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  EventPrincipal& ep,
127  ModuleCallingContext const* mcc) {
128  return true;
129  }
130 
131  template<>
132  inline
133  bool
135  EventPrincipal& ep,
136  ModuleCallingContext const* mcc) {
137  return module_->prePrefetchSelection(id,ep,mcc);
138  }
139 
140  template<>
141  inline
142  bool
144  EventPrincipal& ep,
145  ModuleCallingContext const* mcc) {
146  return module_->prePrefetchSelection(id,ep,mcc);
147  }
148 
149  template<typename T>
150  inline
151  bool
153  module_->doBeginRun(rp, c, mcc);
154  return true;
155  }
156 
157  template<typename T>
158  template<typename D>
159  void
161  EventSetup const& c,
162  ModuleCallingContext const* mcc) {
163  module_->doStreamBeginRun(id, rp, c, mcc);
164  }
165 
166  template<typename T>
167  template<typename D>
168  void
170  EventSetup const& c,
171  ModuleCallingContext const* mcc) {
172  module_->doStreamEndRun(id, rp, c, mcc);
173  }
174 
175 
176  template<typename T>
177  inline
178  bool
180  ModuleCallingContext const* mcc) {
183  workerimpl::DoNothing>::type might_call;
184  might_call(this,id,rp,c, mcc);
185  return true;
186  }
187 
188  template<typename T>
189  inline
190  bool
192  ModuleCallingContext const* mcc) {
195  workerimpl::DoNothing>::type might_call;
196  might_call(this,id,rp,c, mcc);
197  return true;
198  }
199 
200  template<typename T>
201  inline
202  bool
204  ModuleCallingContext const* mcc) {
205  module_->doEndRun(rp, c, mcc);
206  return true;
207  }
208 
209  template<typename T>
210  inline
211  bool
213  ModuleCallingContext const* mcc) {
214  module_->doBeginLuminosityBlock(lbp, c, mcc);
215  return true;
216  }
217 
218  template<typename T>
219  template<typename D>
220  void
222  EventSetup const& c,
223  ModuleCallingContext const* mcc) {
224  module_->doStreamBeginLuminosityBlock(id, rp, c, mcc);
225  }
226 
227  template<typename T>
228  template<typename D>
229  void
231  EventSetup const& c,
232  ModuleCallingContext const* mcc) {
233  module_->doStreamEndLuminosityBlock(id, rp, c, mcc);
234  }
235 
236 
237  template<typename T>
238  inline
239  bool
241  ModuleCallingContext const* mcc) {
244  workerimpl::DoNothing>::type might_call;
245  might_call(this,id,lbp,c, mcc);
246  return true;
247  }
248 
249  template<typename T>
250  inline
251  bool
253  ModuleCallingContext const* mcc) {
256  workerimpl::DoNothing>::type might_call;
257  might_call(this,id,lbp,c,mcc);
258 
259  return true;
260  }
261 
262  template<typename T>
263  inline
264  bool
266  ModuleCallingContext const* mcc) {
267  module_->doEndLuminosityBlock(lbp, c, mcc);
268  return true;
269  }
270 
271  template<typename T>
272  inline
275  return module_->workerType();
276  }
277 
278  template<typename T>
279  inline
280  void
282  module_->doBeginJob();
283  }
284 
285  template<typename T>
286  inline
287  void
289  module_->doEndJob();
290  }
291 
292  template<typename T>
293  template<typename D>
295  module_->doBeginStream(id);
296  }
297 
298  template<typename T>
299  inline
300  void
304  workerimpl::DoNothing>::type might_call;
305  might_call(this,id);
306  }
307 
308  template<typename T>
309  template<typename D>
311  module_->doEndStream(id);
312  }
313 
314  template<typename T>
315  inline
316  void
320  workerimpl::DoNothing>::type might_call;
321  might_call(this,id);
322  }
323 
324  template<typename T>
325  inline
326  void
328  module_->doRespondToOpenInputFile(fb);
329  }
330 
331  template<typename T>
332  inline
333  void
335  module_->doRespondToCloseInputFile(fb);
336  }
337 
338  template<typename T>
339  inline
340  void
342  module_->doPreForkReleaseResources();
343  }
344 
345  template<typename T>
346  inline
347  void
349  unsigned int iNumberOfChildren) {
350  module_->doPostForkReacquireResources(iChildIndex, iNumberOfChildren);
351  }
352 
353 
354  template<typename T>
355  inline
356  void
358  ThinnedAssociationsHelper& helper) {
359  module_->doRegisterThinnedAssociations(registry, helper);
360  }
361 
362  template<typename T>
364  ProductHolderIndexHelper const& iHelper) {
365  module_->updateLookup(iBranchType,iHelper);
366  }
367 
368  template<>
370  template<>
372  template<>
374  template<>
376  template<>
378  template<>
380  template<>
382  template<>
384 
385  template<>
387  template<>
389  template<>
391 
392 
393  template<>
395  template<>
397  template<>
399 
400  //Explicitly instantiate our needed templates to avoid having the compiler
401  // instantiate them in all of our libraries
402  template class WorkerT<EDProducer>;
403  template class WorkerT<EDFilter>;
404  template class WorkerT<EDAnalyzer>;
405  template class WorkerT<OutputModule>;
406  template class WorkerT<one::EDProducerBase>;
407  template class WorkerT<one::EDFilterBase>;
408  template class WorkerT<one::EDAnalyzerBase>;
409  template class WorkerT<one::OutputModuleBase>;
410  template class WorkerT<global::EDProducerBase>;
411  template class WorkerT<global::EDFilterBase>;
412  template class WorkerT<global::EDAnalyzerBase>;
416 }
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:288
void callWorkerStreamEnd(D, StreamID id, RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:169
virtual std::string workerType() const override
Definition: WorkerT.cc:274
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:152
virtual void updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &) override
Definition: WorkerT.cc:363
virtual ~WorkerT()
Definition: WorkerT.cc:111
#define constexpr
BranchType
Definition: BranchType.h:11
virtual void implRespondToOpenInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:327
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:179
void callWorkerEndStream(D, StreamID)
Definition: WorkerT.cc:310
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:301
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:317
virtual bool implDoPrePrefetchSelection(StreamID id, EventPrincipal &ep, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:125
virtual void implBeginJob() override
Definition: WorkerT.cc:281
virtual void implPreForkReleaseResources() override
Definition: WorkerT.cc:341
std::shared_ptr< UnscheduledHandler > unscheduledHandler() const
virtual bool implDoStreamEnd(StreamID id, RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:191
std::shared_ptr< T > module_
Definition: WorkerT.h:136
virtual void implRespondToCloseInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:334
void callWorkerBeginStream(D, StreamID)
Definition: WorkerT.cc:294
virtual bool implDoEnd(RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:203
void callWorkerStreamBegin(D, StreamID id, RunPrincipal &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:160
virtual void implRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &) override
Definition: WorkerT.cc:357
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:348