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

#include "/cvmfs/nova.opensciencegrid.org/externals/art/v3_05_01/source/art/Framework/Principal/fwd.h"

Classes

class  HandleTag
 

Public Types

using element_type = T
 

Public Member Functions

 ~Handle ()=default
 
constexpr Handle ()=default
 
 Handle (GroupQueryResult const &)
 
 Handle (Handle const &)=default
 
 Handle (Handle &&)=default
 
Handleoperator= (Handle const &)=default
 
Handleoperator= (Handle &&)=default
 
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
 
void swap (Handle< T > &other)
 
void clear ()
 

Private Attributes

T const * prod_ {nullptr}
 
Provenance prov_ {}
 
std::shared_ptr< art::Exception const > whyFailed_ {nullptr}
 

Detailed Description

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

Definition at line 19 of file fwd.h.

Member Typedef Documentation

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

Definition at line 92 of file Handle.h.

Constructor & Destructor Documentation

template<typename T>
art::Handle< T >::~Handle ( )
default
template<typename T>
constexpr art::Handle< T >::Handle ( )
explicitdefault
template<class T >
art::Handle< T >::Handle ( GroupQueryResult const &  gqr)
explicit

Definition at line 131 of file Handle.h.

References submit_syst::const, e, art::errors::LogicError, art::Handle< T >::prod_, art::Provenance::productDescription(), art::Handle< T >::prov_, T, and art::Handle< T >::whyFailed_.

132  : prod_{nullptr}, prov_{gqr.result()}, whyFailed_{gqr.whyFailed()}
133 {
134  if (gqr.succeeded()) {
135  auto const wrapperPtr = dynamic_cast<Wrapper<T> const*>(
136  gqr.result()->uniqueProduct(TypeID{typeid(Wrapper<T>)}));
137  if (wrapperPtr != nullptr) {
138  prod_ = wrapperPtr->product();
139  } else {
141  e << "Product retrieval via Handle<T> succeeded for product:\n"
143  << "but an attempt to interpret it as an object of type '"
144  << cet::demangle_symbol(typeid(T).name()) << "' failed.\n";
145  whyFailed_ = std::make_shared<art::Exception const>(std::move(e));
146  }
147  }
148 }
const XML_Char * name
Definition: expat.h:151
T const * prod_
Definition: Handle.h:122
std::shared_ptr< art::Exception const > whyFailed_
Definition: Handle.h:124
Provenance prov_
Definition: Handle.h:123
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
double T
Definition: Xdiff_gwt.C:5
BranchDescription const & productDescription() const
Float_t e
Definition: plot.C:35
template<typename T>
art::Handle< T >::Handle ( Handle< T > const &  )
default
template<typename T>
art::Handle< T >::Handle ( Handle< T > &&  )
default

Member Function Documentation

template<class T >
void art::Handle< T >::clear ( )
template<class T >
bool art::Handle< T >::failedToGet ( ) const

Definition at line 190 of file Handle.h.

References art::Handle< T >::whyFailed_.

Referenced by caf::CAFMaker::AddMCTruthToVec(), highe::HighEnergyAna::analyze(), spilltime::analyze(), cheat::RecoCheckAna::analyze(), novaddt::RateMonitor::analyze(), CerenkovSelection::analyze(), novaddt::HorizontalMuonAna::analyze(), remid::ReMIdDedx::analyze(), novaddt::SendTriggerSignal::analyze(), earms::ElasticArmsValidate::analyze(), mono::SlowMonopoleAna::analyze(), remid::ReMIdDedxRock::analyze(), ncpi0::TwoProngBDTAna::analyze(), fuzz::FuzzyKValidate::analyze(), remid::ReMIdDedxStudies::analyze(), mono::Monopole::analyze(), LightLevels::analyze(), CerenkovResponse::analyze(), ncs::ROCKMRE::analyze(), ncs::NCAna::analyze(), htk::HoughTrack::analyze(), red::EWCosmics::analyze(), lem::MakeMatches::beginRun(), lem::MakePID::beginRun(), comi::NumiFilteringAna::beginSubRun(), air::AirKalmanAna::beginSubRun(), trk::CosmicTrackAna::beginSubRun(), calib::SumRunsCalib::endRun(), calib::AttenFit::endRun(), calib::SumSubrunsCalib::endSubRun(), calib::PEResponse::endSubRun(), calib::AttenFit::endSubRun(), slicer::SlicerAna::endSubRun(), bpfit::BPFTmvaTrainer::endSubRun(), bpfit::BreakPointProtonAna::endSubRun(), ncs::Xbeam::endSubRun(), ncs::Xeff::endSubRun(), ncs::ROCKMRE::endSubRun(), ncs::NCAna::endSubRun(), caf::CAFMaker::endSubRun(), filter::Filter::FillDigitVariables(), filter::Filter::FillG4GenVariables(), skim::CosmicBeamComparison::FillNueHistograms(), filter::Filter::FillSliceVariables(), caf::CAFMaker::FillSpillVars(), filter::Filter::FillTrackVariables(), filter::Filter::FillTruthVariables(), evgen::CRVFilter::filter(), evgen::OccupiedSpillFilter::filter(), novaddt::HorizontalMuonTrigger::filter(), chaninfo::FindSwappedChannels::filter(), evd::SliceNavigator::GetBounds(), evd::SliceNavigator::GetBox(), caf::CAFMaker::GetByLabelIfExists(), caf::CAFMaker::GetByLabelStrict(), SliceLID::FillSliceLID::getIsRHC(), LSTME::FillLSTME::getIsRHC(), evd::SliceNavigator::GetProducts(), evd::SliceNavigator::GetProductsImplPart(), evd::RawDataDrawer::GetRawDigits(), remid::RecoMuon::Init(), skim::EvaluatorNumu::Initialize(), skim::EvaluatorNue::Initialize(), nuonecvntf::NuonECVNTF::IsRHC(), regcvntf::RegCVNTF::IsRHC(), cvnprongtf::CVNProngTF::IsRHC(), cvneventtf::CVNEventTF::IsRHC(), cosrej::MakeNueCosRej::IsRHC(), evd::SliceNavigator::postProcessEvent(), chaninfo::BadChanList::preBeginEvent(), photrans::FiberBrightness::preBeginRun(), nova::dbi::RunHistoryService::preBeginRun(), nova::dbi::RunHistoryService::preBeginSubrun(), cosrej::CosRej::produce(), numue::NumuEnergy::produce(), lem::MakeLibrary::produce(), ndreco::NDReco::produce(), ifdb::IFDBSpillInfo::produce(), ncpi0::MakeNCPi0BkgRej::produce(), rwgt::MakeGENIEReweightTable::produce(), lem::LEM::produce(), murem::MRE::produce(), dqsf::DQSpillFlags::produce(), lem::LEMWorkerOutput::produce(), ifdb::MIN::produce(), murem::MergeTruth::produce(), art::Handle< T >::product(), calib::SumAttenuationProfiles::readResults(), calib::AttenuationFit::readResults(), cheat::BackTracker::Rebuild(), skim::NumuCCpiSkimmer::Skim(), skim::NumuSkimmer::Skim(), skim::NueSkimmer::Skim(), and evd::SliceNavigator::SlicesToNavigate().

191 {
192  return whyFailed_.get();
193 }
std::shared_ptr< art::Exception const > whyFailed_
Definition: Handle.h:124
template<class T >
art::ProductID art::Handle< T >::id ( ) const
inline

Definition at line 204 of file Handle.h.

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

Referenced by art::DataViewImpl::removeCachedProduct().

205 {
206  // FIXME: returning prov_.productID() should be sufficient since
207  // ProductID{} is invalid anyway.
208  return prov_.isValid() ? prov_.productID() : ProductID{};
209 }
bool isValid() const
ProductID productID() const
Provenance prov_
Definition: Handle.h:123
template<class T >
bool art::Handle< T >::isValid ( ) const
template<class T >
T const & art::Handle< T >::operator* ( ) const
inline

Definition at line 154 of file Handle.h.

References art::Handle< T >::product(), and T.

155 {
156  return *product();
157 }
T const * product() const
Definition: Handle.h:161
template<class T >
T const * art::Handle< T >::operator-> ( ) const
inline

Definition at line 173 of file Handle.h.

References art::Handle< T >::product().

174 {
175  return product();
176 }
T const * product() const
Definition: Handle.h:161
template<typename T>
Handle& art::Handle< T >::operator= ( Handle< T > const &  )
default
template<typename T>
Handle& art::Handle< T >::operator= ( Handle< T > &&  )
default
template<class T >
T const * art::Handle< T >::product ( ) const

Definition at line 161 of file Handle.h.

References art::Handle< T >::failedToGet(), art::errors::NullPointerError, art::Handle< T >::prod_, and art::Handle< T >::whyFailed_.

Referenced by art::DataViewImpl::getPointerByLabel(), art::DataViewImpl::getValidHandle(), art::Handle< T >::operator*(), and art::Handle< T >::operator->().

162 {
163  if (failedToGet()) {
164  throw *whyFailed_;
165  }
166  if (prod_ == nullptr)
168  << "Attempt to de-reference product that points to 'nullptr'.\n";
169  return prod_;
170 }
T const * prod_
Definition: Handle.h:122
std::shared_ptr< art::Exception const > whyFailed_
Definition: Handle.h:124
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool failedToGet() const
Definition: Handle.h:190
template<class T >
art::Provenance const * art::Handle< T >::provenance ( ) const
inline
template<class T>
void art::Handle< T >::swap ( Handle< T > &  other)

Definition at line 223 of file Handle.h.

References art::swap().

Referenced by art::Handle< T >::clear(), and art::convert_handle().

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

Definition at line 213 of file Handle.h.

References art::Handle< T >::whyFailed_.

Referenced by novaddt::HorizontalMuonAna::analyze(), and novaddt::HorizontalMuonTrigger::filter().

214 {
215  return whyFailed_;
216 }
std::shared_ptr< art::Exception const > whyFailed_
Definition: Handle.h:124

Member Data Documentation

template<typename T>
T const* art::Handle< T >::prod_ {nullptr}
private
template<typename T>
Provenance art::Handle< T >::prov_ {}
private
template<typename T>
std::shared_ptr<art::Exception const> art::Handle< T >::whyFailed_ {nullptr}
private

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