MockRun.h
Go to the documentation of this file.
1 #ifndef canvas_test_Persistency_Common_MockRun_h
2 #define canvas_test_Persistency_Common_MockRun_h
3 
5 
6 #include <memory>
7 #include <utility>
8 #include <vector>
9 
10 namespace arttest {
11 
12  class MockRun {
13  public:
14  template <typename T, typename... ARGS>
15  void
16  put(ARGS&&... args)
17  {
18  auto prod = std::make_unique<T>(std::forward<ARGS>(args)...);
19  products_.push_back(new art::Wrapper<T>(std::move(prod)));
20  }
21 
22  template <typename T>
23  T
24  get() const
25  {
26  // Retrieve and aggregate the products
27  auto result = static_cast<art::Wrapper<T>&>(*products_[0]);
28  for (auto it = products_.cbegin() + 1, e = products_.cend(); it != e;
29  ++it) {
30  result.combine(*it);
31  }
32  return *result.product();
33  }
34 
35  private:
36  std::vector<art::EDProduct*> products_;
37  };
38 }
39 
40 #endif /* canvas_test_Persistency_Common_MockRun_h */
41 
42 // Local variables:
43 // mode: c++
44 // End:
static QCString result
static QCString args
Definition: declinfo.cpp:674
const double e
def move(depos, offset)
Definition: depos.py:107
void put(ARGS &&...args)
Definition: MockRun.h:16
std::vector< art::EDProduct * > products_
Definition: MockRun.h:36