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 
18 
22 
23 namespace edm{
24  namespace workerimpl {
25  template<typename T>
27  static bool constexpr value = false;
28  };
29 
30  template<>
32  static bool constexpr value = true;
33  };
34 
35  template<>
37  static bool constexpr value = true;
38  };
39 
40  template<>
42  static bool constexpr value = true;
43  };
44 
45  template<>
47  static bool constexpr value = true;
48  };
49 
50  template<>
52  static bool constexpr value = true;
53  };
54 
55  template<>
57  static bool constexpr value = true;
58  };
59 
60  struct DoNothing {
61  template< typename... T>
62  inline void operator()(const T&...) {}
63  };
64 
65  template<typename T>
66  struct DoBeginStream {
67  inline void operator()(WorkerT<T>* iWorker, StreamID id) {
68  iWorker->callWorkerBeginStream(0,id);
69  }
70  };
71 
72  template<typename T>
73  struct DoEndStream {
74  inline void operator()(WorkerT<T>* iWorker, StreamID id) {
75  iWorker->callWorkerEndStream(0,id);
76  }
77  };
78 
79  template<typename T, typename P>
81  inline void operator() (WorkerT<T>* iWorker, StreamID id, P const& rp,
82  EventSetup const& c,
83  ModuleCallingContext const* mcc) {
84  iWorker->callWorkerStreamBegin(0,id,rp,c, mcc);
85  }
86  };
87 
88  template<typename T, typename P>
90  inline void operator() (WorkerT<T>* iWorker, StreamID id, P const& rp,
91  EventSetup const& c,
92  ModuleCallingContext const* mcc) {
93  iWorker->callWorkerStreamEnd(0,id,rp,c, mcc);
94  }
95  };
96  }
97 
99  return ep.unscheduledHandler().get();
100  }
101 
102 
103  template<typename T>
104  inline
105  WorkerT<T>::WorkerT(std::shared_ptr<T> ed, ModuleDescription const& md, ExceptionToActionTable const* actions) :
106  Worker(md, actions),
107  module_(ed) {
108  assert(module_ != 0);
109  }
110 
111  template<typename T>
113  }
114 
115  template<typename T>
116  inline
117  bool
119  std::shared_ptr<Worker> sentry(this,[&ep](Worker* obj) {obj->postDoEvent(ep);});
120  return module_->doEvent(ep, c, activityRegistry(), mcc);
121  }
122 
123  template<typename T>
124  inline
125  bool
127  EventPrincipal const& ep,
128  ModuleCallingContext const* mcc) {
129  return true;
130  }
131 
132  template<>
133  inline
134  bool
136  EventPrincipal const& ep,
137  ModuleCallingContext const* mcc) {
138  return module_->prePrefetchSelection(id,ep,mcc);
139  }
140 
141  template<>
142  inline
143  bool
145  EventPrincipal const& ep,
146  ModuleCallingContext const* mcc) {
147  return module_->prePrefetchSelection(id,ep,mcc);
148  }
149 
150  template<>
151  inline
152  bool
154  EventPrincipal const& ep,
155  ModuleCallingContext const* mcc) {
156  return module_->prePrefetchSelection(id,ep,mcc);
157  }
158 
159  template<typename T>
160  inline
161  bool
163  module_->doBeginRun(rp, c, mcc);
164  return true;
165  }
166 
167  template<typename T>
168  template<typename D>
169  void
171  EventSetup const& c,
172  ModuleCallingContext const* mcc) {
173  module_->doStreamBeginRun(id, rp, c, mcc);
174  }
175 
176  template<typename T>
177  template<typename D>
178  void
180  EventSetup const& c,
181  ModuleCallingContext const* mcc) {
182  module_->doStreamEndRun(id, rp, c, mcc);
183  }
184 
185 
186  template<typename T>
187  inline
188  bool
190  ModuleCallingContext const* mcc) {
193  workerimpl::DoNothing>::type might_call;
194  might_call(this,id,rp,c, mcc);
195  return true;
196  }
197 
198  template<typename T>
199  inline
200  bool
202  ModuleCallingContext const* mcc) {
205  workerimpl::DoNothing>::type might_call;
206  might_call(this,id,rp,c, mcc);
207  return true;
208  }
209 
210  template<typename T>
211  inline
212  bool
214  ModuleCallingContext const* mcc) {
215  module_->doEndRun(rp, c, mcc);
216  return true;
217  }
218 
219  template<typename T>
220  inline
221  bool
223  ModuleCallingContext const* mcc) {
224  module_->doBeginLuminosityBlock(lbp, c, mcc);
225  return true;
226  }
227 
228  template<typename T>
229  template<typename D>
230  void
232  EventSetup const& c,
233  ModuleCallingContext const* mcc) {
234  module_->doStreamBeginLuminosityBlock(id, rp, c, mcc);
235  }
236 
237  template<typename T>
238  template<typename D>
239  void
241  EventSetup const& c,
242  ModuleCallingContext const* mcc) {
243  module_->doStreamEndLuminosityBlock(id, rp, c, mcc);
244  }
245 
246 
247  template<typename T>
248  inline
249  bool
251  ModuleCallingContext const* mcc) {
254  workerimpl::DoNothing>::type might_call;
255  might_call(this,id,lbp,c, mcc);
256  return true;
257  }
258 
259  template<typename T>
260  inline
261  bool
263  ModuleCallingContext const* mcc) {
266  workerimpl::DoNothing>::type might_call;
267  might_call(this,id,lbp,c,mcc);
268 
269  return true;
270  }
271 
272  template<typename T>
273  inline
274  bool
276  ModuleCallingContext const* mcc) {
277  module_->doEndLuminosityBlock(lbp, c, mcc);
278  return true;
279  }
280 
281  template<typename T>
282  inline
285  return module_->workerType();
286  }
287 
288  template<typename T>
289  inline
290  void
292  module_->doBeginJob();
293  }
294 
295  template<typename T>
296  inline
297  void
299  module_->doEndJob();
300  }
301 
302  template<typename T>
303  template<typename D>
305  module_->doBeginStream(id);
306  }
307 
308  template<typename T>
309  inline
310  void
314  workerimpl::DoNothing>::type might_call;
315  might_call(this,id);
316  }
317 
318  template<typename T>
319  template<typename D>
321  module_->doEndStream(id);
322  }
323 
324  template<typename T>
325  inline
326  void
330  workerimpl::DoNothing>::type might_call;
331  might_call(this,id);
332  }
333 
334  template<typename T>
335  inline
336  void
338  module_->doRespondToOpenInputFile(fb);
339  }
340 
341  template<typename T>
342  inline
343  void
345  module_->doRespondToCloseInputFile(fb);
346  }
347 
348  template<typename T>
349  inline
350  void
352  module_->doPreForkReleaseResources();
353  }
354 
355  template<typename T>
356  inline
357  void
359  unsigned int iNumberOfChildren) {
360  module_->doPostForkReacquireResources(iChildIndex, iNumberOfChildren);
361  }
362 
363 
364  template<typename T>
365  inline
366  void
368  ThinnedAssociationsHelper& helper) {
369  module_->doRegisterThinnedAssociations(registry, helper);
370  }
371 
372  template<typename T>
374  ProductHolderIndexHelper const& iHelper) {
375  module_->updateLookup(iBranchType,iHelper);
376  }
377 
378  template<>
380  template<>
382  template<>
384  template<>
386  template<>
388  template<>
390  template<>
392  template<>
394 
395  template<>
397  template<>
399  template<>
401  template<>
403 
404 
405  template<>
407  template<>
409  template<>
411 
412  //Explicitly instantiate our needed templates to avoid having the compiler
413  // instantiate them in all of our libraries
414  template class WorkerT<EDProducer>;
415  template class WorkerT<EDFilter>;
416  template class WorkerT<EDAnalyzer>;
417  template class WorkerT<OutputModule>;
418  template class WorkerT<one::EDProducerBase>;
419  template class WorkerT<one::EDFilterBase>;
420  template class WorkerT<one::EDAnalyzerBase>;
421  template class WorkerT<one::OutputModuleBase>;
422  template class WorkerT<global::EDProducerBase>;
423  template class WorkerT<global::EDFilterBase>;
424  template class WorkerT<global::EDAnalyzerBase>;
425  template class WorkerT<global::OutputModuleBase>;
429 }
virtual bool implDoStreamEnd(StreamID id, RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:201
static const char module_[]
type
Definition: HCALResponse.h:21
void callWorkerStreamEnd(D, StreamID id, RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:179
virtual Types moduleType() const override
void operator()(WorkerT< T > *iWorker, StreamID id, P const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:90
virtual void implEndJob() override
Definition: WorkerT.cc:298
virtual std::string workerType() const override
Definition: WorkerT.cc:284
assert(m_qm.get())
#define P
virtual bool implDoStreamBegin(StreamID id, RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:189
virtual bool implDo(EventPrincipal const &ep, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:118
actions
Definition: Schedule.cc:374
virtual void updateLookup(BranchType iBranchType, ProductHolderIndexHelper const &) override
Definition: WorkerT.cc:373
virtual ~WorkerT()
Definition: WorkerT.cc:112
#define constexpr
BranchType
Definition: BranchType.h:11
edm::propagate_const< std::shared_ptr< T > > module_
Definition: WorkerT.h:137
virtual void implRespondToOpenInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:337
std::shared_ptr< const UnscheduledHandler > unscheduledHandler() const
virtual bool implDoPrePrefetchSelection(StreamID id, EventPrincipal const &ep, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:126
void callWorkerEndStream(D, StreamID)
Definition: WorkerT.cc:320
void operator()(WorkerT< T > *iWorker, StreamID id)
Definition: WorkerT.cc:67
void operator()(const T &...)
Definition: WorkerT.cc:62
virtual void implBeginStream(StreamID) override
Definition: WorkerT.cc:311
void operator()(WorkerT< T > *iWorker, StreamID id, P const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:81
void operator()(WorkerT< T > *iWorker, StreamID id)
Definition: WorkerT.cc:74
void callWorkerStreamBegin(D, StreamID id, RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc)
Definition: WorkerT.cc:170
virtual bool implDoBegin(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:162
UnscheduledHandler const * getUnscheduledHandler(EventPrincipal const &ep)
Definition: WorkerT.cc:98
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
virtual void implEndStream(StreamID) override
Definition: WorkerT.cc:327
virtual void implBeginJob() override
Definition: WorkerT.cc:291
virtual void implPreForkReleaseResources() override
Definition: WorkerT.cc:351
virtual void implRespondToCloseInputFile(FileBlock const &fb) override
Definition: WorkerT.cc:344
void callWorkerBeginStream(D, StreamID)
Definition: WorkerT.cc:304
void postDoEvent(EventPrincipal const &)
Definition: Worker.cc:189
virtual void implRegisterThinnedAssociations(ProductRegistry const &, ThinnedAssociationsHelper &) override
Definition: WorkerT.cc:367
virtual bool implDoEnd(RunPrincipal const &rp, EventSetup const &c, ModuleCallingContext const *mcc) override
Definition: WorkerT.cc:213
static Interceptor::Registry registry("Interceptor")
long double T
WorkerT(std::shared_ptr< T >, ModuleDescription const &, ExceptionToActionTable const *actions)
Definition: WorkerT.cc:105
virtual void implPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) override
Definition: WorkerT.cc:358