Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
art::Ptr< T > Class Template Reference

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

Public Types

typedef std::size_t key_type
 
typedef T value_type
 
typedef T const * const_pointer
 
typedef T const & const_reference
 

Public Member Functions

 Ptr ()=default
 
template<typename H >
 Ptr (H const &handle, key_type idx)
 
 Ptr (ProductID const id)
 
 Ptr (ProductID const productID, key_type itemKey, EDProductGetter const *prodGetter)
 
template<typename U >
 Ptr (Ptr< U > const &iOther, std::enable_if_t< std::is_base_of< T, U >::value > *dummy=nullptr)
 
template<typename U >
 Ptr (Ptr< U > const &iOther, std::enable_if_t< std::is_base_of< U, T >::value > *dummy=nullptr)
 
 Ptr (ProductID const productID, T const *item, key_type itemKey)
 
T const & operator* () const
 
T const * operator-> () const
 
T const * get () const
 
bool isNull () const
 
bool isNonnull () const
 
bool isAvailable () const
 
ProductID id () const
 
key_type key () const
 
bool hasCache () const
 
RefCore const & refCore () const
 
 operator bool () const
 
EDProductGetter const * productGetter () const
 
template<typename H >
 Ptr (H const &handle, typename Ptr< T >::key_type const idx)
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

template<typename C >
T const * getItem_ (C const *product, key_type iKey)
 
void getData_ () const
 

Private Attributes

RefCore core_ {}
 
key_type key_ {key_traits<key_type>::value}
 

Detailed Description

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

Definition at line 28 of file fwd.h.

Member Typedef Documentation

template<typename T>
typedef T const* art::Ptr< T >::const_pointer

Definition at line 104 of file Ptr.h.

template<typename T>
typedef T const& art::Ptr< T >::const_reference

Definition at line 105 of file Ptr.h.

template<typename T>
typedef std::size_t art::Ptr< T >::key_type

Definition at line 102 of file Ptr.h.

template<typename T>
typedef T art::Ptr< T >::value_type

Definition at line 103 of file Ptr.h.

Constructor & Destructor Documentation

template<typename T>
art::Ptr< T >::Ptr ( )
default
template<typename T>
template<typename H >
art::Ptr< T >::Ptr ( H const &  handle,
key_type  idx 
)
template<typename T >
art::Ptr< T >::Ptr ( ProductID const  id)
inlineexplicit

Definition at line 269 of file Ptr.h.

References art::Ptr< T >::key_.

270  : core_{productID, 0, nullptr}, key_{key_traits<key_type>::value}
271 {}
RefCore core_
Definition: Ptr.h:165
key_type key_
Definition: Ptr.h:166
static constexpr key_type value
Definition: traits.h:40
template<typename T >
art::Ptr< T >::Ptr ( ProductID const  productID,
key_type  itemKey,
EDProductGetter const *  prodGetter 
)
inline

Definition at line 274 of file Ptr.h.

References art::Ptr< T >::key_.

277  : core_{productID, 0, prodGetter}, key_{itemKey}
278 {}
RefCore core_
Definition: Ptr.h:165
key_type key_
Definition: Ptr.h:166
template<typename T>
template<typename U >
art::Ptr< T >::Ptr ( Ptr< U > const &  iOther,
std::enable_if_t< std::is_base_of< T, U >::value > *  dummy = nullptr 
)
inline

Definition at line 282 of file Ptr.h.

References art::Ptr< T >::key().

284  : core_(iOther.id(),
285  (iOther.hasCache() ? static_cast<T const*>(iOther.get()) :
286  static_cast<T const*>(nullptr)),
287  iOther.productGetter())
288  , key_{iOther.key()}
289 {}
RefCore core_
Definition: Ptr.h:165
key_type key_
Definition: Ptr.h:166
double T
Definition: Xdiff_gwt.C:5
template<typename T>
template<typename U >
art::Ptr< T >::Ptr ( Ptr< U > const &  iOther,
std::enable_if_t< std::is_base_of< U, T >::value > *  dummy = nullptr 
)
inline

Definition at line 293 of file Ptr.h.

References submit_syst::const, art::Ptr< T >::get(), art::Ptr< T >::id(), art::Ptr< T >::key_, and T.

295  : core_{iOther.id(), dynamic_cast<T const*>(iOther.get()), nullptr}
296  , key_{iOther.key()}
297 {}
RefCore core_
Definition: Ptr.h:165
key_type key_
Definition: Ptr.h:166
ProductID id() const
Definition: RefCore.h:93
double T
Definition: Xdiff_gwt.C:5
template<typename T>
art::Ptr< T >::Ptr ( ProductID const  productID,
T const *  item,
key_type  itemKey 
)
inline

Definition at line 300 of file Ptr.h.

References art::Ptr< T >::key_.

303  : core_{productID, item, nullptr}, key_{itemKey}
304 {}
RefCore core_
Definition: Ptr.h:165
key_type key_
Definition: Ptr.h:166
template<typename T>
template<typename H >
art::Ptr< T >::Ptr ( H const &  handle,
typename Ptr< T >::key_type const  idx 
)
inline

Definition at line 258 of file Ptr.h.

References art::Ptr< T >::core_, art::Ptr< T >::getItem_(), compare_h5_caf::idx, art::errors::InvalidReference, art::RefCore::isNull(), and art::Ptr< T >::key_.

259  : core_{handle.id(), getItem_(handle.product(), idx), nullptr}, key_{idx}
260 {
261  if (core_.isNull()) {
263  << "Attempt to construct a Ptr from a Handle with invalid ProductID. "
264  "Perhaps a\ndefault-constructed Ptr is what you want?";
265  }
266 }
RefCore core_
Definition: Ptr.h:165
key_type key_
Definition: Ptr.h:166
T const * getItem_(C const *product, key_type iKey)
Definition: Ptr.h:391
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ProductID id() const
Definition: RefCore.h:93
bool isNull() const
Definition: RefCore.h:82

Member Function Documentation

template<typename T>
static short art::Ptr< T >::Class_Version ( )
inlinestatic

Definition at line 155 of file Ptr.h.

156  {
157  return 10;
158  }
template<typename T >
T const * art::Ptr< T >::get ( ) const
inline

Definition at line 321 of file Ptr.h.

References art::Ptr< T >::isNull(), and art::Ptr< T >::operator->().

Referenced by dif::DiFShowerFinder::adjustPlane(), dif::DiFShowerFinder::adjustPlane_end(), chaninfo::CosmicEff::analyze(), comi::NumiFilteringAna::analyze(), showere::ShowerEnergyAna::analyze(), rockmuon::NDRockMuon::analyze(), bpfit::BPFTmvaTrainer::analyze(), bpf::BPFCVNAna::analyze(), ncs::Xeff::analyze(), ncs::ROCKMRE::analyze(), slid::LIDTraining::analyze(), ncs::NCAna::analyze(), fuzz::ViewMatchAlg::CalcEnergyProfile(), nerd::ViewMatchAlg::CalcEnergyProfile(), slid::NuEEnergyAlg::CellEnergy(), cheat::CheckBackTracking::CheckTrackIdToParticle(), bpfit::dEdxCalculator::computeDEDX(), evd::RecoBaseDrawer::DrawTrack2D(), cheat::BackTracker::EnergyFromTrackId(), dif::DiFShowerFinder::eparm(), art::detail::BcollHelper< ProdB >::fill(), caf::FillHadClustVars(), bpfit::BreakPoint::FillHitList(), caf::FillSliceVars(), comi::NumiFiltering::filter(), bsf::BremShowerFilter::filter(), showere::ShowerEnergyFilterMC::filter(), bsf::BremShowerFilter::findShowerByReco(), dif::DiFShowerFinder::findShowerByReco(), bpfit::BreakPoint::FitTracks(), bpfit::DimuonFitter::FitView(), cosrej::CosRejFxs::getBBC(), jmshower::RecoJMShower::GetRVPStats(), rb::HitList::HitList(), cheat::BackTracker::HitToPhotonSignal(), cheat::BackTracker::HitToTrackIDE(), dif::DiFShowerFinder::muonstub(), evg::MCTruthToDk2NuHackItr::Next(), calib::PCHitsList::ProcessTrack(), tf::TimingFit::produce(), nuesand::FillNueSandbox::produce(), presel::NuePresel::produce(), numusand::FillSandbox::produce(), lem::Preselection::produce(), cosrej::CosRej::produce(), earms::ElasticArmsHS::produce(), calib::PCHitsList::produce(), jmshower::NueSel::produce(), rvp::RecVarPID::produce(), g4n::G4Gen::produce(), jmshower::NueSelLID::produce(), bpfit::BPFEnergyEstimator::produce(), bpfit::BPFEnergyEstimatorOnly::produce(), cosrej::MakeNueCosRej::produce(), bpfit::DimuonFitter::produce(), art::Ptr< T >::Ptr(), rb::Cluster::RecoHit(), jmshower::RecoJMShower::RecoShowers(), g4n::G4Alg::RunGeant(), and lem::LEMSummarizer::SliceToLEMInput().

322 {
323  return isNull() ? nullptr : this->operator->();
324 }
T const * operator->() const
Definition: Ptr.h:313
bool isNull() const
Definition: Ptr.h:328
template<typename T >
void art::Ptr< T >::getData_ ( ) const
private

Definition at line 398 of file Ptr.h.

References art::Ptr< T >::core_, e, art::EDProductGetter::getIt(), art::Ptr< T >::hasCache(), art::RefCore::id(), art::Ptr< T >::key(), art::Ptr< T >::key_, art::operator!=(), art::operator==(), stan::math::prod(), art::Ptr< T >::productGetter(), art::errors::ProductNotFound, art::Ptr< T >::refCore(), art::RefCore::setProductPtr(), art::EDProduct::setPtr(), and T.

Referenced by art::Ptr< T >::operator->().

399 {
400  if (!hasCache()) {
401  EDProduct const* prod =
402  productGetter() ? productGetter()->getIt() : nullptr;
403  if (prod == nullptr) {
405  e << "A request to resolve an art::Ptr to a product containing items of "
406  "type: "
407  << cet::demangle_symbol(typeid(T).name()) << " with ProductID "
408  << core_.id()
409  << "\ncannot be satisfied because the product cannot be found.\n";
410  if (productGetter() == nullptr) {
411  e << "The productGetter was not set -- are you trying to dereference a "
412  "Ptr during mixing?\n";
413  } else {
414  e << "Probably the branch containing the product is not stored in the "
415  "input file.\n";
416  }
417  throw e;
418  }
419  void const* ad = nullptr;
420  prod->setPtr(typeid(T), key_, ad);
421  core_.setProductPtr(ad);
422  }
423 }
virtual EDProduct const * getIt() const =0
const XML_Char * name
Definition: expat.h:151
RefCore core_
Definition: Ptr.h:165
EDProductGetter const * productGetter() const
Definition: Ptr.h:383
key_type key_
Definition: Ptr.h:166
bool hasCache() const
Definition: Ptr.h:363
T prod(const std::vector< T > &v)
Definition: prod.hpp:17
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ProductID id() const
Definition: RefCore.h:93
double T
Definition: Xdiff_gwt.C:5
Float_t e
Definition: plot.C:35
void setProductPtr(void const *prodPtr) const
Definition: RefCore.h:111
template<typename T >
template<typename C >
T const * art::Ptr< T >::getItem_ ( C const *  product,
key_type  iKey 
)
inlineprivate

Definition at line 391 of file Ptr.h.

Referenced by art::Ptr< T >::Ptr().

392 {
393  return detail::ItemGetter<T, C>()(product, iKey);
394 }
T product(std::vector< T > dims)
template<typename T >
bool art::Ptr< T >::hasCache ( ) const
inline

Definition at line 363 of file Ptr.h.

References art::Ptr< T >::core_, and art::RefCore::productPtr().

Referenced by art::Ptr< T >::getData_().

364 {
365  return nullptr != core_.productPtr();
366 }
RefCore core_
Definition: Ptr.h:165
void const * productPtr() const
Definition: RefCore.h:99
template<typename T >
auto art::Ptr< T >::id ( ) const
inline

Definition at line 349 of file Ptr.h.

References art::Ptr< T >::core_, and art::RefCore::id().

Referenced by cheat::CheckBackTracking::CheckTrackIdToParticle(), art::PtrRemapper::operator()(), std::hash< art::Ptr< T > >::operator()(), and art::Ptr< T >::Ptr().

350 {
351  return core_.id();
352 }
RefCore core_
Definition: Ptr.h:165
ProductID id() const
Definition: RefCore.h:93
template<typename T >
bool art::Ptr< T >::isAvailable ( ) const
inline

Definition at line 342 of file Ptr.h.

References art::Ptr< T >::core_, and art::RefCore::isAvailable().

Referenced by art::Ptr< T >::operator bool().

343 {
344  return core_.isAvailable();
345 }
RefCore core_
Definition: Ptr.h:165
bool isAvailable() const
template<typename T >
bool art::Ptr< T >::isNonnull ( ) const
inline

Definition at line 335 of file Ptr.h.

References art::Ptr< T >::key_.

Referenced by art::Ptr< T >::isNull(), art::Ptr< T >::operator bool(), and art::PtrRemapper::operator()().

336 {
338 }
key_type key_
Definition: Ptr.h:166
static constexpr key_type value
Definition: traits.h:40
template<typename T >
bool art::Ptr< T >::isNull ( ) const
inline

Definition at line 328 of file Ptr.h.

References art::Ptr< T >::isNonnull().

Referenced by art::Ptr< T >::get(), rb::SecondaryInteraction::ParentTrack(), and cheat::BackTracker::SliceToOrderedNuIds().

329 {
330  return !isNonnull();
331 }
bool isNonnull() const
Definition: Ptr.h:335
template<typename T >
auto art::Ptr< T >::key ( ) const
inline
template<typename T >
art::Ptr< T >::operator bool ( ) const
inlineexplicit

Definition at line 376 of file Ptr.h.

References art::Ptr< T >::isAvailable(), and art::Ptr< T >::isNonnull().

377 {
378  return isNonnull() && isAvailable();
379 }
bool isNonnull() const
Definition: Ptr.h:335
bool isAvailable() const
Definition: Ptr.h:342
template<typename T >
T const & art::Ptr< T >::operator* ( ) const
inline

Definition at line 307 of file Ptr.h.

308 {
309  return *get();
310 }
template<typename T >
T const * art::Ptr< T >::operator-> ( ) const
inline

Definition at line 313 of file Ptr.h.

References submit_syst::const, art::Ptr< T >::core_, art::Ptr< T >::getData_(), art::RefCore::productPtr(), and T.

Referenced by art::Ptr< T >::get().

314 {
315  getData_();
316  return reinterpret_cast<T const*>(core_.productPtr());
317 }
RefCore core_
Definition: Ptr.h:165
void getData_() const
Definition: Ptr.h:398
void const * productPtr() const
Definition: RefCore.h:99
double T
Definition: Xdiff_gwt.C:5
template<typename T >
auto art::Ptr< T >::productGetter ( ) const
inline

Definition at line 383 of file Ptr.h.

References art::Ptr< T >::core_, art::RefCore::productGetter(), and T.

Referenced by art::Ptr< T >::getData_().

384 {
385  return core_.productGetter();
386 }
RefCore core_
Definition: Ptr.h:165
EDProductGetter const * productGetter() const
Definition: RefCore.h:105
template<typename T >
auto art::Ptr< T >::refCore ( ) const
inline

Definition at line 370 of file Ptr.h.

References art::Ptr< T >::core_.

Referenced by art::PtrVector< T >::assign(), art::Ptr< T >::getData_(), art::PtrVector< T >::insert(), and art::PtrVector< T >::push_back().

371 {
372  return core_;
373 }
RefCore core_
Definition: Ptr.h:165

Member Data Documentation

template<typename T>
RefCore art::Ptr< T >::core_ {}
private
template<typename T>
key_type art::Ptr< T >::key_ {key_traits<key_type>::value}
private

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