CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends

edm::RefToBase< T > Class Template Reference

#include <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
bool isNonnull () const
 Checks for non-null.
bool isNull () const
 Checks for null.
size_t key () const
bool operator! () const
 Checks for null.
bool operator!= (RefToBase const &rhs) const
value_type const & operator* () 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 (RefToBase const &other)
 RefToBase (Handle< View< T > > const &handle, size_t i)
template<typename C1 , typename T1 , typename F1 >
 RefToBase (Ref< C1, T1, F1 > const &r)
 RefToBase ()
 RefToBase (RefToBaseProd< T > const &r, size_t i)
template<typename C >
 RefToBase (RefProd< C > const &r)
template<typename T1 >
 RefToBase (RefToBase< T1 > const &r)
 RefToBase (boost::shared_ptr< reftobase::RefHolderBase > p)
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 64 of file RefToBase.h.


Member Typedef Documentation

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

Definition at line 67 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 131 of file RefToBase.h.

                                                :
    holder_(other.holder_  ? other.holder_->clone() : 0)
  { }
template<class T >
template<typename C1 , typename T1 , typename F1 >
RefToBase::RefToBase ( Ref< C1, T1, F1 > const &  r) [inline, explicit]

Definition at line 138 of file RefToBase.h.

                                                     :
    holder_(new reftobase::Holder<T,Ref<C1, T1, F1> >(iRef))
  { }
template<class T >
template<typename C >
RefToBase::RefToBase ( RefProd< C > const &  r) [inline, explicit]

Definition at line 145 of file RefToBase.h.

                                                :
    holder_(new reftobase::Holder<T,RefProd<C> >(iRef))
  { }
template<class T>
RefToBase::RefToBase ( RefToBaseProd< T > const &  r,
size_t  i 
) [inline]

Definition at line 362 of file RefToBase.h.

                                                             :
    holder_( r.operator->()->refAt( i ).holder_->clone() ) {
  }
template<typename T>
RefToBase::RefToBase ( Handle< View< T > > const &  handle,
size_t  i 
) [inline]

Definition at line 368 of file RefToBase.h.

                                                                  :
    holder_( handle.operator->()->refAt( i ).holder_->clone() ) {
  }
template<class T >
template<typename T1 >
RefToBase::RefToBase ( RefToBase< T1 > const &  r) [inline, explicit]

Definition at line 152 of file RefToBase.h.

References relativeConstraints::value.

                                                   :
        holder_(new reftobase::IndirectHolder<T> (
             boost::shared_ptr< edm::reftobase::RefHolderBase>(iRef.holder().release())
        ) )
  {
    // OUT: holder_( new reftobase::Holder<T,RefToBase<T1> >(iRef ) )  {
    // Forcing the conversion through IndirectHolder,
    //   as Holder<T,RefToBase<T1>> would need dictionaries we will never have.
    // In this way we only need the IndirectHolder<T> and the RefHolder of the real type of the item
    // This might cause a small performance penalty.
    BOOST_STATIC_ASSERT( ( boost::is_base_of<T, T1>::value ) );
  }
template<class T>
RefToBase::RefToBase ( boost::shared_ptr< reftobase::RefHolderBase p) [inline]

Definition at line 167 of file RefToBase.h.

                                                                   :
    holder_(new reftobase::IndirectHolder<T>(p))
  { }
template<class T >
RefToBase::~RefToBase ( ) [inline]

Definition at line 173 of file RefToBase.h.

  {
    delete holder_;
  }

Member Function Documentation

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

cast to a concrete type

Definition at line 236 of file RefToBase.h.

References edm::reftobase::RefHolder< REF >::getRef(), edm::errors::InvalidReference, AlCaRecoCosmics_cfg::name, and edm::Exception::throwThis().

Referenced by ElectronMcFakeValidator::analyze(), ZMuMuAnalyzer_cynematics::analyze(), GsfElectronDataAnalyzer::analyze(), ElectronMcSignalValidator::analyze(), ZMuMuAnalyzer::analyze(), GsfElectronMCFakeAnalyzer::analyze(), ElectronSeedAnalyzer::analyze(), GsfElectronMCAnalyzer::analyze(), GsfElectronFakeAnalyzer::analyze(), TrackerOnlyConversionProducer::buildCollection(), MuonTrajectoryCleaner::clean(), reco::JetSignalVertexCompatibilityAlgo::convert(), HLTElectronPixelMatchFilter::filter(), ZToMuMuFilter::filter(), reco::GsfElectronCore::GsfElectronCore(), HLTEgamma::MakeL1IsolatedElectrons(), HLTEgamma::MakeL1NonIsolatedElectrons(), pat::TriggerObject::origL1EmRef(), pat::TriggerObject::origL1EtMissRef(), pat::TriggerObject::origL1JetRef(), pat::TriggerObject::origL1MuonRef(), reco::PFTauDecayMode::pfMasterClones(), NuclearTrackCorrector::produce(), ElectronSeedProducer::produce(), GsfElectronCoreEcalDrivenProducer::produce(), GsfElectronAlgo::setCutBasedPreselectionFlag(), and reco::CaloTauTagInfo::setJetRef().

  {
    if (!holder_)
      {
        Exception::throwThis(errors::InvalidReference,
          "attempting to cast a null RefToBase;\n"
          "You should check for nullity before casting.");
      }

    reftobase::RefHolder<REF> concrete_holder;
    std::string hidden_ref_type;
    if (!holder_->fillRefIfMyTypeMatches(concrete_holder,
                                         hidden_ref_type))
      {
        Exception::throwThis(errors::InvalidReference,
          "cast to type: ",
          typeid(REF).name(),
          "\nfrom type: ",
          hidden_ref_type.c_str(),
          " failed. Catch this exception in case you need to check"
          " the concrete reference type.");
      }
    return concrete_holder.getRef();
  }
template<class T >
T const * RefToBase::get ( void  ) const [inline]
template<class T >
T const * RefToBase::getPtrImpl ( ) const [inline, private]

Definition at line 335 of file RefToBase.h.

  {
    return holder_ ? holder_->getPtr() : 0;
  }
template<class T >
bool RefToBase::hasProductCache ( ) const [inline]

Definition at line 322 of file RefToBase.h.

                                           {
    return holder_->hasProductCache();
  }
template<class T >
std::auto_ptr< reftobase::RefHolderBase > RefToBase::holder ( ) const

Definition at line 341 of file RefToBase.h.

                                                                 {
    return holder_->holder();
  }
template<class T >
ProductID RefToBase::id ( void  ) const [inline]
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 110 of file RefToBase.h.

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

{ return holder_->isAvailable(); }
template<class T >
bool RefToBase::isNonnull ( ) const [inline]
template<class T >
bool RefToBase::isNull ( ) const [inline]
template<class T >
size_t RefToBase::key ( ) const [inline]
template<class T >
bool RefToBase::operator! ( ) const [inline]

Checks for null.

Definition at line 283 of file RefToBase.h.

  {
    return isNull();
  }
template<class T >
bool RefToBase::operator!= ( RefToBase< T > const &  rhs) const [inline]

Definition at line 301 of file RefToBase.h.

  {
    return !(*this == rhs);
  }
template<class T >
T const & RefToBase::operator* ( ) const [inline]

Definition at line 191 of file RefToBase.h.

  {
    return *getPtrImpl();
  }
template<class T >
T const * RefToBase::operator-> ( ) const [inline]

Definition at line 199 of file RefToBase.h.

  {
    return getPtrImpl();
  }
template<class T >
RefToBase< T > const & RefToBase::operator= ( RefToBase< T > const &  rhs) [inline]

Definition at line 181 of file RefToBase.h.

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

  {
    RefToBase<T> temp( iRHS);
    temp.swap(*this);
    return *this;
  }
template<class T >
bool RefToBase::operator== ( RefToBase< T > const &  rhs) const [inline]

Definition at line 291 of file RefToBase.h.

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

  {
    return holder_
      ? holder_->isEqualTo(*rhs.holder_)
      : holder_ == rhs.holder_;
  }
template<class T >
void const * RefToBase::product ( ) const [inline]

Definition at line 328 of file RefToBase.h.

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

                                           {
    return holder_->product();
  }
template<class T >
EDProductGetter const * RefToBase::productGetter ( ) const [inline]

Definition at line 316 of file RefToBase.h.

                                                           {
    return holder_->productGetter();
  }
template<class T >
void RefToBase::swap ( RefToBase< T > &  other) [inline]

Definition at line 309 of file RefToBase.h.

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

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

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

Friends And Related Function Documentation

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

Definition at line 116 of file RefToBase.h.

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

Definition at line 115 of file RefToBase.h.

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

Definition at line 114 of file RefToBase.h.


Member Data Documentation

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