RPManager.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_RPManager_h
2 #define art_Framework_Core_RPManager_h
3 // vim: set sw=2 expandtab :
4 
9 
10 #include <functional>
11 #include <map>
12 #include <memory>
13 #include <string>
14 #include <utility>
15 #include <vector>
16 
17 namespace art {
18 
19  class RPManager {
20 
21  public:
22  template <typename RET, typename... ARGS>
23  using invoke_function_t = RET (ResultsProducer::*)(ARGS...);
24 
25  using on_rpworker_t = std::function<void(RPWorker&)>;
26 
27  public:
29 
30  public:
31  template <typename... ARGS>
32  void invoke(invoke_function_t<void, ARGS...> mfunc, ARGS&&... args);
33 
34  void for_each_RPWorker(on_rpworker_t wfunc);
35 
36  private:
37  // Maps path name to RPWorkers on that path.
38  std::map<std::string, std::vector<std::unique_ptr<RPWorker>>> rpmap_;
39  };
40 
41  template <typename... ARGS>
42  void
44  {
45  for (auto& path : rpmap_) {
46  for (auto& w : path.second) {
47  (w->rp().*mfunc)(std::forward<ARGS>(args)...);
48  }
49  }
50  }
51 
52 } // namespace art
53 
54 #endif /* art_Framework_Core_RPManager_h */
55 
56 // Local Variables:
57 // mode: c++
58 // End:
std::map< std::string, std::vector< std::unique_ptr< RPWorker > > > rpmap_
Definition: RPManager.h:38
std::function< void(RPWorker &)> on_rpworker_t
Definition: RPManager.h:25
static QCString args
Definition: declinfo.cpp:674
void for_each_RPWorker(on_rpworker_t wfunc)
Definition: RPManager.cc:114
RPManager(fhicl::ParameterSet const &ps)
Definition: RPManager.cc:21
static constexpr double ps
Definition: Units.h:99
void invoke(invoke_function_t< void, ARGS... > mfunc, ARGS &&...args)
Definition: RPManager.h:43
RET(ResultsProducer::*)(ARGS...) invoke_function_t
Definition: RPManager.h:23