1 #ifndef canvas_Persistency_Common_detail_IPRHelper_h     2 #define canvas_Persistency_Common_detail_IPRHelper_h    14 #include <type_traits>    15 #include <unordered_map>    19   template <
typename ProdA, 
typename ProdB, 
typename Data>
    23       : 
tag{token.inputTag_}
    28   template <
typename ProdA, 
typename ProdB, 
typename Data, 
typename Tag>
    33       std::is_convertible_v<Tag, InputTag> ||
    36       "\n\nart error: The input tag or product token provided to the "    37       "smart-query object\n"    38       "           constructor has a type that conflicts with that of the "    39       "smart-query object.\n");
    45   template <
typename ProdA,
    52   template <
typename DATA>
    55     void init(
size_t size, std::vector<DATA const*>& 
data) 
const;
    56     template <
typename ASSNS>
    57     void fill(ptrdiff_t assns_index,
    60               std::vector<DATA const*>& data) 
const;
    62     void init(
size_t size, 
std::vector<std::vector<DATA const*>>& data) 
const;
    63     template <
typename ASSNS>
    64     void fill(ptrdiff_t assns_index,
    70     template <
typename ASSNS>
    77   template <
typename ProdB>
    81     template <
typename Bcoll>
    82     void init(
size_t size, Bcoll& bColl);
    85     template <
typename Bcoll>
    86     std::enable_if_t<std::is_same_v<typename Bcoll::value_type, ProdB const*>>
    90     template <
typename Bcoll>
    92       std::is_convertible_v<typename Bcoll::value_type, Ptr<ProdB>>>
    95     template <
typename Bcoll>
    96     void init(
size_t size, std::vector<Bcoll>& bColls) 
const;
    99     template <
typename Bcoll>
   100     std::enable_if_t<std::is_same_v<typename Bcoll::value_type, ProdB const*>>
   103          std::vector<Bcoll>& bColls) 
const;
   106     template <
typename Bcoll>
   108       std::is_convertible_v<typename Bcoll::value_type, Ptr<ProdB>>>
   111          std::vector<Bcoll>& bColls) 
const;
   119 template <
typename ProdA,
   142   template <
typename Acoll, 
typename Bcoll>
   146   template <
typename Acoll, 
typename Bcoll>
   157 template <
typename ProdA,
   162 template <
typename Acoll, 
typename Bcoll>
   169   return (*
this)(aColl, bColl, 
dummy);
   198 template <
typename ProdA,
   203 template <
typename Acoll, 
typename Bcoll>
   211   typename EVENT::template HandleT<Assns<ProdA, ProdB, Data>> assnsHandle;
   212   event_.getByLabel(assnsTag_, assnsHandle);
   213   if (!assnsHandle.isValid()) {
   214     return assnsHandle.whyFailed(); 
   216   bh.
init(aColl.size(), bColl);
   217   dh.
init(aColl.size(), dColl);
   219   std::unordered_multimap<typename Ptr<ProdA>::const_pointer,
   220                           std::pair<Ptr<ProdB>, ptrdiff_t>>
   223   for (
auto const& apair : *assnsHandle) {
   224     if (apair.first.isAvailable()) {
   227         typename decltype(lookupCache)::mapped_type(apair.second, 
counter));
   236     auto foundItems = lookupCache.equal_range(
   238     if (foundItems.first != lookupCache.cend()) {
   242         [&bh, &dh, &bColl, bIndex, &assnsHandle, &dColl](
auto const& itemPair) {
   243           bh.fill(bIndex, itemPair.second.first, bColl);
   244           dh.fill(itemPair.second.second, *assnsHandle, bIndex, dColl);
   251 template <
typename DATA>
   254                                         std::vector<DATA const*>& 
data)
 const   256   data.assign(size, 0);
   259 template <
typename DATA>
   260 template <
typename ASSNS>
   264                                         size_t const data_index,
   265                                         std::vector<DATA const*>& 
data)
 const   267   data[data_index] = &assns.data(assns_index);
   270 template <
typename DATA>
   279 template <
typename DATA>
   280 template <
typename ASSNS>
   283   ptrdiff_t 
const assns_index,
   285   size_t const data_index,
   288   data[data_index].push_back(&assns.data(assns_index));
   291 template <
typename DATA>
   296 template <
typename DATA>
   297 template <
typename ASSNS>
   305 template <
typename ProdB>
   307   : assnsTag_{assnsTag}, 
seen_()
   310 template <
typename ProdB>
   311 template <
typename Bcoll>
   316   bColl.assign(size, 
typename Bcoll::value_type{});
   317   seen_.assign(size, uint8_t{});
   321 template <
typename ProdB>
   322 template <
typename Bcoll>
   323 inline std::enable_if_t<
   324   std::is_same_v<typename Bcoll::value_type, ProdB const*>>
   330   if (
seen_[index] == uint8_t(1u)) {
   332       << 
"Attempted to create a FindOne object for a one-many or many-many"   333       << 
" association specified in collection " << 
assnsTag_ << 
".\n";
   339       << 
"Attempted to create a FindOne object where an associated item is "   340       << 
"\nunavailable.\n";
   345 template <
typename ProdB>
   346 template <
typename Bcoll>
   347 inline std::enable_if_t<
   348   std::is_convertible_v<typename Bcoll::value_type, art::Ptr<ProdB>>>
   354   if (
seen_[index] == uint8_t(1u)) {
   356       << 
"Attempted to create a FindOne object for a one-many or many-many"   357       << 
" association specified in collection " << 
assnsTag_ << 
".\n";
   363 template <
typename ProdB>
   364 template <
typename Bcoll>
   367                                       std::vector<Bcoll>& bColls)
 const   373 template <
typename ProdB>
   374 template <
typename Bcoll>
   375 inline std::enable_if_t<
   376   std::is_same_v<typename Bcoll::value_type, ProdB const*>>
   379                                       std::vector<Bcoll>& bColls)
 const   381   bColls[
index].push_back(item ? item.
get() : 
nullptr);
   385 template <
typename ProdB>
   386 template <
typename Bcoll>
   387 inline std::enable_if_t<
   388   std::is_convertible_v<typename Bcoll::value_type, art::Ptr<ProdB>>>
   391                                       std::vector<Bcoll>& bColls)
 const   393   bColls[
index].push_back(item);
 
BcollHelper(InputTag const &assnsTag)
 
void init(size_t size, std::vector< DATA const * > &data) const 
 
void init(size_t size, Bcoll &bColl)
 
std::conditional_t< std::is_void_v< Data >, IPRHelperDef, DATACOLL > dataColl_t
 
void fill(ptrdiff_t assns_index, ASSNS const &assns, size_t data_index, std::vector< DATA const * > &data) const 
 
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size. 
 
InputTag input_tag(Tag const &tag)
 
shared_exception_t operator()(Acoll const &aColl, Bcoll &bColl) const 
 
std::vector< uint8_t > seen_
 
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
 
std::shared_ptr< art::Exception const  > shared_exception_t
 
cet::LibraryManager dummy("noplugin")
 
std::enable_if_t< std::is_same_v< typename Bcoll::value_type, ProdB const * > > fill(size_t index, Ptr< ProdB > const &item, Bcoll &bColl)
 
WANTED_POINTER ensurePointer(InputIterator it)
 
IPRHelper(EVENT const &e, InputTag const &tag)