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 
8 
9 #include <functional>
10 #include <map>
11 #include <memory>
12 #include <string>
13 #include <vector>
14 
15 namespace art {
16 
17  class RPManager {
18 
19  public:
20  template <typename RET, typename... ARGS>
21  using invoke_function_t = RET (ResultsProducer::*)(ARGS...);
22 
23  using on_rpworker_t = std::function<void(RPWorker&)>;
24 
25  public:
27 
28  public:
29  template <typename... ARGS>
30  void invoke(invoke_function_t<void, ARGS...> mfunc, ARGS&&... args);
31 
32  void for_each_RPWorker(on_rpworker_t wfunc);
33 
34  private:
35  // Maps path name to RPWorkers on that path.
36  std::map<std::string, std::vector<std::unique_ptr<RPWorker>>> rpmap_;
37  };
38 
39  template <typename... ARGS>
40  void
42  {
43  for (auto& path : rpmap_) {
44  for (auto& w : path.second) {
45  (w->rp().*mfunc)(std::forward<ARGS>(args)...);
46  }
47  }
48  }
49 
50 } // namespace art
51 
52 #endif /* art_Framework_Core_RPManager_h */
53 
54 // Local Variables:
55 // mode: c++
56 // End:
std::map< std::string, std::vector< std::unique_ptr< RPWorker > > > rpmap_
Definition: RPManager.h:36
std::function< void(RPWorker &)> on_rpworker_t
Definition: RPManager.h:23
void for_each_RPWorker(on_rpworker_t wfunc)
RPManager(fhicl::ParameterSet const &ps)
void invoke(invoke_function_t< void, ARGS... > mfunc, ARGS &&...args)
Definition: RPManager.h:41
const std::string path
Definition: plot_BEN.C:43
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
Float_t w
Definition: plot.C:20
RET(ResultsProducer::*)(ARGS...) invoke_function_t
Definition: RPManager.h:21