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
RefToBaseoperator= (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 66 of file RefToBase.h.


Member Typedef Documentation

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

Definition at line 69 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 136 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 143 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 150 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 367 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 373 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 157 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 172 of file RefToBase.h.

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

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

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

Referenced by ElectronMcFakeValidator::analyze(), GsfElectronDataAnalyzer::analyze(), ZMuMuAnalyzer_cynematics::analyze(), ElectronMcSignalValidator::analyze(), ZMuMuAnalyzer::analyze(), GsfElectronMCFakeAnalyzer::analyze(), ElectronSeedAnalyzer::analyze(), GsfElectronMCAnalyzer::analyze(), GsfElectronFakeAnalyzer::analyze(), ConversionProducer::buildCollection(), MuonTrajectoryCleaner::clean(), reco::JetSignalVertexCompatibilityAlgo::convert(), ZToMuMuFilter::filter(), reco::GsfElectronCore::GsfElectronCore(), HLTElectronPixelMatchFilter::hltFilter(), HLTEgamma::MakeL1IsolatedElectrons(), HLTEgamma::MakeL1NonIsolatedElectrons(), pat::TriggerObject::origL1EmRef(), pat::TriggerObject::origL1EtMissRef(), pat::TriggerObject::origL1JetRef(), pat::TriggerObject::origL1MuonRef(), reco::PFTauDecayMode::pfMasterClones(), NuclearTrackCorrector::produce(), ElectronSeedProducer::produce(), EgammaHLTGsfTrackVarProducer::produce(), GsfElectronCoreEcalDrivenProducer::produceEcalDrivenCore(), 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 340 of file RefToBase.h.

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

Definition at line 327 of file RefToBase.h.

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

Definition at line 346 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 112 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 288 of file RefToBase.h.

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

Definition at line 196 of file RefToBase.h.

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

Definition at line 204 of file RefToBase.h.

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

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

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

Referenced by edm::swap().


Friends And Related Function Documentation

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

Definition at line 121 of file RefToBase.h.

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

Definition at line 120 of file RefToBase.h.

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

Definition at line 119 of file RefToBase.h.


Member Data Documentation

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