CMS 3D CMS Logo

UnscheduledCallProducer.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_UnscheduledCallProducer_h
2 #define FWCore_Framework_UnscheduledCallProducer_h
3 
4 // -*- C++ -*-
5 //
6 // Package: FWCore/Framework
7 // Class : UnscheduledCallProducer
8 //
25 
26 #include <vector>
27 #include <unordered_map>
28 #include <string>
29 #include <sstream>
30 
31 namespace edm {
32 
33  class ModuleCallingContext;
34 
36  public:
37 
38  using worker_container = std::vector<Worker*>;
39  using const_iterator = worker_container::const_iterator;
40 
44  }
45  void addWorker(Worker* aWorker) {
46  assert(nullptr != aWorker);
47  unscheduledWorkers_.push_back(aWorker);
48  }
49 
50  void setEventSetup(EventSetup const& iSetup) {
51  aux_.setEventSetup(&iSetup);
52  }
53 
54  UnscheduledAuxiliary const& auxiliary() const { return aux_; }
55 
56  const_iterator begin() const { return unscheduledWorkers_.begin(); }
57  const_iterator end() const { return unscheduledWorkers_.end(); }
58 
59  template <typename T, typename U>
61  typename T::MyPrincipal& p, EventSetup const& es, StreamID streamID,
62  typename T::Context const* topContext, U const* context) const {
63  //do nothing for event since we will run when requested
64  if(!T::isEvent_) {
65  for(auto worker: unscheduledWorkers_) {
66  ParentContext parentContext(context);
67  worker->doWorkNoPrefetchingAsync<T>(task, p, es, streamID, parentContext, topContext);
68  }
69  }
70  }
71 
72 
73  private:
74  template <typename T, typename ID>
75  void addContextToException(cms::Exception& ex, Worker const* worker, ID const& id) const {
76  std::ostringstream ost;
77  ost << "Processing " << T::transitionName()<<" "<< id;
78  ex.addContext(ost.str());
79  }
82  };
83 
84 }
85 
86 #endif
87 
PostModuleEventDelayedGet postModuleEventDelayedGetSignal_
PreModuleEventDelayedGet preModuleEventDelayedGetSignal_
UnscheduledCallProducer(ActivityRegistry &iReg)
uint32_t ID
Definition: Definitions.h:26
std::vector< Worker * > worker_container
void runNowAsync(WaitingTask *task, typename T::MyPrincipal &p, EventSetup const &es, StreamID streamID, typename T::Context const *topContext, U const *context) const
void addContextToException(cms::Exception &ex, Worker const *worker, ID const &id) const
UnscheduledAuxiliary const & auxiliary() const
void addContext(std::string const &context)
Definition: Exception.cc:227
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> preModuleDelayedGetSignal_
HLT enums.
void setEventSetup(EventSetup const *iSetup)
void setEventSetup(EventSetup const &iSetup)
worker_container::const_iterator const_iterator
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> postModuleDelayedGetSignal_
long double T
void connect(U iFunc)
Definition: Signal.h:63