ProxyAsParallelData.h
Go to the documentation of this file.
1 /**
2  * @file lardata/RecoBaseProxy/ProxyBase/ProxyAsParallelData.h
3  * @brief Data encapsulating a collection proxy as auxiliary data.
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date July 27, 2017
6  * @see lardata/RecoBaseProxy/ProxyBase/withCollectionProxy.h
7  *
8  * This library is header-only.
9  */
10 
11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_PROXYASPARALLELDATA_H
12 #define LARDATA_RECOBASEPROXY_PROXYBASE_PROXYASPARALLELDATA_H
13 
14 
15 // LArSoft libraries
17 #include "larcorealg/CoreUtils/ContainerMeta.h" // util::collection_value_t, ...
18 
19 // C/C++ standard
20 #include <utility> // std::move()
21 
22 
23 namespace proxy {
24 
25  namespace details {
26 
27  template <
28  typename AuxProxyColl,
30  typename Tag = Aux
31  >
33 
34  } // namespace details
35 
36 
37  // --- BEGIN Infrastructure for proxies as auxiliary data --------------------
38  /**
39  * @defgroup LArSoftProxiesAuxProxy Infrastructure for proxies as auxiliary
40  * data.
41  * @ingroup LArSoftProxyCustom
42  * @brief Infrastructure to use a collection proxy as auxiliary data for
43  * another proxy.
44  * @bug Broken in many ways. Do not use.
45  *
46  * @{
47  */
48 
49  template <
50  typename Tag /* = Aux */,
51  typename Aux /* = util::collection_value_t<AuxProxyColl>*/,
52  typename AuxProxyColl
53  >
54  auto makeProxyAsParallelData(AuxProxyColl&& auxProxy)
55  {
57  (std::move(auxProxy));
58  } // makeProxyAsParallelData()
59 
60 
61  /// @}
62  /// --- END Infrastructure for proxies as auxiliary data ---------------------
63 
64 
65  //----------------------------------------------------------------------------
66  namespace details {
67 
68  //--------------------------------------------------------------------------
69  /**
70  * @brief Object presenting a proxy as parallel data for another one.
71  * @tparam AuxProxyColl type of the parallel data collection
72  * @tparam Aux type of the associated object
73  * @tparam Tag tag this data is labeled with
74  * @ingroup LArSoftProxiesAuxProxy
75  *
76  * This object inherits its interface from `proxy::ParallelData`.
77  * In addition, it owns the proxy it wraps.
78  */
79  template <
80  typename AuxProxyColl,
81  typename Aux /* = util::collection_value_t<AuxProxyColl> */,
82  typename Tag /* = Aux */
83  >
84  struct ProxyAsParallelData
85  : private AuxProxyColl
86  , public ParallelData<AuxProxyColl, Aux, Tag>
87  {
88  /// Steals and wraps collection `proxy`.
89  ProxyAsParallelData(AuxProxyColl&& proxy)
90  : AuxProxyColl(std::move(proxy))
91  , ParallelData<AuxProxyColl, Aux, Tag>
92  (static_cast<AuxProxyColl const*>(this))
93  {}
94 
95  // explicitly select the tag from the parallel data (same as Tag)
97 
98  }; // class ProxyAsParallelData<>
99 
100 
101  //--------------------------------------------------------------------------
102 
103  } // namespace details
104 
105 } // namespace proxy
106 
107 
108 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_PROXYASPARALLELDATA_H
Object to draft parallel data interface.
Definition: ParallelData.h:82
Definition: tag.cpp:4
ProxyAsParallelData(AuxProxyColl &&proxy)
Steals and wraps collection proxy.
STL namespace.
Auxiliary data from parallel data products.
def move(depos, offset)
Definition: depos.py:107
auto makeProxyAsParallelData(AuxProxyColl &&auxProxy)
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.
Object presenting a proxy as parallel data for another one.