#include <PtrVectorBase.h>
Public Types | |
typedef unsigned long | key_type |
typedef key_type | size_type |
Public Member Functions | |
size_type | capacity () const |
Capacity of the RefVector. | |
void | clear () |
Clear the PtrVector. | |
bool | empty () const |
Is the RefVector empty. | |
bool | hasCache () const |
bool | hasProductCache () const |
ProductID | id () const |
Accessor for product ID. | |
bool | isAvailable () const |
bool | isNonnull () const |
Checks for non-null. | |
bool | isNull () const |
Checks for null. | |
bool | isTransient () const |
bool | operator! () const |
Checks for null. | |
bool | operator== (PtrVectorBase const &iRHS) const |
void const * | product () const |
EDProductGetter const * | productGetter () const |
Accessor for product getter. | |
PtrVectorBase (ProductID const &productID, void const *prodPtr=0, EDProductGetter const *prodGetter=0) | |
void | reserve (size_type n) |
Reserve space for RefVector. | |
void | setProductGetter (EDProductGetter *iGetter) const |
size_type | size () const |
Size of the RefVector. | |
virtual | ~PtrVectorBase () |
Protected Member Functions | |
template<typename TPtr > | |
TPtr | makePtr (unsigned long iIndex) const |
template<typename TPtr > | |
TPtr | makePtr (std::vector< void const * >::const_iterator const iIt) const |
PtrVectorBase () | |
void | push_back_base (RefCore const &core, key_type iKey, void const *iData) |
void | swap (PtrVectorBase &other) |
swap | |
std::vector< void const * > ::const_iterator | void_begin () const |
std::vector< void const * > ::const_iterator | void_end () const |
Private Member Functions | |
void | getProduct_ () const |
virtual std::type_info const & | typeInfo () const |
Private Attributes | |
std::vector< void const * > | cachedItems_ |
RefCore | core_ |
std::vector< key_type > | indicies_ |
Definition at line 32 of file PtrVectorBase.h.
typedef unsigned long edm::PtrVectorBase::key_type |
Definition at line 35 of file PtrVectorBase.h.
Definition at line 36 of file PtrVectorBase.h.
edm::PtrVectorBase::PtrVectorBase | ( | ProductID const & | productID, |
void const * | prodPtr = 0 , |
||
EDProductGetter const * | prodGetter = 0 |
||
) | [inline, explicit] |
Definition at line 38 of file PtrVectorBase.h.
PtrVectorBase::~PtrVectorBase | ( | ) | [virtual] |
Definition at line 37 of file PtrVectorBase.cc.
{ }
PtrVectorBase::PtrVectorBase | ( | ) | [protected] |
Definition at line 34 of file PtrVectorBase.cc.
{ }
size_type edm::PtrVectorBase::capacity | ( | ) | const [inline] |
Capacity of the RefVector.
Definition at line 76 of file PtrVectorBase.h.
References indicies_.
{return indicies_.capacity();}
void edm::PtrVectorBase::clear | ( | void | ) | [inline] |
Clear the PtrVector.
Definition at line 79 of file PtrVectorBase.h.
References cachedItems_, core_, and indicies_.
Referenced by ConvertedPhotonProducer::buildCollections(), BremRecoveryClusterAlgo::makeIslandSuperClusters(), HiBremRecoveryClusterAlgo::makeIslandSuperClusters(), Multi5x5BremRecoveryClusterAlgo::makeIslandSuperClusters(), PFRootEventManager::reconstructCaloJets(), PFRootEventManager::reconstructGenJets(), and PFRootEventManager::reconstructPFJets().
{ core_ = RefCore(); indicies_.clear(); cachedItems_.clear(); }
bool edm::PtrVectorBase::empty | ( | ) | const [inline] |
Is the RefVector empty.
Definition at line 70 of file PtrVectorBase.h.
References indicies_.
Referenced by pat::PATObject< ObjectType >::setOverlaps().
{return indicies_.empty();}
void PtrVectorBase::getProduct_ | ( | ) | const [private] |
Definition at line 76 of file PtrVectorBase.cc.
References cachedItems_, Exception, edm::WrapperHolder::fillPtrVector(), edm::EDProductGetter::getIt(), hasCache(), id(), indicies_, edm::errors::InvalidReference, edm::WrapperHolder::isValid(), edm::errors::LogicError, product(), productGetter(), and typeInfo().
Referenced by void_begin(), and void_end().
{ if(hasCache()) { return; } if(indicies_.size() == 0) { return; } if(0 == productGetter()) { throw Exception(errors::LogicError) << "Tried to get data for a PtrVector which has no EDProductGetter\n"; } WrapperHolder product = productGetter()->getIt(id()); if(!product.isValid()) { throw Exception(errors::InvalidReference) << "Asked for data from a PtrVector which refers to a non-existent product which id " << id() << "\n"; } product.fillPtrVector(typeInfo(), indicies_, cachedItems_); }
bool edm::PtrVectorBase::hasCache | ( | ) | const [inline] |
Definition at line 61 of file PtrVectorBase.h.
References cachedItems_.
Referenced by getProduct_(), and makePtr().
{ return !cachedItems_.empty(); }
bool edm::PtrVectorBase::hasProductCache | ( | ) | const [inline] |
Definition at line 63 of file PtrVectorBase.h.
References core_, and edm::RefCore::productPtr().
{ return 0 == core_.productPtr(); }
ProductID edm::PtrVectorBase::id | ( | void | ) | const [inline] |
Accessor for product ID.
Definition at line 56 of file PtrVectorBase.h.
References core_, and edm::RefCore::id().
Referenced by getProduct_(), TopProjector< Top, Bottom >::printAncestors(), pf2pat::TopProjectorAlgo< Top, Bottom >::printAncestors(), pf2pat::TopProjectorAlgo< Top, Bottom >::processCollection(), and TopProjector< Top, Bottom >::processCollection().
{return core_.id();}
bool edm::PtrVectorBase::isAvailable | ( | ) | const [inline] |
True if the data is in memory or is available in the Event No type checking is done.
Definition at line 67 of file PtrVectorBase.h.
References core_, and edm::RefCore::isAvailable().
{ return core_.isAvailable(); }
bool edm::PtrVectorBase::isNonnull | ( | ) | const [inline] |
Checks for non-null.
Definition at line 50 of file PtrVectorBase.h.
References core_, and edm::RefCore::isNonnull().
Referenced by isNull().
{ return core_.isNonnull(); }
bool edm::PtrVectorBase::isNull | ( | ) | const [inline] |
Checks for null.
Definition at line 46 of file PtrVectorBase.h.
References isNonnull().
Referenced by operator!().
{return !isNonnull(); }
bool edm::PtrVectorBase::isTransient | ( | ) | const [inline] |
Definition at line 90 of file PtrVectorBase.h.
References core_, and edm::RefCore::isTransient().
Referenced by makePtr().
{return core_.isTransient();}
TPtr edm::PtrVectorBase::makePtr | ( | unsigned long | iIndex | ) | const [inline, protected] |
Definition at line 114 of file PtrVectorBase.h.
References cachedItems_, hasCache(), indicies_, isTransient(), and productGetter().
{ if (isTransient()) { return TPtr(reinterpret_cast<typename TPtr::value_type const*>(cachedItems_[iIndex]), indicies_[iIndex]); } if (hasCache()) { return TPtr(this->id(), reinterpret_cast<typename TPtr::value_type const*>(cachedItems_[iIndex]), indicies_[iIndex]); } return TPtr(this->id(), indicies_[iIndex], productGetter()); }
TPtr edm::PtrVectorBase::makePtr | ( | std::vector< void const * >::const_iterator const | iIt | ) | const [inline, protected] |
Definition at line 128 of file PtrVectorBase.h.
References cachedItems_, hasCache(), indicies_, isTransient(), and productGetter().
{ if (isTransient()) { return TPtr(reinterpret_cast<typename TPtr::value_type const*>(*iIt), indicies_[iIt - cachedItems_.begin()]); } if (hasCache()) { return TPtr(this->id(), reinterpret_cast<typename TPtr::value_type const*>(*iIt), indicies_[iIt - cachedItems_.begin()]); } return TPtr(this->id(), indicies_[iIt - cachedItems_.begin()], productGetter()); }
bool edm::PtrVectorBase::operator! | ( | ) | const [inline] |
Checks for null.
Definition at line 53 of file PtrVectorBase.h.
References isNull().
{return isNull();}
bool PtrVectorBase::operator== | ( | PtrVectorBase const & | iRHS | ) | const |
void const* edm::PtrVectorBase::product | ( | ) | const [inline] |
EDProductGetter const* edm::PtrVectorBase::productGetter | ( | ) | const [inline] |
Accessor for product getter.
Definition at line 59 of file PtrVectorBase.h.
References core_, and edm::RefCore::productGetter().
Referenced by getProduct_(), and makePtr().
{return core_.productGetter();}
void PtrVectorBase::push_back_base | ( | RefCore const & | core, |
key_type | iKey, | ||
void const * | iData | ||
) | [protected] |
Definition at line 57 of file PtrVectorBase.cc.
References cachedItems_, core_, indicies_, and edm::RefCore::pushBackItem().
Referenced by edm::PtrVector< Candidate >::push_back().
{ core_.pushBackItem(core, false); //Did we already push a 'non-cached' Ptr into the container or is this a 'non-cached' Ptr? if(indicies_.size() == cachedItems_.size()) { if(iData) { cachedItems_.push_back(iData); } else if(key_traits<key_type>::value == iKey) { cachedItems_.push_back(0); } else { cachedItems_.clear(); } } indicies_.push_back(iKey); }
void edm::PtrVectorBase::reserve | ( | size_type | n | ) | [inline] |
Reserve space for RefVector.
Definition at line 86 of file PtrVectorBase.h.
References cachedItems_, and indicies_.
{indicies_.reserve(n); cachedItems_.reserve(n);}
void edm::PtrVectorBase::setProductGetter | ( | EDProductGetter * | iGetter | ) | const [inline] |
Definition at line 88 of file PtrVectorBase.h.
References core_, and edm::RefCore::setProductGetter().
{ core_.setProductGetter(iGetter); }
size_type edm::PtrVectorBase::size | ( | void | ) | const [inline] |
Size of the RefVector.
Definition at line 73 of file PtrVectorBase.h.
References indicies_.
Referenced by FWLiteJetProducer::applyCuts(), reco::SuperCluster::clustersSize(), NamedCandCombinerBase::combine(), reco::Conversion::EoverP(), reco::Conversion::EoverPrefittedTracks(), edm::helpers::ViewFiller< PtrVector< T > >::fill(), main(), HybridClusterAlgo::makeSuperClusters(), pf2pat::TopProjectorAlgo< Top, Bottom >::maskAncestors(), TopProjector< Top, Bottom >::maskAncestors(), TopProjector< Top, Bottom >::printAncestors(), and pf2pat::TopProjectorAlgo< Top, Bottom >::printAncestors().
{return indicies_.size();}
void PtrVectorBase::swap | ( | PtrVectorBase & | other | ) | [protected] |
swap
Definition at line 50 of file PtrVectorBase.cc.
References cachedItems_, core_, indicies_, and edm::RefCore::swap().
{ core_.swap(other.core_); indicies_.swap(other.indicies_); cachedItems_.swap(other.cachedItems_); }
virtual std::type_info const& edm::PtrVectorBase::typeInfo | ( | ) | const [inline, private, virtual] |
Reimplemented in edm::PtrVector< T >, edm::PtrVector< CaloCluster >, and edm::PtrVector< Candidate >.
Definition at line 144 of file PtrVectorBase.h.
Referenced by getProduct_().
{ assert(false); return *reinterpret_cast<const std::type_info*>(0); }
std::vector<void const*>::const_iterator edm::PtrVectorBase::void_begin | ( | ) | const [inline, protected] |
Definition at line 104 of file PtrVectorBase.h.
References cachedItems_, and getProduct_().
Referenced by edm::PtrVector< Candidate >::begin().
{ getProduct_(); return cachedItems_.begin(); }
std::vector<void const*>::const_iterator edm::PtrVectorBase::void_end | ( | ) | const [inline, protected] |
Definition at line 108 of file PtrVectorBase.h.
References cachedItems_, and getProduct_().
Referenced by edm::PtrVector< Candidate >::end().
{ getProduct_(); return cachedItems_.end(); }
std::vector<void const*> edm::PtrVectorBase::cachedItems_ [mutable, private] |
Definition at line 151 of file PtrVectorBase.h.
Referenced by clear(), getProduct_(), hasCache(), makePtr(), push_back_base(), reserve(), swap(), void_begin(), and void_end().
RefCore edm::PtrVectorBase::core_ [private] |
Definition at line 149 of file PtrVectorBase.h.
Referenced by clear(), hasProductCache(), id(), isAvailable(), isNonnull(), isTransient(), operator==(), productGetter(), push_back_base(), setProductGetter(), and swap().
std::vector<key_type> edm::PtrVectorBase::indicies_ [private] |
Definition at line 150 of file PtrVectorBase.h.
Referenced by capacity(), clear(), empty(), getProduct_(), makePtr(), operator==(), push_back_base(), reserve(), size(), and swap().