LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
withParallelData.h
Go to the documentation of this file.
1 
11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_WITHPARALLELDATA_H
12 #define LARDATA_RECOBASEPROXY_PROXYBASE_WITHPARALLELDATA_H
13 
14 // LArSoft libraries
15 #include "larcorealg/CoreUtils/ContainerMeta.h" // util::collection_value_t, ...
18 
19 // C/C++ standard
20 #include <tuple>
21 #include <utility> // std::forward(), std::move()
22 
23 namespace proxy {
24 
25  //----------------------------------------------------------------------------
26  namespace details {
27 
28  template <typename Aux, typename ArgTuple, typename AuxTag = Aux>
30  WithAssociatedStructBase<Aux,
31  void, // no metadata concept for parallel collections
32  ArgTuple,
33  ParallelDataProxyMakerWrapper<Aux, AuxTag>::template maker_t,
34  AuxTag>;
35 
36  template <typename Aux, typename ArgTuple, typename AuxColl, typename AuxTag = Aux>
38  Aux,
39  void, // no metadata concept for parallel collections
40  ArgTuple,
42  AuxTag>;
43 
44  } // namespace details
45 
46  // --- BEGIN Parallel data collections ---------------------------------------
67  //----------------------------------------------------------------------------
88  template <typename Aux, typename AuxTag, typename... Args>
89  auto withParallelDataAs(Args&&... args)
90  {
91  using ArgTuple_t = std::tuple<Args&&...>;
92  ArgTuple_t argsTuple(std::forward<Args>(args)...);
94  } // withParallelDataAs()
95 
96  //----------------------------------------------------------------------------
174  template <typename Aux, typename... Args>
175  auto withParallelData(Args&&... args)
176  {
177  return withParallelDataAs<Aux, Aux>(std::forward<Args>(args)...);
178  }
179 
180  //----------------------------------------------------------------------------
226  template <typename AuxTag, typename AuxColl>
227  auto wrapParallelDataAs(AuxColl const& auxColl)
228  {
229  std::tuple<AuxColl const&> args = {auxColl};
231  decltype(args),
232  AuxColl,
233  AuxTag>(std::move(args));
234  } // wrapParallelDataAs()
235 
255  template <typename AuxColl>
256  auto wrapParallelData(AuxColl const& auxColl)
257  {
258  return wrapParallelDataAs<util::collection_value_t<AuxColl>>(auxColl);
259  }
260 
262  // --- END Parallel data collections -----------------------------------------
263 
264 } // namespace proxy
265 
266 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_WITHPARALLELDATA_H
Helper to create associated data proxy.
WithAssociatedStructBase< Aux, void, ArgTuple, ParallelDataProxyMakerWrapper< Aux, AuxTag >::template maker_t, AuxTag > WithParallelCollectionStruct
auto wrapParallelDataAs(AuxColl const &auxColl)
Uses a collection as auxiliary data for a collection proxy.
auto withParallelData(Args &&...args)
Helper function to merge an auxiliary data product into the proxy.
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
Infrastructure for the addition of parallel data to a proxy.
auto wrapParallelData(AuxColl const &auxColl)
Uses a collection as auxiliary data for a collection proxy.
C++ metaprogramming utilities for dealing with containers.
auto withParallelDataAs(Args &&...args)
Helper function to merge an auxiliary data product into the proxy.
Template class to declare addition of associated data to a proxy.