LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
RPManager.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_RPManager_h
2 #define art_Framework_Core_RPManager_h
3 // RPManager
5 //
6 // Art-internal class to handle the creation and management of
7 // ResultsProducers.
8 //
10 
12 #include "cetlib/BasicPluginFactory.h"
13 #include "fhiclcpp/ParameterSet.h"
14 
15 #include <functional>
16 #include <map>
17 #include <string>
18 #include <vector>
19 
20 namespace art {
21  class RPManager;
22 }
23 
25 public:
26  using RPPath_t = std::vector<std::unique_ptr<art::RPWorker>>;
27  using RPMap_t = std::map<std::string, RPPath_t>;
28 
29  template <typename RET, typename... ARGS>
30  using invoke_function_t = RET (art::ResultsProducer::*)(ARGS...);
31 
32  using on_rpworker_t = std::function<void(art::RPWorker&)>;
33 
34  RPManager(fhicl::ParameterSet const& ps);
35 
36  std::size_t size() const;
37  bool empty() const;
38 
39  template <typename... ARGS>
40  void invoke(invoke_function_t<void, ARGS...> mfunc, ARGS&&... args);
41 
42  void for_each_RPWorker(on_rpworker_t wfunc);
43 
44 private:
45  cet::BasicPluginFactory pf_;
47  std::size_t size_;
48 
50 };
51 
52 inline std::size_t
54 {
55  return size_;
56 }
57 
58 inline bool
60 {
61  return size_ == 0ul;
62 }
63 
64 template <typename... ARGS>
65 void
67 {
68  for (auto& path : rpmap_) {
69  for (auto& w : path.second) {
70  (w->rp().*mfunc)(std::forward<ARGS>(args)...);
71  }
72  }
73 }
74 
75 void
77 {
78  for (auto& path : rpmap_) {
79  for (auto& w : path.second) {
80  wfunc(*w);
81  }
82  }
83 }
84 
85 #endif /* art_Framework_Core_RPManager_h */
86 
87 // Local Variables:
88 // mode: c++
89 // End:
std::size_t size() const
Definition: RPManager.h:53
std::function< void(art::RPWorker &)> on_rpworker_t
Definition: RPManager.h:32
RET(art::ResultsProducer::*)(ARGS...) invoke_function_t
Definition: RPManager.h:30
cet::BasicPluginFactory pf_
Definition: RPManager.h:45
void for_each_RPWorker(on_rpworker_t wfunc)
Definition: RPManager.h:76
std::map< std::string, RPPath_t > RPMap_t
Definition: RPManager.h:27
bool empty() const
Definition: RPManager.h:59
RPManager(fhicl::ParameterSet const &ps)
Definition: RPManager.cc:21
std::size_t size_
Definition: RPManager.h:47
void invoke(invoke_function_t< void, ARGS... > mfunc, ARGS &&...args)
Definition: RPManager.h:66
std::vector< std::unique_ptr< art::RPWorker >> RPPath_t
Definition: RPManager.h:26
HLT enums.
Float_t w
Definition: plot.C:23
RPMap_t rpmap_
Definition: RPManager.h:46
RPMap_t makeRPs_(fhicl::ParameterSet const &ps)
Definition: RPManager.cc:54