Public Member Functions | Private Attributes | List of all members
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 306 of file IPRHelper.h.

307  : assnsTag_{assnsTag}, seen_()
308 {}
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 325 of file IPRHelper.h.

328 {
329  // This works if BColl is a collection of pointers or Ptrs.
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";
334  } else if (item) {
335  bColl[index] = item.get();
336  seen_[index] = uint8_t(1u);
337  } else {
339  << "Attempted to create a FindOne object where an associated item is "
340  << "\nunavailable.\n";
341  }
342 }
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 377 of file IPRHelper.h.

380 {
381  bColls[index].push_back(item ? item.get() : nullptr);
382 }
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 349 of file IPRHelper.h.

352 {
353  // This works if BColl is a collection of pointers or Ptrs.
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";
358  }
359  bColl[index] = item;
360  seen_[index] = uint8_t(1u);
361 }
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 389 of file IPRHelper.h.

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

Definition at line 313 of file IPRHelper.h.

314 {
315  // This works if BColl is a collection of pointers or Ptrs.
316  bColl.assign(size, typename Bcoll::value_type{});
317  seen_.assign(size, uint8_t{});
318 }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
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 366 of file IPRHelper.h.

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

Member Data Documentation

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

Definition at line 114 of file IPRHelper.h.

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

Definition at line 115 of file IPRHelper.h.


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