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

#include "FindManyP.h"

Public Types

using bColl_t = std::vector< std::vector< Ptr< ProdB >>>
 
using value_type = typename bColl_t::value_type
 
using size_type = typename bColl_t::size_type
 
using difference_type = typename bColl_t::difference_type
 
using const_reference = typename bColl_t::const_reference
 
using reference = typename bColl_t::reference
 
using assoc_t = ProdB
 

Public Member Functions

template<typename Handle , typename DataContainer , typename Tag >
 FindManyP (Handle const &aCollection, DataContainer const &dc, Tag const &tag, std::enable_if_t< detail::is_handle_v< Handle >> *=nullptr)
 
template<typename ProdAColl , typename DataContainer , typename Tag >
 FindManyP (ProdAColl const &view, DataContainer const &dc, Tag const &tag, std::enable_if_t< std::is_pointer_v< typename ProdAColl::value_type >> *=nullptr)
 
template<typename PtrProdAColl , typename DataContainer , typename Tag >
 FindManyP (PtrProdAColl const &aPtrColl, DataContainer const &dc, Tag const &tag, std::enable_if_t< std::is_same_v< typename PtrProdAColl::value_type, art::Ptr< typename PtrProdAColl::value_type::value_type >>> *=nullptr)
 
template<typename ProdA , typename DataContainer , typename Tag >
 FindManyP (std::initializer_list< Ptr< ProdA >> const &ptrs, DataContainer const &dc, Tag const &tag)
 
bool isValid () const
 
size_type size () const
 
const_reference at (size_type i) const
 
size_type get (size_type i, reference item) const
 
bool operator== (FindManyP< ProdB, void > const &other) const
 

Protected Member Functions

 FindManyP ()=default
 
bColl_tbCollection ()
 
void setStoredException (std::shared_ptr< art::Exception const > &&e)
 
void throwIfInvalid () const
 

Private Attributes

bColl_t bCollection_ {}
 
std::shared_ptr< art::Exception const > storedException_ {nullptr}
 

Detailed Description

template<typename ProdB>
class art::FindManyP< ProdB, void >

Definition at line 148 of file FindManyP.h.

Member Typedef Documentation

template<typename ProdB >
using art::FindManyP< ProdB, void >::assoc_t = ProdB

Definition at line 162 of file FindManyP.h.

template<typename ProdB >
using art::FindManyP< ProdB, void >::bColl_t = std::vector<std::vector<Ptr<ProdB>>>

Definition at line 152 of file FindManyP.h.

template<typename ProdB >
using art::FindManyP< ProdB, void >::const_reference = typename bColl_t::const_reference

Definition at line 159 of file FindManyP.h.

template<typename ProdB >
using art::FindManyP< ProdB, void >::difference_type = typename bColl_t::difference_type

Definition at line 158 of file FindManyP.h.

template<typename ProdB >
using art::FindManyP< ProdB, void >::reference = typename bColl_t::reference

Definition at line 160 of file FindManyP.h.

template<typename ProdB >
using art::FindManyP< ProdB, void >::size_type = typename bColl_t::size_type

Definition at line 157 of file FindManyP.h.

template<typename ProdB >
using art::FindManyP< ProdB, void >::value_type = typename bColl_t::value_type

Definition at line 156 of file FindManyP.h.

Constructor & Destructor Documentation

template<typename ProdB >
template<typename Handle , typename DataContainer , typename Tag >
art::FindManyP< ProdB, void >::FindManyP ( Handle const &  aCollection,
DataContainer const &  dc,
Tag const &  tag,
std::enable_if_t< detail::is_handle_v< Handle >> *  = nullptr 
)

Definition at line 282 of file FindManyP.h.

286 {
287  using ProdA = typename Handle::element_type::value_type;
288  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{
289  dc, detail::input_tag<ProdA, ProdB, void>(tag)};
290  storedException_ = finder(*aCollection, bCollection_);
291 }
std::shared_ptr< art::Exception const > storedException_
Definition: FindManyP.h:212
template<typename ProdB >
template<typename ProdAColl , typename DataContainer , typename Tag >
art::FindManyP< ProdB, void >::FindManyP ( ProdAColl const &  view,
DataContainer const &  dc,
Tag const &  tag,
std::enable_if_t< std::is_pointer_v< typename ProdAColl::value_type >> *  = nullptr 
)

Definition at line 295 of file FindManyP.h.

299 {
300  using ProdA =
301  std::remove_const_t<std::remove_pointer_t<typename ProdAColl::value_type>>;
302  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{
303  dc, detail::input_tag<ProdA, ProdB, void>(tag)};
304  storedException_ = finder(view, bCollection_);
305 }
std::shared_ptr< art::Exception const > storedException_
Definition: FindManyP.h:212
template<typename ProdB >
template<typename PtrProdAColl , typename DataContainer , typename Tag >
art::FindManyP< ProdB, void >::FindManyP ( PtrProdAColl const &  aPtrColl,
DataContainer const &  dc,
Tag const &  tag,
std::enable_if_t< std::is_same_v< typename PtrProdAColl::value_type, art::Ptr< typename PtrProdAColl::value_type::value_type >>> *  = nullptr 
)

Definition at line 309 of file FindManyP.h.

315 {
316  using ProdA = typename PtrProdAColl::value_type::value_type;
317  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{
318  dc, detail::input_tag<ProdA, ProdB, void>(tag)};
319  storedException_ = finder(aPtrColl, bCollection_);
320 }
std::shared_ptr< art::Exception const > storedException_
Definition: FindManyP.h:212
template<typename ProdB >
template<typename ProdA , typename DataContainer , typename Tag >
art::FindManyP< ProdB, void >::FindManyP ( std::initializer_list< Ptr< ProdA >> const &  ptrs,
DataContainer const &  dc,
Tag const &  tag 
)

Definition at line 324 of file FindManyP.h.

327 {
328  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{
329  dc, detail::input_tag<ProdA, ProdB, void>(tag)};
330  storedException_ = finder(ptrs, bCollection_);
331 }
std::shared_ptr< art::Exception const > storedException_
Definition: FindManyP.h:212
template<typename ProdB >
art::FindManyP< ProdB, void >::FindManyP ( )
protecteddefault

Member Function Documentation

template<typename ProdB >
auto art::FindManyP< ProdB, void >::at ( size_type  i) const
inline

Definition at line 347 of file FindManyP.h.

349 {
350  throwIfInvalid();
351  return bCollection_.at(i);
352 }
void throwIfInvalid() const
Definition: FindManyP.h:377
template<typename ProdB >
bColl_t& art::FindManyP< ProdB, void >::bCollection ( )
inlineprotected

Definition at line 205 of file FindManyP.h.

References e.

Referenced by art::FindManyP< ProdB, Data >::FindManyP().

205 { return bCollection_; }
template<typename ProdB >
auto art::FindManyP< ProdB, void >::get ( size_type  i,
reference  item 
) const
inline

Definition at line 355 of file FindManyP.h.

Referenced by art::FindManyP< ProdB, Data >::get().

356 {
357  throwIfInvalid();
358  const_reference ref(bCollection_.at(i));
359  item.insert(item.end(), ref.begin(), ref.end());
360  return ref.size();
361 }
typename bColl_t::const_reference const_reference
Definition: FindManyP.h:159
void throwIfInvalid() const
Definition: FindManyP.h:377
template<typename ProdB >
bool art::FindManyP< ProdB, void >::isValid ( ) const
inline

Definition at line 341 of file FindManyP.h.

342 {
343  return (storedException_.get() == nullptr);
344 }
std::shared_ptr< art::Exception const > storedException_
Definition: FindManyP.h:212
template<typename ProdB >
bool art::FindManyP< ProdB, void >::operator== ( FindManyP< ProdB, void > const &  other) const
inline

Definition at line 364 of file FindManyP.h.

References bCollection_.

Referenced by art::FindManyP< ProdB, Data >::operator==().

365 {
366  throwIfInvalid();
367  return bCollection_ == other.bCollection_;
368 }
void throwIfInvalid() const
Definition: FindManyP.h:377
template<typename ProdB >
void art::FindManyP< ProdB, void >::setStoredException ( std::shared_ptr< art::Exception const > &&  e)
inlineprotected

Definition at line 371 of file FindManyP.h.

References e.

Referenced by art::FindManyP< ProdB, Data >::FindManyP().

372 {
373  storedException_ = std::move(e);
374 }
std::shared_ptr< art::Exception const > storedException_
Definition: FindManyP.h:212
Float_t e
Definition: plot.C:35
template<typename ProdB >
auto art::FindManyP< ProdB, void >::size ( void  ) const
inline

Definition at line 334 of file FindManyP.h.

335 {
336  throwIfInvalid();
337  return bCollection_.size();
338 }
void throwIfInvalid() const
Definition: FindManyP.h:377
template<typename ProdB >
void art::FindManyP< ProdB, void >::throwIfInvalid ( ) const
inlineprotected

Definition at line 377 of file FindManyP.h.

References art::errors::LogicError.

Referenced by art::FindManyP< ProdB, Data >::data().

378 {
379  if (!isValid()) {
380  throw Exception(
381  errors::LogicError, "Invalid FindManyP", *storedException_)
382  << "Attempt to use a FindManyP where the underlying "
383  "art::Assns product was not found.";
384  }
385 }
std::shared_ptr< art::Exception const > storedException_
Definition: FindManyP.h:212
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Member Data Documentation

template<typename ProdB >
bColl_t art::FindManyP< ProdB, void >::bCollection_ {}
private

Definition at line 211 of file FindManyP.h.

Referenced by operator==().

template<typename ProdB >
std::shared_ptr<art::Exception const> art::FindManyP< ProdB, void >::storedException_ {nullptr}
private

Definition at line 212 of file FindManyP.h.


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