CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
edm::RefToBase< T > Class Template Reference

#include <AssociativeIterator.h>

Public Types

typedef T value_type
 

Public Member Functions

template<class REF >
REF castTo () const
 cast to a concrete type More...
 
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. More...
 
bool isNull () const
 Checks for null. More...
 
size_t key () const
 
bool operator! () const
 Checks for null. More...
 
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 (RefToBase const &other)
 
template<typename C1 , typename T1 , typename F1 >
 RefToBase (Ref< C1, T1, F1 > const &r)
 
template<typename C >
 RefToBase (RefProd< C > const &r)
 
 RefToBase (RefToBaseProd< T > const &r, size_t i)
 
 RefToBase (Handle< View< T > > const &handle, size_t i)
 
template<typename T1 >
 RefToBase (RefToBase< T1 > const &r)
 
 RefToBase (boost::shared_ptr< reftobase::RefHolderBase > p)
 
void swap (RefToBase &other)
 
 ~RefToBase ()
 

Static Public Member Functions

static short Class_Version ()
 

Private Member Functions

value_type const * getPtrImpl () const
 

Private Attributes

reftobase::BaseHolder
< value_type > * 
holder_
 

Friends

template<typename B >
class RefToBase
 
class RefToBaseProd< T >
 
class RefToBaseVector< T >
 

Detailed Description

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

Definition at line 49 of file AssociativeIterator.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 >
RefToBase::RefToBase ( )
inline

Definition at line 130 of file RefToBase.h.

130  :
131  holder_(0)
132  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T >
RefToBase::RefToBase ( RefToBase< T > const &  other)
inline

Definition at line 136 of file RefToBase.h.

136  :
137  holder_(other.holder_ ? other.holder_->clone() : 0)
138  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T >
template<typename C1 , typename T1 , typename F1 >
RefToBase::RefToBase ( Ref< C1, T1, F1 > const &  r)
inlineexplicit

Definition at line 143 of file RefToBase.h.

143  :
144  holder_(new reftobase::Holder<T,Ref<C1, T1, F1> >(iRef))
145  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
long double T
template<class T >
template<typename C >
RefToBase::RefToBase ( RefProd< C > const &  r)
inlineexplicit

Definition at line 150 of file RefToBase.h.

150  :
151  holder_(new reftobase::Holder<T,RefProd<C> >(iRef))
152  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
long double T
template<class T>
RefToBase::RefToBase ( RefToBaseProd< T > const &  r,
size_t  i 
)
inline

Definition at line 367 of file RefToBase.h.

367  :
368  holder_( r.operator->()->refAt( i ).holder_->clone() ) {
369  }
int i
Definition: DBlmapReader.cc:9
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<typename T>
RefToBase::RefToBase ( Handle< View< T > > const &  handle,
size_t  i 
)
inline

Definition at line 373 of file RefToBase.h.

373  :
374  holder_( handle.operator->()->refAt( i ).holder_->clone() ) {
375  }
int i
Definition: DBlmapReader.cc:9
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T >
template<typename T1 >
RefToBase::RefToBase ( RefToBase< T1 > const &  r)
inlineexplicit

Definition at line 157 of file RefToBase.h.

References relativeConstraints::value.

157  :
158  holder_(new reftobase::IndirectHolder<T> (
159  boost::shared_ptr< edm::reftobase::RefHolderBase>(iRef.holder().release())
160  ) )
161  {
162  // OUT: holder_( new reftobase::Holder<T,RefToBase<T1> >(iRef ) ) {
163  // Forcing the conversion through IndirectHolder,
164  // as Holder<T,RefToBase<T1>> would need dictionaries we will never have.
165  // In this way we only need the IndirectHolder<T> and the RefHolder of the real type of the item
166  // This might cause a small performance penalty.
167  BOOST_STATIC_ASSERT( ( boost::is_base_of<T, T1>::value ) );
168  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T>
RefToBase::RefToBase ( boost::shared_ptr< reftobase::RefHolderBase p)
inline

Definition at line 172 of file RefToBase.h.

172  :
173  holder_(new reftobase::IndirectHolder<T>(p))
174  { }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T >
RefToBase::~RefToBase ( )
inline

Definition at line 178 of file RefToBase.h.

179  {
180  delete holder_;
181  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118

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, AlCaHLTBitMon_QueryRunRegistry::string, and edm::Exception::throwThis().

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

242  {
243  if (!holder_)
244  {
246  "attempting to cast a null RefToBase;\n"
247  "You should check for nullity before casting.");
248  }
249 
250  reftobase::RefHolder<REF> concrete_holder;
251  std::string hidden_ref_type;
252  if (!holder_->fillRefIfMyTypeMatches(concrete_holder,
253  hidden_ref_type))
254  {
256  "cast to type: ",
257  typeid(REF).name(),
258  "\nfrom type: ",
259  hidden_ref_type.c_str(),
260  " failed. Catch this exception in case you need to check"
261  " the concrete reference type.");
262  }
263  return concrete_holder.getRef();
264  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
virtual bool fillRefIfMyTypeMatches(RefHolderBase &fillme, std::string &msg) const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T>
static short edm::RefToBase< T >::Class_Version ( )
inlinestatic

Definition at line 115 of file RefToBase.h.

116 :
117  value_type const* getPtrImpl() const;
value_type const * getPtrImpl() const
Definition: RefToBase.h:340
template<class T >
T const * RefToBase::get ( void  ) const
inline

Definition at line 212 of file RefToBase.h.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), DimuonStatistics::analyze(), GlbMuQualityCutsAnalysis::analyze(), PFCheckHitPattern::analyze(), TkConvValidator::analyze(), TestOutliers::analyze(), PhotonValidator::analyze(), IsolatedTracksNxN::analyze(), ConversionProducer::buildCollection(), rrapi.RRApi::columns(), edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), rrapi.RRApi::count(), rrapi.RRApi::data(), PFCandCommonVertexFitterBase::fill(), reco::GenJet::genParticle(), reco::Candidate::get(), reco::LeafCandidate::get(), L6SLBCorrector::getBTagInfoIndex(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), SelectReplacementCandidates::getRawIDsAdvanced(), betterConfigParser.BetterConfigParser::getResultingSection(), PrimaryVertexAnalyzer4PU::getSimEvents(), reco::makeSpecific(), pat::MET::MET(), pat::TriggerObject::origObjCand(), PFCheckHitPattern::print(), DimuonMCMatcher::produce(), pat::PATJetProducer::produce(), rrapi.RRApi::report(), rrapi.RRApi::reports(), reco::CaloTauTagInfo::setJetRef(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), pat::Tau::Tau(), rrapi.RRApi::templates(), reco::ConversionTrack::track(), pat::VertexAssociation::track(), pat::Jet::tryImportSpecific(), and rrapi.RRApi::workspaces().

213  {
214  return getPtrImpl();
215  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:340
template<class T >
T const * RefToBase::getPtrImpl ( ) const
inlineprivate

Definition at line 340 of file RefToBase.h.

341  {
342  return holder_ ? holder_->getPtr() : 0;
343  }
virtual T const * getPtr() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T >
bool RefToBase::hasProductCache ( ) const
inline

Definition at line 327 of file RefToBase.h.

327  {
328  return holder_?holder_->hasProductCache():false;
329  }
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
virtual bool hasProductCache() const =0
template<class T >
std::auto_ptr< reftobase::RefHolderBase > RefToBase::holder ( ) const

Definition at line 346 of file RefToBase.h.

346  {
347  return holder_? holder_->holder() : std::auto_ptr<reftobase::RefHolderBase>();
348  }
virtual std::auto_ptr< RefHolderBase > holder() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
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(), and pat::Jet::tryImportSpecific().

112 { return holder_? holder_->isAvailable(): false; }
virtual bool isAvailable() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
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

Definition at line 228 of file RefToBase.h.

References edm::errors::InvalidReference, and edm::Exception::throwThis().

Referenced by HLTMonBTagIPSource::analyze(), HLTMonBTagMuSource::analyze(), MuonTrackValidator::analyze(), VertexAssociatorByTracks::associateSimToReco(), PFDisplacedVertexFinder::commonTracks(), edm::helper::RefConverter< RefToBase< T >, Ptr< T > >::convert(), PFDisplacedVertexCandidateFinder::link(), ConversionTools::matchesConversion(), reco::JetSignalVertexCompatibilityAlgo::RefToBaseLess< T >::operator()(), reco::PFDisplacedVertexSeed::Compare::operator()(), BTagPerformanceAnalyzerOnData::JetRefCompare::operator()(), SoftLepton::TrackCompare::operator()(), BTagPerformanceAnalyzerMC::JetRefCompare::operator()(), MuonAssociatorByHits::RefToBaseSort::operator()(), DistortedPFCandProducer::produce(), PFDisplacedTrackerVertexProducer::produce(), and pat::helper::TriggerMatchHelper::triggerMatchObject().

229  {
230  if ( holder_ == 0 )
232  "attempting get key from null RefToBase;\n"
233  "You should check for nullity before calling key().");
234  return holder_->key();
235  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
virtual size_t key() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T >
bool RefToBase::operator! ( ) const
inline

Checks for null.

Definition at line 288 of file RefToBase.h.

289  {
290  return isNull();
291  }
bool isNull() const
Checks for null.
Definition: RefToBase.h:270
template<class T>
bool RefToBase::operator!= ( RefToBase< T > const &  rhs) const
inline

Definition at line 306 of file RefToBase.h.

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

Definition at line 196 of file RefToBase.h.

197  {
198  return *getPtrImpl();
199  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:340
template<class T >
T const * RefToBase::operator-> ( ) const
inline

Definition at line 204 of file RefToBase.h.

205  {
206  return getPtrImpl();
207  }
value_type const * getPtrImpl() const
Definition: RefToBase.h:340
template<class T>
RefToBase< T > & RefToBase::operator= ( RefToBase< T > const &  rhs)
inline

Definition at line 186 of file RefToBase.h.

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

187  {
188  RefToBase<T> temp( iRHS);
189  temp.swap(*this);
190  return *this;
191  }
template<class T>
bool RefToBase::operator== ( RefToBase< T > const &  rhs) const
inline

Definition at line 296 of file RefToBase.h.

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

297  {
298  return holder_
299  ? holder_->isEqualTo(*rhs.holder_)
300  : holder_ == rhs.holder_;
301  }
virtual bool isEqualTo(BaseHolder< T > const &rhs) const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T >
void const * RefToBase::product ( ) const
inline

Definition at line 333 of file RefToBase.h.

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

333  {
334  return holder_?holder_->product():nullptr;
335  }
virtual void const * product() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T >
EDProductGetter const * RefToBase::productGetter ( ) const
inline

Definition at line 321 of file RefToBase.h.

321  {
322  return holder_? holder_->productGetter():nullptr;
323  }
virtual EDProductGetter const * productGetter() const =0
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118
template<class T>
void RefToBase::swap ( RefToBase< T > &  other)
inline

Definition at line 314 of file RefToBase.h.

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

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

315  {
316  std::swap(holder_, other.holder_);
317  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
reftobase::BaseHolder< value_type > * holder_
Definition: RefToBase.h:118

Friends And Related Function Documentation

template<class T>
template<typename B >
friend class 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