LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::detail::BcollHelper< ProdB > Class Template Reference

#include "IPRHelper.h"

Public Member Functions

 BcollHelper (InputTag const &assnsTag)
 
template<typename Bcoll >
void init (size_t size, Bcoll &bColl)
 
template<typename Bcoll >
std::enable_if_t< std::is_same_v< typename Bcoll::value_type, ProdB const * > > fill (size_t index, Ptr< ProdB > const &item, Bcoll &bColl)
 
template<typename Bcoll >
std::enable_if_t< std::is_convertible_v< typename Bcoll::value_type, Ptr< ProdB > > > fill (size_t index, Ptr< ProdB > const &item, Bcoll &bColl)
 
template<typename Bcoll >
void init (size_t size, std::vector< Bcoll > &bColls) const
 
template<typename Bcoll >
std::enable_if_t< std::is_same_v< typename Bcoll::value_type, ProdB const * > > fill (size_t index, Ptr< ProdB > const &item, std::vector< Bcoll > &bColls) const
 
template<typename Bcoll >
std::enable_if_t< std::is_convertible_v< typename Bcoll::value_type, Ptr< ProdB > > > fill (size_t index, Ptr< ProdB > const &item, std::vector< Bcoll > &bColls) const
 
template<typename Bcoll >
std::enable_if_t< std::is_convertible_v< typename Bcoll::value_type, art::Ptr< ProdB > > > fill (size_t const index, Ptr< ProdB > const &item, Bcoll &bColl)
 
template<typename Bcoll >
std::enable_if_t< std::is_convertible_v< typename Bcoll::value_type, art::Ptr< ProdB > > > fill (size_t const index, Ptr< ProdB > const &item, std::vector< Bcoll > &bColls) const
 

Private Attributes

InputTag const assnsTag_
 
std::vector< uint8_t > seen_
 

Detailed Description

template<typename ProdB>
class art::detail::BcollHelper< ProdB >

Definition at line 78 of file IPRHelper.h.

Constructor & Destructor Documentation

template<typename ProdB >
art::detail::BcollHelper< ProdB >::BcollHelper ( InputTag const &  assnsTag)
inline

Definition at line 307 of file IPRHelper.h.

References art::detail::BcollHelper< ProdB >::seen_.

308  : assnsTag_{assnsTag}, seen_()
309 {}
std::vector< uint8_t > seen_
Definition: IPRHelper.h:115
InputTag const assnsTag_
Definition: IPRHelper.h:114

Member Function Documentation

template<typename ProdB >
template<typename Bcoll >
std::enable_if_t< std::is_same_v< typename Bcoll::value_type, ProdB const * > > art::detail::BcollHelper< ProdB >::fill ( size_t  index,
Ptr< ProdB > const &  item,
Bcoll &  bColl 
)
inline

Definition at line 326 of file IPRHelper.h.

References art::detail::BcollHelper< ProdB >::assnsTag_, art::Ptr< T >::get(), art::errors::LogicError, and art::detail::BcollHelper< ProdB >::seen_.

329 {
330  // This works if BColl is a collection of pointers or Ptrs.
331  if (seen_[index] == uint8_t(1u)) {
333  << "Attempted to create a FindOne object for a one-many or many-many"
334  << " association specified in collection " << assnsTag_ << ".\n";
335  } else if (item) {
336  bColl[index] = item.get();
337  seen_[index] = uint8_t(1u);
338  } else {
340  << "Attempted to create a FindOne object where an associated item is "
341  << "\nunavailable.\n";
342  }
343 }
std::vector< uint8_t > seen_
Definition: IPRHelper.h:115
InputTag const assnsTag_
Definition: IPRHelper.h:114
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
template<typename ProdB>
template<typename Bcoll >
std::enable_if_t< std::is_convertible_v<typename Bcoll::value_type, Ptr<ProdB> > > art::detail::BcollHelper< ProdB >::fill ( size_t  index,
Ptr< ProdB > const &  item,
Bcoll &  bColl 
)
template<typename ProdB >
template<typename Bcoll >
std::enable_if_t< std::is_same_v< typename Bcoll::value_type, ProdB const * > > art::detail::BcollHelper< ProdB >::fill ( size_t  index,
Ptr< ProdB > const &  item,
std::vector< Bcoll > &  bColls 
) const
inline

Definition at line 378 of file IPRHelper.h.

References art::Ptr< T >::get().

381 {
382  bColls[index].push_back(item ? item.get() : nullptr);
383 }
template<typename ProdB>
template<typename Bcoll >
std::enable_if_t< std::is_convertible_v<typename Bcoll::value_type, Ptr<ProdB> > > art::detail::BcollHelper< ProdB >::fill ( size_t  index,
Ptr< ProdB > const &  item,
std::vector< Bcoll > &  bColls 
) const
template<typename ProdB>
template<typename Bcoll >
std::enable_if_t< std::is_convertible_v<typename Bcoll::value_type, art::Ptr<ProdB> > > art::detail::BcollHelper< ProdB >::fill ( size_t const  index,
Ptr< ProdB > const &  item,
Bcoll &  bColl 
)
inline

Definition at line 350 of file IPRHelper.h.

References art::detail::BcollHelper< ProdB >::assnsTag_, art::errors::LogicError, and art::detail::BcollHelper< ProdB >::seen_.

353 {
354  // This works if BColl is a collection of pointers or Ptrs.
355  if (seen_[index] == uint8_t(1u)) {
357  << "Attempted to create a FindOne object for a one-many or many-many"
358  << " association specified in collection " << assnsTag_ << ".\n";
359  }
360  bColl[index] = item;
361  seen_[index] = uint8_t(1u);
362 }
std::vector< uint8_t > seen_
Definition: IPRHelper.h:115
InputTag const assnsTag_
Definition: IPRHelper.h:114
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
template<typename ProdB>
template<typename Bcoll >
std::enable_if_t< std::is_convertible_v<typename Bcoll::value_type, art::Ptr<ProdB> > > art::detail::BcollHelper< ProdB >::fill ( size_t const  index,
Ptr< ProdB > const &  item,
std::vector< Bcoll > &  bColls 
) const
inline

Definition at line 390 of file IPRHelper.h.

393 {
394  bColls[index].push_back(item);
395 }
template<typename ProdB >
template<typename Bcoll >
void art::detail::BcollHelper< ProdB >::init ( size_t  size,
Bcoll &  bColl 
)
inline

Definition at line 314 of file IPRHelper.h.

References art::detail::BcollHelper< ProdB >::seen_.

Referenced by art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::operator()().

315 {
316  // This works if BColl is a collection of pointers or Ptrs.
317  bColl.assign(size, typename Bcoll::value_type{});
318  seen_.assign(size, uint8_t{});
319 }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
std::vector< uint8_t > seen_
Definition: IPRHelper.h:115
template<typename ProdB >
template<typename Bcoll >
void art::detail::BcollHelper< ProdB >::init ( size_t  size,
std::vector< Bcoll > &  bColls 
) const
inline

Definition at line 367 of file IPRHelper.h.

369 {
370  bColls.resize(size);
371 }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101

Member Data Documentation

template<typename ProdB>
InputTag const art::detail::BcollHelper< ProdB >::assnsTag_
private

Definition at line 114 of file IPRHelper.h.

Referenced by art::detail::BcollHelper< ProdB >::fill().

template<typename ProdB>
std::vector<uint8_t> art::detail::BcollHelper< ProdB >::seen_
private

The documentation for this class was generated from the following file: