LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::FindMany< ProdB, void > Class Template Reference

#include "FindMany.h"

Public Types

using bColl_t = std::vector< std::vector< ProdB const * > >
 
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 >
 FindMany (Handle const &aCollection, DataContainer const &dc, Tag const &tag, std::enable_if_t< detail::is_handle< Handle >::value > *=nullptr)
 
template<typename ProdAColl , typename DataContainer , typename Tag >
 FindMany (ProdAColl const &view, DataContainer const &dc, Tag const &tag, std::enable_if_t< std::is_pointer< typename ProdAColl::value_type >::value > *=nullptr)
 
template<typename PtrProdAColl , typename DataContainer , typename Tag >
 FindMany (PtrProdAColl const &aPtrColl, DataContainer const &dc, Tag const &tag, std::enable_if_t< std::is_same< typename PtrProdAColl::value_type, art::Ptr< typename PtrProdAColl::value_type::value_type > >::value > *=nullptr)
 
template<typename ProdA , typename DataContainer , typename Tag >
 FindMany (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== (FindMany< ProdB, void > const &other) const
 

Protected Member Functions

 FindMany ()=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::FindMany< ProdB, void >

Definition at line 149 of file FindMany.h.

Member Typedef Documentation

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

Definition at line 162 of file FindMany.h.

template<typename ProdB >
using art::FindMany< ProdB, void >::bColl_t = std::vector<std::vector<ProdB const*> >

Definition at line 154 of file FindMany.h.

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

Definition at line 159 of file FindMany.h.

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

Definition at line 158 of file FindMany.h.

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

Definition at line 160 of file FindMany.h.

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

Definition at line 157 of file FindMany.h.

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

Definition at line 156 of file FindMany.h.

Constructor & Destructor Documentation

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

Definition at line 278 of file FindMany.h.

References art::FindMany< ProdB, Data >::FindMany(), and art::detail::input_tag().

282 {
283  using ProdA = typename Handle::element_type::value_type;
284  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{dc, detail::input_tag(tag)};
285  storedException_ = finder(*aCollection, bCollection_);
286 }
InputTag input_tag(InputTag const &tag)
Definition: IPRHelper.h:21
std::shared_ptr< art::Exception const > storedException_
Definition: FindMany.h:210
template<typename ProdB >
template<typename ProdAColl , typename DataContainer , typename Tag >
art::FindMany< ProdB, void >::FindMany ( ProdAColl const &  view,
DataContainer const &  dc,
Tag const &  tag,
std::enable_if_t< std::is_pointer< typename ProdAColl::value_type >::value > *  = nullptr 
)

Definition at line 291 of file FindMany.h.

References art::FindMany< ProdB, Data >::FindMany(), and art::detail::input_tag().

295 {
296  using ProdA = std::remove_const_t<std::remove_pointer_t<typename ProdAColl::value_type>>;
297  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{dc, detail::input_tag(tag)};
298  storedException_ = finder(view, bCollection_);
299 }
InputTag input_tag(InputTag const &tag)
Definition: IPRHelper.h:21
std::shared_ptr< art::Exception const > storedException_
Definition: FindMany.h:210
template<typename ProdB >
template<typename PtrProdAColl , typename DataContainer , typename Tag >
art::FindMany< ProdB, void >::FindMany ( PtrProdAColl const &  aPtrColl,
DataContainer const &  dc,
Tag const &  tag,
std::enable_if_t< std::is_same< typename PtrProdAColl::value_type, art::Ptr< typename PtrProdAColl::value_type::value_type > >::value > *  = nullptr 
)

Definition at line 304 of file FindMany.h.

References art::FindMany< ProdB, Data >::FindMany(), and art::detail::input_tag().

309 {
310  using ProdA = typename PtrProdAColl::value_type::value_type;
311  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{dc, detail::input_tag(tag)};
312  storedException_ = finder(aPtrColl, bCollection_);
313 }
InputTag input_tag(InputTag const &tag)
Definition: IPRHelper.h:21
std::shared_ptr< art::Exception const > storedException_
Definition: FindMany.h:210
template<typename ProdB >
template<typename ProdA , typename DataContainer , typename Tag >
art::FindMany< ProdB, void >::FindMany ( std::initializer_list< Ptr< ProdA > > const &  ptrs,
DataContainer const &  dc,
Tag const &  tag 
)

Definition at line 318 of file FindMany.h.

References art::detail::input_tag().

321 {
322  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{dc, detail::input_tag(tag)};
323  storedException_ = finder(ptrs, bCollection_);
324 }
InputTag input_tag(InputTag const &tag)
Definition: IPRHelper.h:21
std::shared_ptr< art::Exception const > storedException_
Definition: FindMany.h:210
template<typename ProdB >
art::FindMany< ProdB, void >::FindMany ( )
protecteddefault

Member Function Documentation

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

Definition at line 350 of file FindMany.h.

References art::FindMany< ProdB, Data >::get().

352 {
353  throwIfInvalid();
354  return bCollection_.at(i);
355 }
void throwIfInvalid() const
Definition: FindMany.h:393
template<typename ProdB >
bColl_t& art::FindMany< ProdB, void >::bCollection ( )
inlineprotected

Definition at line 203 of file FindMany.h.

References e.

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

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

Definition at line 361 of file FindMany.h.

References art::FindMany< ProdB, Data >::operator==().

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

363 {
364  throwIfInvalid();
365  const_reference ref(bCollection_.at(i));
366  item.insert(item.end(), ref.begin(), ref.end());
367  return ref.size();
368 }
typename bColl_t::const_reference const_reference
Definition: FindMany.h:159
void throwIfInvalid() const
Definition: FindMany.h:393
template<typename ProdB >
bool art::FindMany< ProdB, void >::isValid ( ) const
inline

Definition at line 341 of file FindMany.h.

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

Definition at line 374 of file FindMany.h.

References bCollection_.

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

375 {
376  throwIfInvalid();
377  return bCollection_ == other.bCollection_;
378 }
void throwIfInvalid() const
Definition: FindMany.h:393
template<typename ProdB >
void art::FindMany< ProdB, void >::setStoredException ( std::shared_ptr< art::Exception const > &&  e)
inlineprotected

Definition at line 384 of file FindMany.h.

References e.

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

385 {
386  storedException_ = std::move(e);
387 }
std::shared_ptr< art::Exception const > storedException_
Definition: FindMany.h:210
Float_t e
Definition: plot.C:34
template<typename ProdB >
auto art::FindMany< ProdB, void >::size ( void  ) const
inline

Definition at line 330 of file FindMany.h.

332 {
333  throwIfInvalid();
334  return bCollection_.size();
335 }
void throwIfInvalid() const
Definition: FindMany.h:393
template<typename ProdB >
void art::FindMany< ProdB, void >::throwIfInvalid ( ) const
inlineprotected

Definition at line 393 of file FindMany.h.

References art::FindMany< ProdB, Data >::FindMany(), and art::errors::LogicError.

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

394 {
395  if (!isValid()) {
396  throw Exception(errors::LogicError, "Invalid FindMany", *storedException_)
397  << "Attempt to use a FindMany where the underlying art::Assns product was not found.";
398  }
399 }
std::shared_ptr< art::Exception const > storedException_
Definition: FindMany.h:210
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Member Data Documentation

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

Definition at line 209 of file FindMany.h.

Referenced by operator==().

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

Definition at line 210 of file FindMany.h.


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