LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
WithProxyAsAuxStructBase.h
Go to the documentation of this file.
1 
11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_WITHPROXYASAUXSTRUCTBASE_H
12 #define LARDATA_RECOBASEPROXY_PROXYBASE_WITHPROXYASAUXSTRUCTBASE_H
13 
14 // LArSoft libraries
16 
17 // framework libraries
19 
20 // C/C++ standard
21 #include <tuple> // std::tuple_element_t<>, std::get(), ...
22 #include <utility> // std::forward(), std::move(), std::make_index_sequence()...
23 #include <type_traits> // std::is_convertible<>, std::decay_t<>, ...
24 #include <cstdlib> // std::size_t
25 
26 
27 namespace proxy {
28 
29  namespace details {
30 
34 
35  //--------------------------------------------------------------------------
53  template <
54  typename AuxProxy,
55  typename ArgTuple,
56  typename AuxTag = AuxProxy
57  >
59 
60  static_assert(
61  std::is_convertible
62  <std::decay_t<std::tuple_element_t<0U, ArgTuple>>, art::InputTag>(),
63  "The first argument of WithProxyAsAuxStructBase must be art::InputTag."
64  );
65 
67  template <typename CollProxy>
68  using main_t = typename CollProxy::main_element_t;
69 
71  using aux_proxy_t = AuxProxy;
72 
74  using tag = AuxTag;
75 
77  template <typename CollProxy>
78  using proxy_maker_t
80 
81  public:
82 
85  WithProxyAsAuxStructBase(ArgTuple&& args): args(std::move(args)) {}
86 
88  template
89  <typename CollProxy, typename Event, typename Handle, typename MainArgs>
91  (Event const& event, Handle&& mainHandle, MainArgs const& mainArgs)
92  {
93  return createAuxProxyImpl<CollProxy>(
94  event, std::forward<Handle>(mainHandle), mainArgs,
95  std::make_index_sequence<NArgs>()
96  );
97  } // construct()
98 
99 
100  protected:
101 
102  ArgTuple args;
103 
105  static constexpr std::size_t NArgs = std::tuple_size<ArgTuple>();
106 
107  // this method allows unpacking the arguments from the tuple
108  template<
109  typename CollProxy, typename Event, typename Handle, typename MainArgs,
110  std::size_t... I
111  >
113  Event const& event, Handle&& mainHandle, MainArgs const& mainArgs,
114  std::index_sequence<I...>
115  )
116  {
118  event, mainHandle, mainArgs,
119  std::get<I>(std::forward<ArgTuple>(args))...
120  );
121  }
122 
123  }; // struct WithProxyAsAuxStructBase
124 
125 
128 
129  } // namespace details
130 
131 } // namespace proxy
132 
133 
134 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_WITHPROXYASAUXSTRUCTBASE_H
AuxProxy aux_proxy_t
Type of auxiliary proxy.
static constexpr std::size_t NArgs
Number of arguments stored.
auto createAuxProxyMaker(Event const &event, Handle &&mainHandle, MainArgs const &mainArgs)
Creates the associated data proxy by means of ProxyAsAuxProxyMaker.
ArgTuple args
Argument construction storage as tuple.
STL namespace.
auto createAuxProxyImpl(Event const &event, Handle &&mainHandle, MainArgs const &mainArgs, std::index_sequence< I... >)
typename CollProxy::main_element_t main_t
Type of main data product element from a proxy of type CollProxy.
Creates an auxiliary proxy wrapper for the specified proxy.
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
Infrastructure for a collection proxy as auxiliary data for a proxy.
static auto make(Event const &event, Handle &&, MainArgs const &, art::InputTag const &auxProxyTag, AuxArgs &&...args)
Create a parallel data proxy collection using the specified tag.
Helper to create a proxy as auxiliary data for another proxy.
AuxTag tag
Tag for the associated data (same as the data type itself).
Event finding and building.