LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::ValidHandle< T > Class Template Reference

#include "Handle.h"

Classes

class  HandleTag
 

Public Types

using element_type = T
 

Public Member Functions

 ~ValidHandle ()=default
 
 ValidHandle ()=delete
 
 ValidHandle (T const *prod, EDProductGetter const *productGetter, Provenance prov)
 
 ValidHandle (ValidHandle const &)=default
 
 ValidHandle (ValidHandle &&)=default
 
ValidHandleoperator= (ValidHandle const &)&=default
 
ValidHandleoperator= (ValidHandle &&)&=default
 
 operator T const * () const
 
T const & operator* () const
 
T const * operator-> () const
 
T const * product () const
 
bool isValid () const
 
bool failedToGet () const
 
Provenance const * provenance () const
 
ProductID id () const
 
std::shared_ptr< art::Exception const > whyFailed () const
 
EDProductGetter const * productGetter () const noexcept
 
void swap (ValidHandle< T > &other)
 

Private Attributes

T const * prod_
 
EDProductGetter const * productGetter_
 
Provenance prov_
 

Detailed Description

template<typename T>
class art::ValidHandle< T >

Definition at line 53 of file Handle.h.

Member Typedef Documentation

template<typename T>
using art::ValidHandle< T >::element_type = T

Definition at line 290 of file Handle.h.

Constructor & Destructor Documentation

template<typename T>
art::ValidHandle< T >::~ValidHandle ( )
default
template<typename T>
art::ValidHandle< T >::ValidHandle ( )
delete
template<class T >
art::ValidHandle< T >::ValidHandle ( T const *  prod,
EDProductGetter const *  productGetter,
Provenance  prov 
)
explicit

Definition at line 330 of file Handle.h.

References art::errors::NullPointerError, art::ValidHandle< T >::prod_, art::ValidHandle< T >::productGetter(), art::ValidHandle< T >::productGetter_, and art::ValidHandle< T >::prov_.

333  : prod_{prod}, productGetter_{productGetter}, prov_{prov}
334 {
335  if (prod_ == nullptr) {
337  << "Attempt to create ValidHandle with null pointer";
338  }
339 }
Provenance prov_
Definition: Handle.h:326
EDProductGetter const * productGetter_
Definition: Handle.h:325
EDProductGetter const * productGetter() const noexcept
Definition: Handle.h:412
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
T const * prod_
Definition: Handle.h:324
template<typename T>
art::ValidHandle< T >::ValidHandle ( ValidHandle< T > const &  )
default
template<typename T>
art::ValidHandle< T >::ValidHandle ( ValidHandle< T > &&  )
default

Member Function Documentation

template<class T >
bool art::ValidHandle< T >::failedToGet ( ) const
inline

Definition at line 377 of file Handle.h.

378 {
379  return false;
380 }
template<class T >
art::ProductID art::ValidHandle< T >::id ( ) const
inline

Definition at line 391 of file Handle.h.

References art::Provenance::productID(), and art::ValidHandle< T >::prov_.

392 {
393  return prov_.productID();
394 }
Provenance prov_
Definition: Handle.h:326
ProductID productID() const noexcept
Definition: Provenance.cc:72
template<class T >
bool art::ValidHandle< T >::isValid ( ) const
inline

Definition at line 370 of file Handle.h.

371 {
372  return true;
373 }
template<class T >
art::ValidHandle< T >::operator T const * ( ) const
inline

Definition at line 342 of file Handle.h.

References art::ValidHandle< T >::prod_.

343 {
344  return prod_;
345 }
T const * prod_
Definition: Handle.h:324
template<class T >
T const & art::ValidHandle< T >::operator* ( ) const
inline

Definition at line 349 of file Handle.h.

References art::ValidHandle< T >::prod_.

350 {
351  return *prod_;
352 }
T const * prod_
Definition: Handle.h:324
template<class T >
T const * art::ValidHandle< T >::operator-> ( ) const
inline

Definition at line 356 of file Handle.h.

References art::ValidHandle< T >::prod_.

357 {
358  return prod_;
359 }
T const * prod_
Definition: Handle.h:324
template<typename T>
ValidHandle& art::ValidHandle< T >::operator= ( ValidHandle< T > const &  )
default
template<typename T>
ValidHandle& art::ValidHandle< T >::operator= ( ValidHandle< T > &&  )
default
template<class T >
T const * art::ValidHandle< T >::product ( ) const
inline

Definition at line 363 of file Handle.h.

References art::ValidHandle< T >::prod_.

Referenced by sim::DumpMCTruth::analyze(), sim::DumpGTruth::analyze(), and art::ProductRetriever::getValidHandle().

364 {
365  return prod_;
366 }
T const * prod_
Definition: Handle.h:324
template<typename T >
art::EDProductGetter const * art::ValidHandle< T >::productGetter ( ) const
inlinenoexcept
template<class T >
art::Provenance const * art::ValidHandle< T >::provenance ( ) const
inline

Definition at line 384 of file Handle.h.

References art::ValidHandle< T >::prov_.

385 {
386  return &prov_;
387 }
Provenance prov_
Definition: Handle.h:326
template<class T >
void art::ValidHandle< T >::swap ( art::ValidHandle< T > &  other)
inline

Definition at line 405 of file Handle.h.

References art::swap().

406 {
407  std::swap(*this, other);
408 }
void swap(ValidHandle< T > &a, ValidHandle< T > &b)
template<class T >
std::shared_ptr< art::Exception const > art::ValidHandle< T >::whyFailed ( ) const
inline

Definition at line 398 of file Handle.h.

399 {
400  return std::shared_ptr<art::Exception const>();
401 }

Member Data Documentation

template<typename T>
EDProductGetter const* art::ValidHandle< T >::productGetter_
private
template<typename T>
Provenance art::ValidHandle< T >::prov_
private

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