LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
AssociatedDataProxyMaker.h
Go to the documentation of this file.
1 
11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_ASSOCIATEDDATAPROXYMAKER_H
12 #define LARDATA_RECOBASEPROXY_PROXYBASE_ASSOCIATEDDATAPROXYMAKER_H
13 
14 // LArSoft libraries
16 
17 // framework libraries
19 
20 // C/C++ standard libraries
21 #include <utility> // std::forward()
22 #include <type_traits> // std::is_convertible<>
23 
24 
25 namespace proxy {
26 
27 
28  // --- BEGIN Associated data infrastructure ----------------------------------
31 
32  //----------------------------------------------------------------------------
33  //--- one-to-many associations
34  //----------------------------------------------------------------------------
48  template
49  <typename Main, typename Aux, typename Metadata, typename AuxTag = Aux>
51 
53  using data_tag = AuxTag;
54 
56  using main_element_t = Main;
57 
59  using aux_element_t = Aux;
60 
62  using metadata_t = Metadata;
63 
67 
70 
89  template<typename Event, typename Handle, typename MainArgs>
90  static auto make
91  (Event const& event, Handle&& mainHandle, MainArgs const& mainArgs)
92  {
93  return createFromTag
94  (event, std::forward<Handle>(mainHandle), art::InputTag(mainArgs));
95  }
96 
111  template<typename Event, typename Handle, typename MainArgs>
112  static auto make(
113  Event const& event, Handle&& mainHandle,
114  MainArgs const&, art::InputTag const& auxInputTag
115  )
116  {
117  return
118  createFromTag(event, std::forward<Handle>(mainHandle), auxInputTag);
119  }
120 
133  template<typename Event, typename Handle, typename MainArgs, typename Assns>
134  static auto make
135  (Event const&, Handle&&, MainArgs const&, Assns const& assns)
136  {
137  static_assert(
138  std::is_convertible<typename Assns::right_t, aux_element_t>(),
139  "Improper right type for association."
140  );
141  return makeAssociatedDataFrom<data_tag>(assns);
142  }
143 
144 
145  private:
146  template<typename Event, typename Handle>
147  static auto createFromTag(
148  Event const& event, Handle&& mainHandle,
149  art::InputTag const& auxInputTag
150  )
151  {
154  (event, auxInputTag, mainHandle->size());
155  }
156 
157  }; // struct AssociatedDataProxyMakerBase<>
158 
159 
160 
161  //--------------------------------------------------------------------------
193  template <
194  typename Main, typename Aux, typename Metadata,
195  typename CollProxy, typename Tag = Aux
196  >
198  : public AssociatedDataProxyMakerBase<Main, Aux, Metadata, Tag>
199  {
200  //
201  // Note that this implementation is here only to document how to derive
202  // a AssociatedDataProxyMaker (specialization) from
203  // AssociatedDataProxyMakerBase. It's just mirroring the base class.
204  //
206 
207  public:
208 
210  using typename base_t::main_element_t;
211 
213  using typename base_t::aux_element_t;
214 
216  using typename base_t::metadata_t;
217 
219  using typename base_t::aux_collection_proxy_t;
220 
222  using typename base_t::assns_t;
223 
244  template
245  <typename Event, typename Handle, typename MainArgs, typename... Args>
246  static auto make(
247  Event const& event, Handle&& mainHandle, MainArgs const& margs,
248  Args&&... args
249  )
250  {
251  return base_t::make(
252  event,
253  std::forward<Handle>(mainHandle),
254  margs,
255  std::forward<Args>(args)...
256  );
257  }
258 
259  }; // struct AssociatedDataProxyMaker<>
260 
262  // --- END Associated data infrastructure ------------------------------------
263 
264 
265 
266  //----------------------------------------------------------------------------
267  namespace details {
268 
269  template <
270  typename Aux, typename Metadata /* = void */,
271  typename AuxTag /* = Aux */
272  >
274  template <typename CollProxy>
276  <typename CollProxy::main_element_t, Aux, Metadata, CollProxy, AuxTag>;
277  };
278 
279 
280  } // namespace details
281 
282 
283 } // namespace proxy
284 
285 
286 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_ASSOCIATEDDATAPROXYMAKER_H
auto makeAssociatedDataFrom(Assns const &assns, std::size_t minSize=0)
static auto createFromTag(Event const &event, Handle &&mainHandle, art::InputTag const &auxInputTag)
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &, art::InputTag const &auxInputTag)
Create a association proxy collection using the specified tag.
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &margs, Args &&...args)
Create a association proxy collection using main collection tag.
Aux aux_element_t
Type of the auxiliary associated datum ("right").
Object to draft associated data interface.
typename aux_collection_proxy_t::assns_t assns_t
Type of art association being used as input.
Helper functions to create an AssociatedData object.
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
Creates an associated data wrapper for the specified types.
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &mainArgs)
Create a association proxy collection using main collection tag.
Tag data_tag
Tag labelling the associated data we are going to produce.
art::Assns< Main, Aux, Metadata > assns_t
Type of art association.
Creates an associated data wrapper for the specified types.
Event finding and building.