CMS 3D CMS Logo

edm::RefToBase< T > Class Template Reference

#include <DataFormats/Common/interface/RefToBase.h>

List of all members.

Public Types

typedef T value_type

Public Member Functions

template<class REF>
REF castTo () const
 cast to a concrete type
value_type const * get () const
bool hasProductCache () const
std::auto_ptr
< reftobase::RefHolderBase
holder () const
ProductID id () const
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.
size_t key () const
value_type const & operator * () const
bool operator! () const
 Checks for null.
bool operator!= (RefToBase const &rhs) const
value_type const * operator-> () const
RefToBase const & operator= (RefToBase const &rhs)
bool operator== (RefToBase const &rhs) const
void const * product () const
EDProductGetter const * productGetter () const
 RefToBase (boost::shared_ptr< reftobase::RefHolderBase > p)
template<typename T1>
 RefToBase (RefToBase< T1 > const &r)
 RefToBase (Handle< View< T > > const &handle, size_t i)
 RefToBase (RefToBaseProd< T > const &r, size_t i)
template<typename C>
 RefToBase (RefProd< C > const &r)
template<typename C1, typename T1, typename F1>
 RefToBase (Ref< C1, T1, F1 > const &r)
 RefToBase (RefToBase const &other)
 RefToBase ()
void swap (RefToBase &other)
 ~RefToBase ()

Private Member Functions

value_type const * getPtrImpl () const

Private Attributes

reftobase::BaseHolder
< value_type > * 
holder_

Friends

class RefToBase
class RefToBaseProd< T >
class RefToBaseVector< T >


Detailed Description

template<class T>
class edm::RefToBase< T >

Definition at line 65 of file RefToBase.h.


Member Typedef Documentation

template<class T>
typedef T edm::RefToBase< T >::value_type

Definition at line 68 of file RefToBase.h.


Constructor & Destructor Documentation

template<class T>
edm::RefToBase< T >::RefToBase (  ) 

template<class T>
RefToBase::RefToBase ( RefToBase< T > const &  other  )  [inline]

Definition at line 132 of file RefToBase.h.

00132                                                 : 
00133     holder_(other.holder_  ? other.holder_->clone() : 0)
00134   { }

template<class T>
template<typename C1, typename T1, typename F1>
RefToBase::RefToBase ( Ref< C1, T1, F1 > const &  r  )  [inline, explicit]

Definition at line 139 of file RefToBase.h.

00139                                                      : 
00140     holder_(new reftobase::Holder<T,Ref<C1, T1, F1> >(iRef)) 
00141   { }

template<class T>
template<typename C>
RefToBase::RefToBase ( RefProd< C > const &  r  )  [inline, explicit]

Definition at line 146 of file RefToBase.h.

00146                                                 : 
00147     holder_(new reftobase::Holder<T,RefProd<C> >(iRef)) 
00148   { }

template<class T>
RefToBase::RefToBase ( RefToBaseProd< T > const &  r,
size_t  i 
) [inline]

Definition at line 361 of file RefToBase.h.

00361                                                              :
00362     holder_( r.operator->()->refAt( i ).holder_->clone() ) {
00363   }

template<typename T>
RefToBase::RefToBase ( Handle< View< T > > const &  handle,
size_t  i 
) [inline]

Definition at line 367 of file RefToBase.h.

00367                                                                   :
00368     holder_( handle.operator->()->refAt( i ).holder_->clone() ) {
00369   }

template<class T>
template<typename T1>
RefToBase::RefToBase ( RefToBase< T1 > const &  r  )  [inline, explicit]

Definition at line 153 of file RefToBase.h.

References value.

00153                                                    : 
00154         holder_(new reftobase::IndirectHolder<T> (
00155              boost::shared_ptr< edm::reftobase::RefHolderBase>(iRef.holder().release())
00156         ) ) 
00157   {
00158     // OUT: holder_( new reftobase::Holder<T,RefToBase<T1> >(iRef ) )  { 
00159     // Forcing the conversion through IndirectHolder,
00160     //   as Holder<T,RefToBase<T1>> would need dictionaries we will never have.
00161     // In this way we only need the IndirectHolder<T> and the RefHolder of the real type of the item
00162     // This might cause a small performance penalty.
00163     BOOST_STATIC_ASSERT( ( boost::is_base_of<T, T1>::value ) );
00164   }

template<class T>
RefToBase::RefToBase ( boost::shared_ptr< reftobase::RefHolderBase p  )  [inline]

Definition at line 168 of file RefToBase.h.

00168                                                                    : 
00169     holder_(new reftobase::IndirectHolder<T>(p))
00170   { }

template<class T>
RefToBase::~RefToBase (  )  [inline]

Definition at line 174 of file RefToBase.h.

References edm::RefToBase< T >::holder_.

00175   {
00176     delete holder_; 
00177   }


Member Function Documentation

template<class T>
template<class REF>
REF RefToBase::castTo (  )  const [inline]

cast to a concrete type

Definition at line 237 of file RefToBase.h.

References edm::reftobase::RefHolder< REF >::getRef(), edm::RefToBase< T >::holder_, edm::errors::InvalidReference, and name.

Referenced by ZMuMuAnalyzer_cynematics::analyze(), ZMuMuEfficiency::analyze(), ZToMuMuHistogrammer::analyze(), ZMuMuAnalyzer::analyze(), ZToMuMuFilter::filter(), GsfElectronAlgo::getTrSuperCluster(), PFBlockAlgo::niAssocToTrack(), reco::PFTauDecayMode::pfMasterClones(), pat::PATPhotonProducer::produce(), and ZToLLEdmNtupleDumper::produce().

00238   {
00239     if (!holder_)
00240       {
00241         throw edm::Exception(errors::InvalidReference)
00242           << "attempting to cast a null RefToBase;\n"
00243           << "You should check for nullity before casting.";
00244       }
00245 
00246     reftobase::RefHolder<REF> concrete_holder;
00247     std::string hidden_ref_type;
00248     if (!holder_->fillRefIfMyTypeMatches(concrete_holder,
00249                                          hidden_ref_type))
00250       {
00251         throw edm::Exception(errors::InvalidReference)
00252           << "cast to type: " << typeid(REF).name()
00253           << "\nfrom type: " << hidden_ref_type
00254           << " failed. Catch this exception in case you need to check"
00255           << " the concrete reference type.";
00256       }
00257     return concrete_holder.getRef();
00258   }

template<class T>
T const * RefToBase::get ( void   )  const [inline]

Definition at line 208 of file RefToBase.h.

References edm::RefToBase< T >::getPtrImpl().

Referenced by TestOutliers::analyze(), edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), reco::GenJet::genParticle(), reco::Candidate::get(), reco::PFJet::getPFCandidate(), JetMaker::makeSpecific(), pat::MET::MET(), pat::PATJetProducer::produce(), edm::View< T >::ptrAt(), pat::Tau::Tau(), pat::VertexAssociation::track(), and edm::View< T >::View().

00209   {
00210     return getPtrImpl();
00211   }

template<class T>
T const * RefToBase::getPtrImpl (  )  const [inline, private]

Definition at line 334 of file RefToBase.h.

References edm::RefToBase< T >::holder_.

Referenced by edm::RefToBase< T >::get(), edm::RefToBase< T >::operator *(), and edm::RefToBase< T >::operator->().

00335   {
00336     return holder_ ? holder_->getPtr() : 0;
00337   }

template<class T>
bool RefToBase::hasProductCache (  )  const [inline]

Definition at line 321 of file RefToBase.h.

References edm::RefToBase< T >::holder_.

00321                                            {
00322     return holder_->hasProductCache();
00323   }

template<class T>
std::auto_ptr< reftobase::RefHolderBase > RefToBase::holder (  )  const [inline]

Definition at line 340 of file RefToBase.h.

References edm::RefToBase< T >::holder_.

00340                                                                  {
00341     return holder_->holder();
00342   }

template<class T>
ProductID RefToBase::id ( void   )  const [inline]

Definition at line 216 of file RefToBase.h.

References edm::RefToBase< T >::holder_.

Referenced by HLTMuonRecoDQMSource::analyze(), edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), edm::RefToBase< T >::isNull(), BTagPerformanceAnalyzerOnData::JetRefCompare::operator()(), BTagPerformanceAnalyzerMC::JetRefCompare::operator()(), BTagPerformanceAnalyzer::JetRefCompare::operator()(), edm::View< T >::ptrAt(), edm::RefToBaseProd< T >::RefToBaseProd(), and edm::View< T >::View().

00217   { 
00218     return  holder_ ? holder_->id() : ProductID();
00219   }

template<class T>
bool edm::RefToBase< T >::isAvailable (  )  const [inline]

Checks if collection is in memory or available in the Event.

No type checking is done.

Definition at line 111 of file RefToBase.h.

Referenced by edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), and edm::View< T >::ptrAt().

00111 { return holder_->isAvailable(); }

template<class T>
bool RefToBase::isNonnull (  )  const [inline]

Checks for non-null.

Definition at line 273 of file RefToBase.h.

References edm::RefToBase< T >::isNull().

Referenced by RecoTracktoTP::matched(), TPtoRecoTrack::matchedA(), TPtoRecoTrack::matchedB(), SoftLepton::refineJetAxis(), RecoTracktoTP::RT(), TPtoRecoTrack::RTA(), and TPtoRecoTrack::RTB().

00274   {
00275     return !isNull(); 
00276   }

template<class T>
bool RefToBase::isNull (  )  const [inline]

Checks for null.

Definition at line 264 of file RefToBase.h.

References edm::RefToBase< T >::id(), and edm::ProductID::isValid().

Referenced by pat::helper::VertexingHelper::associate(), edm::RefToBaseVector< T >::fillView(), pat::VertexAssociation::hasTrack(), edm::RefToBase< T >::isNonnull(), edm::RefToBase< T >::operator!(), and reco::CaloRecHitCandidate::overlap().

00265   { 
00266     return !id().isValid();
00267   }

template<class T>
size_t RefToBase::key (  )  const [inline]

Definition at line 224 of file RefToBase.h.

References edm::RefToBase< T >::holder_, and edm::errors::InvalidReference.

Referenced by HLTMuonRecoDQMSource::analyze(), edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), BTagPerformanceAnalyzerOnData::JetRefCompare::operator()(), BTagPerformanceAnalyzerMC::JetRefCompare::operator()(), BTagPerformanceAnalyzer::JetRefCompare::operator()(), edm::View< T >::ptrAt(), and edm::View< T >::View().

00225   { 
00226     if ( holder_ == 0 )
00227         throw edm::Exception(errors::InvalidReference)
00228           << "attempting get key from  null RefToBase;\n"
00229           << "You should check for nullity before calling key().";
00230     return  holder_->key();
00231   }

template<class T>
T const & RefToBase::operator * (  )  const [inline]

Definition at line 192 of file RefToBase.h.

References edm::RefToBase< T >::getPtrImpl().

00193   {
00194     return *getPtrImpl(); 
00195   }

template<class T>
bool RefToBase::operator! (  )  const [inline]

Checks for null.

Definition at line 282 of file RefToBase.h.

References edm::RefToBase< T >::isNull().

00283   {
00284     return isNull(); 
00285   }

template<class T>
bool RefToBase::operator!= ( RefToBase< T > const &  rhs  )  const [inline]

Definition at line 300 of file RefToBase.h.

00301   {
00302     return !(*this == rhs);
00303   }

template<class T>
T const * RefToBase::operator-> (  )  const [inline]

Definition at line 200 of file RefToBase.h.

References edm::RefToBase< T >::getPtrImpl().

00201   {
00202     return getPtrImpl();
00203   }

template<class T>
RefToBase< T > const & RefToBase::operator= ( RefToBase< T > const &  rhs  )  [inline]

Definition at line 182 of file RefToBase.h.

References edm::RefToBase< T >::swap(), and pyDBSRunClass::temp.

00183   {
00184     RefToBase<T> temp( iRHS);
00185     temp.swap(*this);
00186     return *this; 
00187   }

template<class T>
bool RefToBase::operator== ( RefToBase< T > const &  rhs  )  const [inline]

Definition at line 290 of file RefToBase.h.

References edm::RefToBase< T >::holder_.

00291   {
00292     return holder_
00293       ? holder_->isEqualTo(*rhs.holder_)
00294       : holder_ == rhs.holder_;
00295   }

template<class T>
void const * RefToBase::product (  )  const [inline]

Definition at line 327 of file RefToBase.h.

References edm::RefToBase< T >::holder_.

Referenced by edm::RefToBaseProd< T >::RefToBaseProd().

00327                                            {
00328     return holder_->product();
00329   }

template<class T>
EDProductGetter const * RefToBase::productGetter (  )  const [inline]

Definition at line 315 of file RefToBase.h.

References edm::RefToBase< T >::holder_.

Referenced by edm::View< T >::View().

00315                                                            {
00316     return holder_->productGetter();
00317   }

template<class T>
void RefToBase::swap ( RefToBase< T > &  other  )  [inline]

Definition at line 308 of file RefToBase.h.

References edm::RefToBase< T >::holder_, and std::swap().

Referenced by edm::RefToBase< T >::operator=(), and edm::swap().

00309   {
00310     std::swap(holder_, other.holder_);
00311   }


Friends And Related Function Documentation

template<class T>
RefToBase::RefToBase [friend]

Definition at line 117 of file RefToBase.h.

template<class T>
friend class RefToBaseProd< T > [friend]

Definition at line 116 of file RefToBase.h.

template<class T>
friend class RefToBaseVector< T > [friend]

Definition at line 115 of file RefToBase.h.


Member Data Documentation

template<class T>
reftobase::BaseHolder<value_type>* edm::RefToBase< T >::holder_ [private]

Definition at line 114 of file RefToBase.h.

Referenced by edm::RefToBase< T >::castTo(), edm::RefToBase< T >::getPtrImpl(), edm::RefToBase< T >::hasProductCache(), edm::RefToBase< T >::holder(), edm::RefToBase< T >::id(), edm::RefToBase< TrajectorySeed >::isAvailable(), edm::RefToBase< T >::key(), edm::RefToBase< T >::operator==(), edm::RefToBase< T >::product(), edm::RefToBase< T >::productGetter(), edm::RefToBaseVector< T >::push_back(), edm::RefToBaseProd< T >::RefToBaseProd(), edm::RefToBase< T >::swap(), and edm::RefToBase< T >::~RefToBase().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:43:34 2009 for CMSSW by  doxygen 1.5.4