LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ParallelDataProxyMaker.h
Go to the documentation of this file.
1 
11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_PARALLELDATAPROXYMAKER_H
12 #define LARDATA_RECOBASEPROXY_PROXYBASE_PARALLELDATAPROXYMAKER_H
13 
14 // LArSoft libraries
17 #include "larcorealg/CoreUtils/ContainerMeta.h" // util::collection_value_t, ...
18 
19 // framework libraries
21 
22 // C/C++ standard
23 #include <vector>
24 #include <utility> // std::forward()
25 
26 
27 
28 namespace proxy {
29 
30 
31  // -- BEGIN Parallel data infrastructure -------------------------------------
63  template <
64  typename Main,
65  typename AuxColl,
66  typename Aux,
67  typename AuxTag = util::collection_value_t<AuxColl>
68  >
70 
72  using data_tag = AuxTag;
73 
75  using main_element_t = Main;
76 
78  using aux_collection_t = AuxColl;
79 
81  using aux_element_t = Aux;
82 
86 
105  template<typename Event, typename Handle, typename MainArgs>
106  static auto make
107  (Event const& event, Handle&& mainHandle, MainArgs const& mainArgs)
108  {
109  return createFromTag
110  (event, std::forward<Handle>(mainHandle), art::InputTag(mainArgs));
111  }
112 
127  template<typename Event, typename Handle, typename MainArgs>
128  static auto make(
129  Event const& event, Handle&& mainHandle,
130  MainArgs const&, art::InputTag const& auxInputTag
131  )
132  {
133  return
134  createFromTag(event, std::forward<Handle>(mainHandle), auxInputTag);
135  }
136 
149  template<typename Event, typename Handle, typename MainArgs>
150  static auto make
151  (Event const&, Handle&&, MainArgs const&, aux_collection_t const& auxColl)
152  {
153  return makeParallelDataFrom<aux_collection_t, aux_element_t, data_tag>
154  (auxColl);
155  }
156 
157 
158  private:
159  template<typename Event, typename Handle>
160  static auto createFromTag
161  (Event const& event, Handle&&, art::InputTag const& auxInputTag)
162  {
163  return makeParallelDataFrom<aux_collection_t, aux_element_t, data_tag>
164  (event, auxInputTag);
165  }
166 
167  }; // struct ParallelDataProxyMakerBase<>
168 
169 
170  //--------------------------------------------------------------------------
203  template<
204  typename Main, typename Aux, typename CollProxy, typename Tag = Aux,
205  typename AuxColl = std::vector<Aux>
206  >
208  : public ParallelDataProxyMakerBase<Main, AuxColl, Aux, Tag>
209  {
210  //
211  // Note that this implementation is here only to document how to derive
212  // a ParallelDataProxyMaker (specialization) from
213  // ParallelDataProxyMakerBase. It's just mirroring the base class.
214  //
216 
217  public:
218 
220  using typename base_t::main_element_t;
221 
223  using typename base_t::aux_collection_t;
224 
226  using typename base_t::aux_element_t;
227 
229  using typename base_t::aux_collection_proxy_t;
230 
231 
252  template
253  <typename Event, typename Handle, typename MainArgs, typename... Args>
254  static auto make(
255  Event const& event, Handle&& mainHandle, MainArgs const& margs,
256  Args&&... args
257  )
258  {
259  return base_t::make(
260  event,
261  std::forward<Handle>(mainHandle),
262  margs,
263  std::forward<Args>(args)...
264  );
265  }
266 
267  }; // struct ParallelDataProxyMaker<>
268 
269 
271  // -- END Parallel data infrastructure ---------------------------------------
272 
273 
274  //----------------------------------------------------------------------------
275  namespace details {
276 
277  //--------------------------------------------------------------------------
278  //--- stuff for parallel data collection (a form of auxiliary data)
279  //--------------------------------------------------------------------------
280  template <typename Aux, typename AuxTag, typename AuxColl = void>
282  template <typename CollProxy>
284  <typename CollProxy::main_element_t, Aux, CollProxy, AuxTag, AuxColl>;
285  }; // struct ParallelDataProxyMakerWrapper<Aux, AuxTag, AuxColl>
286 
287  template <typename Aux, typename AuxTag>
288  struct ParallelDataProxyMakerWrapper<Aux, AuxTag, void> {
289  template <typename CollProxy>
291  <typename CollProxy::main_element_t, Aux, CollProxy, AuxTag>;
292  }; // struct ParallelDataProxyMakerWrapper<Aux, AuxTag>
293 
294 
295  } // namespace details
296 
297 
298 } // namespace proxy
299 
300 
301 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_PARALLELDATAPROXYMAKER_H
Object to draft parallel data interface.
Definition: ParallelData.h:82
Helper functions to create proxy::ParallelData objects.
Creates an associated data wrapper for the specified types.
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &margs, Args &&...args)
Create a association proxy collection using main collection tag.
Auxiliary data from parallel data products.
AuxColl aux_collection_t
Type of the auxiliary data product.
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
Creates an parallel data wrapper for the specified types.
static auto createFromTag(Event const &event, Handle &&, art::InputTag const &auxInputTag)
Tag data_tag
Tag labelling the associated data we are going to produce.
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &mainArgs)
Create a parallel data proxy collection using main collection tag.
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &, art::InputTag const &auxInputTag)
Create a parallel data proxy collection using the specified tag.
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.
Event finding and building.