1 #ifndef canvas_Persistency_Common_FindManyP_h 2 #define canvas_Persistency_Common_FindManyP_h 130 #include <initializer_list> 133 #define ART_IPR_BY_PTR 137 template <
typename ProdB,
typename DATA =
void>
141 template <
typename ProdB>
147 template <
typename ProdB>
151 #ifdef ART_IPR_BY_PTR 152 using bColl_t = std::vector<std::vector<Ptr<ProdB>>>;
154 using bColl_t = std::vector<std::vector<ProdB const*>>;
164 template <
typename Handle,
typename DataContainer,
typename Tag>
166 DataContainer
const& dc,
168 std::enable_if_t<detail::is_handle_v<Handle>>* =
nullptr);
170 template <
typename ProdAColl,
typename DataContainer,
typename Tag>
172 DataContainer
const& dc,
174 std::enable_if_t<std::is_pointer_v<typename ProdAColl::value_type>>* =
177 template <
typename PtrProdAColl,
typename DataContainer,
typename Tag>
179 DataContainer
const& dc,
181 std::enable_if_t<std::is_same_v<
182 typename PtrProdAColl::value_type,
185 template <
typename ProdA,
typename DataContainer,
typename Tag>
187 DataContainer
const& dc,
191 bool isValid()
const;
207 void setStoredException(std::shared_ptr<art::Exception const>&&
e);
208 void throwIfInvalid()
const;
212 std::shared_ptr<art::Exception const> storedException_{
nullptr};
215 template <
typename ProdB,
typename Data>
235 template <
typename Handle,
typename DataContainer,
typename Tag>
237 DataContainer
const& dc,
239 std::enable_if_t<detail::is_handle_v<Handle>>* =
nullptr);
241 template <
typename ProdAColl,
typename DataContainer,
typename Tag>
243 DataContainer
const& dc,
245 std::enable_if_t<std::is_pointer_v<typename ProdAColl::value_type>>* =
248 template <
typename PtrProdAColl,
typename DataContainer,
typename Tag>
250 DataContainer
const& dc,
252 std::enable_if_t<std::is_same_v<
253 typename PtrProdAColl::value_type,
256 template <
typename ProdA,
typename DataContainer,
typename Tag>
258 DataContainer
const& dc,
280 template <
typename ProdB>
281 template <
typename Handle,
typename DataContainer,
typename Tag>
283 DataContainer
const& dc,
285 std::enable_if_t<detail::is_handle_v<Handle>>*)
287 using ProdA =
typename Handle::element_type::value_type;
289 dc, detail::input_tag<ProdA, ProdB, void>(tag)};
290 storedException_ = finder(*aCollection, bCollection_);
293 template <
typename ProdB>
294 template <
typename ProdAColl,
typename DataContainer,
typename Tag>
296 DataContainer
const& dc,
298 std::enable_if_t<std::is_pointer_v<typename ProdAColl::value_type>>*)
301 std::remove_const_t<std::remove_pointer_t<typename ProdAColl::value_type>>;
303 dc, detail::input_tag<ProdA, ProdB, void>(tag)};
304 storedException_ = finder(view, bCollection_);
307 template <
typename ProdB>
308 template <
typename PtrProdAColl,
typename DataContainer,
typename Tag>
310 DataContainer
const& dc,
313 std::is_same_v<
typename PtrProdAColl::value_type,
316 using ProdA =
typename PtrProdAColl::value_type::value_type;
318 dc, detail::input_tag<ProdA, ProdB, void>(tag)};
319 storedException_ = finder(aPtrColl, bCollection_);
322 template <
typename ProdB>
323 template <
typename ProdA,
typename DataContainer,
typename Tag>
325 DataContainer
const& dc,
329 dc, detail::input_tag<ProdA, ProdB, void>(tag)};
330 storedException_ = finder(ptrs, bCollection_);
333 template <
typename ProdB>
337 return bCollection_.size();
340 template <
typename ProdB>
343 return (storedException_.get() ==
nullptr);
346 template <
typename ProdB>
351 return bCollection_.at(i);
354 template <
typename ProdB>
359 item.insert(item.end(), ref.begin(), ref.end());
363 template <
typename ProdB>
370 template <
typename ProdB>
373 storedException_ = std::move(
e);
376 template <
typename ProdB>
382 <<
"Attempt to use a FindManyP where the underlying " 383 "art::Assns product was not found.";
389 template <
typename ProdB,
typename Data>
390 template <
typename Handle,
typename DataContainer,
typename Tag>
392 DataContainer
const& dc,
394 std::enable_if_t<detail::is_handle_v<Handle>>*)
396 using ProdA =
typename Handle::element_type::value_type;
398 dc, detail::input_tag<ProdA, ProdB, void>(tag)};
403 template <
typename ProdB,
typename Data>
404 template <
typename ProdAColl,
typename DataContainer,
typename Tag>
406 DataContainer
const& dc,
408 std::enable_if_t<std::is_pointer_v<typename ProdAColl::value_type>>*)
411 std::remove_const_t<std::remove_pointer_t<typename ProdAColl::value_type>>;
413 dc, detail::input_tag<ProdA, ProdB, void>(tag)};
417 template <
typename ProdB,
typename Data>
418 template <
typename PtrProdAColl,
typename DataContainer,
typename Tag>
420 DataContainer
const& dc,
423 std::is_same_v<
typename PtrProdAColl::value_type,
426 using ProdA =
typename PtrProdAColl::value_type::value_type;
428 dc, detail::input_tag<ProdA, ProdB, Data>(tag)};
433 template <
typename ProdB,
typename Data>
434 template <
typename ProdA,
typename DataContainer,
typename Tag>
436 std::initializer_list<
Ptr<ProdA>>
const& ptrs,
437 DataContainer
const& dc,
441 dc, detail::input_tag<ProdA, ProdB, Data>(tag)};
445 template <
typename ProdB,
typename Data>
452 template <
typename ProdB,
typename Data>
459 data.insert(
data.end(), ref.begin(), ref.end());
464 template <
typename ProdB,
typename Data>
471 #undef ART_IPR_BY_PTR
typename dataColl_t::reference data_reference
bool operator==(FindManyP< ProdB, Data > const &other) const
typename dataColl_t::const_pointer data_const_pointer
typename bColl_t::value_type value_type
typename bColl_t::difference_type difference_type
data_const_reference data(size_type i) const
FindManyP(Handle const &aCollection, DataContainer const &dc, Tag const &tag, std::enable_if_t< detail::is_handle_v< Handle >> *=nullptr)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
typename base::reference reference
typename base::size_type size_type
typename bColl_t::size_type size_type
typename bColl_t::const_reference const_reference
typename bColl_t::reference reference
bool operator==(FindManyP< ProdB, void > const &other) const
typename base::difference_type difference_type
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< std::vector< Data const * >> dataColl_t
typename base::value_type value_type
dataColl_t dataCollection_
size_type get(size_type i, reference item) const
typename base::const_reference const_reference
void throwIfInvalid() const
std::vector< std::vector< Ptr< ProdB >>> bColl_t
const_reference at(size_type i) const
size_type get(size_type i, reference item, data_reference data) const
typename base::assoc_t assoc_t
void setStoredException(std::shared_ptr< art::Exception const > &&e)
typename dataColl_t::const_reference data_const_reference