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/v2_13_00/source/art/Framework/Principal/fwd.h"

Classes

class  HandleTag
 

Public Types

using element_type = T
 

Public Member Functions

constexpr Handle ()=default
 
 Handle (GroupQueryResult 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
 
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 23 of file fwd.h.

Member Typedef Documentation

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

Definition at line 101 of file Handle.h.

Constructor & Destructor Documentation

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

Definition at line 136 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_.

137  : prod_{nullptr}, prov_{gqr.result()}, whyFailed_{gqr.whyFailed()}
138 {
139  if (gqr.succeeded()) {
140  auto const wrapperPtr = dynamic_cast<Wrapper<T> const*>(
141  gqr.result()->uniqueProduct(TypeID{typeid(Wrapper<T>)}));
142  if (wrapperPtr == nullptr) {
144  e << "Product retrieval via Handle<T> succeeded for product:\n"
146  << "but an attempt to interpret it as an object of type '"
147  << cet::demangle_symbol(typeid(T).name()) << "' failed.\n";
148  whyFailed_ = std::make_shared<art::Exception const>(std::move(e));
149  } else {
150  prod_ = wrapperPtr->product();
151  }
152  }
153 }
const XML_Char * name
Definition: expat.h:151
T const * prod_
Definition: Handle.h:127
std::shared_ptr< art::Exception const > whyFailed_
Definition: Handle.h:129
Provenance prov_
Definition: Handle.h:128
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
double T
Definition: Xdiff_gwt.C:5
BranchDescription const & productDescription() const
Definition: Provenance.h:46
Float_t e
Definition: plot.C:35

Member Function Documentation

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

Definition at line 196 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(), remid::ReMIdDedx::analyze(), novaddt::HorizontalMuonAna::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(), art::DataViewImpl::get(), evd::SliceNavigator::GetBounds(), evd::SliceNavigator::GetBox(), art::DataViewImpl::getByLabel(), 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(), regcvntf::RegCVNTF::IsRHC(), nuonecvntf::NuonECVNTF::IsRHC(), cvneventtf::CVNEventTF::IsRHC(), cvnprongtf::CVNProngTF::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(), murem::MRE::produce(), lem::LEM::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().

197 {
198  return whyFailed_.get();
199 }
std::shared_ptr< art::Exception const > whyFailed_
Definition: Handle.h:129
template<class T >
art::ProductID art::Handle< T >::id ( ) const
inline

Definition at line 210 of file Handle.h.

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

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

211 {
212  // FIXME: returning prov_.productID() should be sufficient since
213  // ProductID{} is invalid anyway.
214  return prov_.isValid() ? prov_.productID() : ProductID{};
215 }
bool isValid() const
Definition: Provenance.h:120
ProductID const & productID() const
Definition: Provenance.h:113
Provenance prov_
Definition: Handle.h:128
template<class T >
bool art::Handle< T >::isValid ( ) const
template<class T >
T const & art::Handle< T >::operator* ( ) const
inline

Definition at line 159 of file Handle.h.

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

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

Definition at line 179 of file Handle.h.

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

180 {
181  return product();
182 }
T const * product() const
Definition: Handle.h:166
template<class T >
T const * art::Handle< T >::product ( ) const

Definition at line 166 of file Handle.h.

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

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

167 {
168  if (failedToGet())
169  throw *whyFailed_;
170 
171  if (prod_ == nullptr)
173  << "Attempt to de-reference product that points to 'nullptr'";
174 
175  return prod_;
176 }
T const * prod_
Definition: Handle.h:127
std::shared_ptr< art::Exception const > whyFailed_
Definition: Handle.h:129
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool failedToGet() const
Definition: Handle.h:196
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 229 of file Handle.h.

References std::swap().

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

230 {
231  std::swap(*this, other);
232 }
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
template<class T >
std::shared_ptr< art::Exception const > art::Handle< T >::whyFailed ( ) const
inline

Definition at line 219 of file Handle.h.

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

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

220 {
221  return whyFailed_;
222 }
std::shared_ptr< art::Exception const > whyFailed_
Definition: Handle.h:129

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: