LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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< typename Bcoll::value_type, ProdB const * >::value > fill (size_t index, Ptr< ProdB > const &item, Bcoll &bColl)
 
template<typename Bcoll >
std::enable_if_t< std::is_convertible< typename Bcoll::value_type, Ptr< ProdB > >::value > 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< typename Bcoll::value_type, ProdB const * >::value > fill (size_t index, Ptr< ProdB > const &item, std::vector< Bcoll > &bColls) const
 
template<typename Bcoll >
std::enable_if_t< std::is_convertible< typename Bcoll::value_type, Ptr< ProdB > >::value > fill (size_t index, Ptr< ProdB > const &item, std::vector< Bcoll > &bColls) const
 
template<typename Bcoll >
std::enable_if_t< std::is_convertible< typename Bcoll::value_type, art::Ptr< ProdB > >::value > fill (size_t index, Ptr< ProdB > const &item, Bcoll &bColl)
 
template<typename Bcoll >
std::enable_if_t< std::is_convertible< typename Bcoll::value_type, art::Ptr< ProdB > >::value > fill (size_t 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 76 of file IPRHelper.h.

Constructor & Destructor Documentation

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

Definition at line 308 of file IPRHelper.h.

309  : assnsTag_(assnsTag), seen_()
310 {}
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< typename Bcoll::value_type, ProdB const * >::value > art::detail::BcollHelper< ProdB >::fill ( size_t  index,
Ptr< ProdB > const &  item,
Bcoll &  bColl 
)
inline

Definition at line 327 of file IPRHelper.h.

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

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

330 {
331  // This works if BColl is a collection of pointers or Ptrs.
332  if (seen_[index] == uint8_t(1u)) {
334  << "Attempted to create a FindOne object for a one-many or many-many"
335  << " association specified in collection " << assnsTag_ << ".\n";
336  } else if (item) {
337  bColl[index] = item.get();
338  seen_[index] = uint8_t(1u);
339  } else {
341  << "Attempted to create a FindOne object where an associated item is "
342  << "\nunavailable.\n";
343  }
344 }
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<typename Bcoll::value_type, Ptr<ProdB> >::value> 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< typename Bcoll::value_type, ProdB const * >::value > art::detail::BcollHelper< ProdB >::fill ( size_t  index,
Ptr< ProdB > const &  item,
std::vector< Bcoll > &  bColls 
) const
inline

Definition at line 379 of file IPRHelper.h.

References art::Ptr< T >::get(), and fhicl::detail::atom::value().

382 {
383  bColls[index].push_back(item ? item.get() : nullptr);
384 }
template<typename ProdB>
template<typename Bcoll >
std::enable_if_t< std::is_convertible<typename Bcoll::value_type, Ptr<ProdB> >::value> 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<typename Bcoll::value_type, art::Ptr<ProdB> >::value> art::detail::BcollHelper< ProdB >::fill ( size_t  index,
Ptr< ProdB > const &  item,
Bcoll &  bColl 
)
inline

Definition at line 351 of file IPRHelper.h.

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

354 {
355  // This works if BColl is a collection of pointers or Ptrs.
356  if (seen_[index] == uint8_t(1u)) {
358  << "Attempted to create a FindOne object for a one-many or many-many"
359  << " association specified in collection " << assnsTag_ << ".\n";
360  }
361  bColl[index] = item;
362  seen_[index] = uint8_t(1u);
363 }
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<typename Bcoll::value_type, art::Ptr<ProdB> >::value> art::detail::BcollHelper< ProdB >::fill ( size_t  index,
Ptr< ProdB > const &  item,
std::vector< Bcoll > &  bColls 
) const
inline

Definition at line 391 of file IPRHelper.h.

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

Definition at line 315 of file IPRHelper.h.

References art::detail::BcollHelper< ProdB >::seen_, and fhicl::detail::atom::value().

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

316 {
317  // This works if BColl is a collection of pointers or Ptrs.
318  bColl.assign(size, typename Bcoll::value_type());
319  seen_.assign(size, uint8_t(0u));
320 }
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 368 of file IPRHelper.h.

References fhicl::detail::atom::value().

370 {
371  bColls.resize(size);
372 }

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: