LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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
17 #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 
24 namespace proxy {
25 
26 
27  //----------------------------------------------------------------------------
28  namespace details {
29 
30  template <typename Aux, typename ArgTuple, typename AuxTag = Aux>
31  using WithParallelCollectionStruct = WithAssociatedStructBase<
32  Aux,
33  void, // no metadata concept for parallel collections
34  ArgTuple,
35  ParallelDataProxyMakerWrapper<Aux, AuxTag>::template maker_t,
36  AuxTag
37  >;
38 
39 
40  template
41  <typename Aux, typename ArgTuple, typename AuxColl, typename AuxTag = Aux>
43  Aux,
44  void, // no metadata concept for parallel collections
45  ArgTuple,
47  AuxTag
48  >;
49 
50  } // namespace details
51 
52 
53  // --- BEGIN Parallel data collections ---------------------------------------
74  //----------------------------------------------------------------------------
95  template <typename Aux, typename AuxTag, typename... Args>
96  auto withParallelDataAs(Args&&... args) {
97  using ArgTuple_t = std::tuple<Args&&...>;
98  ArgTuple_t argsTuple(std::forward<Args>(args)...);
100  (std::move(argsTuple));
101  } // withParallelDataAs()
102 
103  //----------------------------------------------------------------------------
181  template <typename Aux, typename... Args>
182  auto withParallelData(Args&&... args)
183  { return withParallelDataAs<Aux, Aux>(std::forward<Args>(args)...); }
184 
185 
186  //----------------------------------------------------------------------------
232  template <typename AuxTag, typename AuxColl>
233  auto wrapParallelDataAs(AuxColl const& auxColl) {
234  std::tuple<AuxColl const&> args = { auxColl };
236  <util::collection_value_t<AuxColl>, decltype(args), AuxColl, AuxTag>
237  (std::move(args));
238  } // wrapParallelDataAs()
239 
240 
260  template <typename AuxColl>
261  auto wrapParallelData(AuxColl const& auxColl)
262  { return wrapParallelDataAs<util::collection_value_t<AuxColl>>(auxColl); }
263 
264 
266  // --- END Parallel data collections -----------------------------------------
267 
268 } // namespace proxy
269 
270 
271 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_WITHPARALLELDATA_H
Helper to create associated data proxy.
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.
WithAssociatedStructBase< Aux, void, ArgTuple, ParallelDataProxyMakerWrapper< Aux, AuxTag >::template maker_t, AuxTag > WithParallelCollectionStruct
auto wrapParallelData(AuxColl const &auxColl)
Uses a collection as auxiliary data for a collection proxy.
typename collection_value_type< Coll >::type collection_value_t
Type contained in the collection Coll.
Definition: ContainerMeta.h:65
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.