Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
art::FindOne< ProdB, void > Class Template Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/canvas/v3_06_01/source/canvas/Persistency/Common/FindOne.h"

Public Types

using assoc_t = ProdB
 
using bColl_t = 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
 

Public Member Functions

template<typename Handle , typename DataContainer , typename Tag >
 FindOne (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 >
 FindOne (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 >
 FindOne (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 >
 FindOne (std::initializer_list< Ptr< ProdA > > const &ptrs, DataContainer const &dc, Tag const &tag)
 
bool isValid () const
 
size_type size () const
 
cet::maybe_ref< assoc_t const > at (size_type i) const
 
void get (size_type i, cet::maybe_ref< assoc_t const > &item) const
 
bool operator== (FindOne< ProdB, void > const &other) const
 

Protected Member Functions

 FindOne ()=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_ {}
 

Detailed Description

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

Definition at line 143 of file FindOne.h.

Member Typedef Documentation

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

Definition at line 146 of file FindOne.h.

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

Definition at line 151 of file FindOne.h.

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

Definition at line 156 of file FindOne.h.

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

Definition at line 155 of file FindOne.h.

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

Definition at line 157 of file FindOne.h.

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

Definition at line 154 of file FindOne.h.

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

Definition at line 153 of file FindOne.h.

Constructor & Destructor Documentation

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

Definition at line 281 of file FindOne.h.

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

285 {
286  using ProdA = typename Handle::element_type::value_type;
287  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{dc, detail::input_tag(tag)};
288  storedException_ = finder(*aCollection, bCollection_);
289 }
InputTag input_tag(InputTag const &tag)
Definition: IPRHelper.h:21
std::shared_ptr< art::Exception const > storedException_
Definition: FindOne.h:208
template<typename ProdB >
template<typename ProdAColl , typename DataContainer , typename Tag >
art::FindOne< ProdB, void >::FindOne ( 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 294 of file FindOne.h.

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

298 {
299  using ProdA = std::remove_const_t<std::remove_pointer_t<typename ProdAColl::value_type>>;
300  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{dc, detail::input_tag(tag)};
302 }
InputTag input_tag(InputTag const &tag)
Definition: IPRHelper.h:21
std::shared_ptr< art::Exception const > storedException_
Definition: FindOne.h:208
template<typename ProdB >
template<typename PtrProdAColl , typename DataContainer , typename Tag >
art::FindOne< ProdB, void >::FindOne ( 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 307 of file FindOne.h.

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

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

Definition at line 321 of file FindOne.h.

References art::detail::input_tag(), and gen_flatrecord::size.

324 {
325  detail::IPRHelper<ProdA, ProdB, void, void, DataContainer> finder{dc, detail::input_tag(tag)};
326  storedException_ = finder(ptrs, bCollection_);
327 }
InputTag input_tag(InputTag const &tag)
Definition: IPRHelper.h:21
std::shared_ptr< art::Exception const > storedException_
Definition: FindOne.h:208
template<typename ProdB >
art::FindOne< ProdB, void >::FindOne ( )
protecteddefault

Member Function Documentation

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

Definition at line 353 of file FindOne.h.

References art::FindOne< ProdB, Data >::get(), and MECModelEnuComparisons::i.

360 {
361  throwIfInvalid();
362 #ifdef ART_IPR_BY_PTR
363  return bCollection_.at(i);
364 #else
366 #endif
367 }
void throwIfInvalid() const
Definition: FindOne.h:412
template<typename ProdB >
bColl_t& art::FindOne< ProdB, void >::bCollection ( )
inlineprotected

Definition at line 201 of file FindOne.h.

References e.

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

201 { return bCollection_; }
template<typename ProdB >
void art::FindOne< ProdB, void >::get ( size_type  i,
cet::maybe_ref< assoc_t const > &  item 
) const
inline

Definition at line 373 of file FindOne.h.

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

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

380 {
381  throwIfInvalid();
382 #ifdef ART_IPR_BY_PTR
383  item = bCollection_.at(i);
384 #else
385  item.reseat(*bCollection_.at(i));
386 #endif
387 }
void throwIfInvalid() const
Definition: FindOne.h:412
void reseat()
Definition: maybe_ref.h:67
template<typename ProdB >
bool art::FindOne< ProdB, void >::isValid ( ) const
inline

Definition at line 344 of file FindOne.h.

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

345 {
346  return storedException_.get() == nullptr;
347 }
std::shared_ptr< art::Exception const > storedException_
Definition: FindOne.h:208
template<typename ProdB >
bool art::FindOne< ProdB, void >::operator== ( FindOne< ProdB, void > const &  other) const
inline

Definition at line 393 of file FindOne.h.

References bCollection_.

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

394 {
395  throwIfInvalid();
396  return bCollection_ == other.bCollection_;
397 }
void throwIfInvalid() const
Definition: FindOne.h:412
template<typename ProdB >
void art::FindOne< ProdB, void >::setStoredException ( std::shared_ptr< art::Exception const > &&  e)
inlineprotected

Definition at line 403 of file FindOne.h.

References e.

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

404 {
405  storedException_ = std::move(e);
406 }
Float_t e
Definition: plot.C:35
std::shared_ptr< art::Exception const > storedException_
Definition: FindOne.h:208
template<typename ProdB >
auto art::FindOne< ProdB, void >::size ( void  ) const
inline

Definition at line 333 of file FindOne.h.

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

Definition at line 412 of file FindOne.h.

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

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

413 {
414  if (!isValid()) {
415  throw Exception(errors::LogicError, "Invalid FindOne", *storedException_)
416  << "Attempt to use a FindOne where the underlying art::Assns product was not found.";
417  }
418 }
bool isValid() const
Definition: FindOne.h:344
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::shared_ptr< art::Exception const > storedException_
Definition: FindOne.h:208

Member Data Documentation

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

Definition at line 207 of file FindOne.h.

Referenced by operator==().

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

Definition at line 208 of file FindOne.h.


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