#include <DataFormats/Common/interface/Ptr.h>
Public Types | |
typedef unsigned long | key_type |
typedef T | value_type |
Public Member Functions | |
T const * | get () const |
Returns C++ pointer to the item. | |
bool | hasCache () const |
ProductID | id () const |
Accessor for product ID. | |
bool | isAvailable () const |
Checks if collection is in memory or available in the event. | |
bool | isNonnull () const |
Checks for non-null. | |
bool | isNull () const |
Checks for null. | |
bool | isTransient () const |
Checks if this Ptr is transient (i.e. not persistable). | |
key_type | key () const |
T const & | operator * () const |
Dereference operator. | |
bool | operator! () const |
Checks for null. | |
T const * | operator-> () const |
Member dereference operator. | |
EDProductGetter const * | productGetter () const |
Accessor for product getter. | |
template<typename U> | |
Ptr (Ptr< U > const &iOther, typename boost::enable_if_c< boost::is_base_of< U, T >::value >::type *=0) | |
template<typename U> | |
Ptr (Ptr< U > const &iOther, typename boost::enable_if_c< boost::is_base_of< T, U >::value >::type *=0) | |
Ptr (Ptr< T > const &iOther) | |
Ptr () | |
Ptr (ProductID const &id) | |
Constructor that creates an invalid ("null") Ptr that is associated with a given product (denoted by that product's ProductID). | |
Ptr (ProductID const &productID, T const *item, key_type item_key) | |
Constructor for use in the various X::fillView(. | |
Ptr (ProductID const &productID, key_type itemKey, EDProductGetter const *prodGetter) | |
Constructor for those users who do not have a product handle, but have a pointer to a product getter (such as the EventPrincipal). | |
template<typename C> | |
Ptr (TestHandle< C > const &handle, key_type itemKey, bool setNow=true) | |
template<typename C> | |
Ptr (C const *product, key_type itemKey, bool setNow=true) | |
template<typename C> | |
Ptr (OrphanHandle< C > const &handle, key_type itemKey, bool setNow=true) | |
template<typename C> | |
Ptr (Handle< C > const &handle, key_type itemKey, bool setNow=true) | |
RefCore const & | refCore () const |
~Ptr () | |
Destructor. | |
Private Member Functions | |
void | getData_ () const |
template<typename C> | |
T const * | getItem_ (C const *product, key_type iKey) |
Ptr (T const *item, key_type item_key) | |
Constructor for extracting a transient Ptr from a PtrVector. | |
Private Attributes | |
RefCore | core_ |
key_type | key_ |
Friends | |
class | PtrVectorBase |
Usage: <usage>
Definition at line 40 of file Ptr.h.
typedef T edm::Ptr< T >::value_type |
edm::Ptr< T >::Ptr | ( | OrphanHandle< C > const & | handle, | |
key_type | itemKey, | |||
bool | setNow = true | |||
) | [inline] |
edm::Ptr< T >::Ptr | ( | TestHandle< C > const & | handle, | |
key_type | itemKey, | |||
bool | setNow = true | |||
) | [inline] |
edm::Ptr< T >::Ptr | ( | ProductID const & | productID, | |
key_type | itemKey, | |||
EDProductGetter const * | prodGetter | |||
) | [inline] |
Constructor for those users who do not have a product handle, but have a pointer to a product getter (such as the EventPrincipal).
prodGetter will ususally be a pointer to the event principal.
Definition at line 77 of file Ptr.h.
00077 : 00078 core_(productID, 0, mustBeNonZero(prodGetter, "Ptr", productID), false), key_(itemKey) { 00079 }
edm::Ptr< T >::Ptr | ( | ProductID const & | productID, | |
T const * | item, | |||
key_type | item_key | |||
) | [inline] |
Constructor for use in the various X::fillView(.
..) functions or for extracting a persistent Ptr from a PtrVector. It is an error (not diagnosable at compile- or run-time) to call this constructor with a pointer to a T unless the pointed-to T object is already in a collection of type C stored in the Event. The given ProductID must be the id of the collection in the Event.
Definition at line 88 of file Ptr.h.
Definition at line 102 of file Ptr.h.
00102 : 00103 core_(), 00104 key_(key_traits<key_type>::value) 00105 {}
Returns C++ pointer to the item.
Definition at line 145 of file Ptr.h.
Referenced by pat::EventHypothesis::getAs(), reco::CaloJet::getCaloConstituent(), pat::MET::MET(), pat::PATObject< ObjectType >::originalObject(), and pat::Tau::Tau().
00145 { 00146 return isNull() ? 0 : this->operator->(); 00147 }
Definition at line 191 of file Ptr.h.
Referenced by edm::Ptr< T >::operator *(), and edm::Ptr< T >::operator->().
00191 { 00192 if(!hasCache() && 0 != productGetter()) { 00193 void const* ad = 0; 00194 const EDProduct* prod = productGetter()->getIt(core_.id()); 00195 if(prod==0) { 00196 throw edm::Exception(errors::ProductNotFound) 00197 << "A request to resolve an edm::Ptr to a product containing items of type: " 00198 << typeid(T).name() 00199 << " with ProductID "<<core_.id() 00200 << "\ncan not be satisfied because the product cannot be found." 00201 << "\nProbably the branch containing the product is not stored in the input file.\n"; 00202 } 00203 prod->setPtr(typeid(T), 00204 key_, 00205 ad); 00206 core_.setProductPtr(ad); 00207 } 00208 }
Definition at line 173 of file Ptr.h.
Referenced by edm::Ptr< pat::MET >::getData_(), and edm::PtrVector< reco::CaloCluster >::push_back().
00173 { return 0!=core_.productPtr(); }
Accessor for product ID.
Definition at line 166 of file Ptr.h.
Referenced by pat::PATUserDataMerger< ObjectType, Operation >::add(), GlobalFitCorrector::correction(), reco::CaloJet::getCaloConstituent(), reco::operator<<(), reco::Jet::print(), PFTopProjector::ptrToAncestor(), and pat::helper::RefHelper< T >::recursiveLookup().
00166 {return core_.id();}
Checks if collection is in memory or available in the event.
No type checking is done.
Definition at line 160 of file Ptr.h.
Referenced by reco::CaloJet::getCaloConstituent(), and pat::PATObject< ObjectType >::originalObject().
00160 {return core_.isAvailable();}
Checks for non-null.
Definition at line 154 of file Ptr.h.
Referenced by pat::helper::AddUserPtr::addData(), reco::CaloJet::getCaloConstituent(), edm::Ptr< pat::MET >::isNull(), reco::Jet::print(), and pat::helper::RefHelper< T >::recursiveLookup().
00154 {return key_traits<key_type>::value != key_;}
Checks for null.
Definition at line 150 of file Ptr.h.
Referenced by edm::Ptr< pat::MET >::get(), edm::Ptr< pat::MET >::operator!(), and pat::PATObject< ObjectType >::originalObject().
00150 {return !isNonnull(); }
Definition at line 171 of file Ptr.h.
Referenced by reco::CaloJet::getCaloConstituent(), reco::FlavorHistory::hasParton(), reco::FlavorHistory::hasProgenitor(), reco::FlavorHistory::hasSister(), reco::FlavorHistory::operator<(), reco::operator<<(), operator<<(), reco::FlavorHistory::operator==(), edm::operator==(), reco::FlavorHistory::operator>(), reco::Jet::print(), and edm::PtrVector< reco::CaloCluster >::push_back().
00171 {return key_;}
T const & Ptr< T >::operator * | ( | ) | const [inline] |
Dereference operator.
Definition at line 229 of file Ptr.h.
References edm::Ptr< T >::core_, edm::Ptr< T >::getData_(), and edm::RefCore::productPtr().
T const * Ptr< T >::operator-> | ( | ) | const [inline] |
Member dereference operator.
Definition at line 238 of file Ptr.h.
References edm::Ptr< T >::core_, edm::Ptr< T >::getData_(), and edm::RefCore::productPtr().
Referenced by edm::Ptr< pat::MET >::get().
EDProductGetter const* edm::Ptr< T >::productGetter | ( | ) | const [inline] |
Accessor for product getter.
Definition at line 169 of file Ptr.h.
Referenced by edm::Ptr< pat::MET >::getData_().
00169 {return core_.productGetter();}
Definition at line 175 of file Ptr.h.
Referenced by edm::operator==(), and edm::PtrVector< reco::CaloCluster >::push_back().
00175 {return core_;}
friend class PtrVectorBase [friend] |
Definition at line 210 of file Ptr.h.
Referenced by edm::Ptr< pat::MET >::getData_(), edm::Ptr< pat::MET >::hasCache(), edm::Ptr< pat::MET >::id(), edm::Ptr< pat::MET >::isAvailable(), edm::Ptr< pat::MET >::isTransient(), edm::Ptr< T >::operator *(), edm::Ptr< T >::operator->(), edm::Ptr< pat::MET >::productGetter(), and edm::Ptr< pat::MET >::refCore().
Definition at line 211 of file Ptr.h.
Referenced by edm::Ptr< pat::MET >::getData_(), edm::Ptr< pat::MET >::isNonnull(), and edm::Ptr< pat::MET >::key().