#include <DataFormats/Common/interface/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 |
ProductID | id () const |
Accessor for product ID. | |
bool | isAvailable () const |
True if the data is in memory or is available in the Event No type checking is done. | |
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 |
EDProductGetter const * | productGetter () const |
Accessor for product getter. | |
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 (std::vector< void const * >::const_iterator const iIt) const |
template<typename TPtr> | |
TPtr | makePtr (unsigned long iIndex) 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 =0 |
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.
PtrVectorBase::~PtrVectorBase | ( | ) | [virtual] |
PtrVectorBase::PtrVectorBase | ( | ) | [protected] |
size_type edm::PtrVectorBase::capacity | ( | ) | const [inline] |
Capacity of the RefVector.
Definition at line 70 of file PtrVectorBase.h.
References indicies_.
00070 {return indicies_.capacity();}
Clear the PtrVector.
Definition at line 73 of file PtrVectorBase.h.
References cachedItems_, core_, and indicies_.
Referenced by ConvertedPhotonProducer::buildCollections(), PFRootEventManager::reconstructCaloJets(), PFRootEventManager::reconstructGenJets(), and PFRootEventManager::reconstructPFJets().
00073 { core_ = RefCore(); indicies_.clear(); cachedItems_.clear(); }
bool edm::PtrVectorBase::empty | ( | ) | const [inline] |
Is the RefVector empty.
Definition at line 64 of file PtrVectorBase.h.
References indicies_.
Referenced by pat::PATObject< ObjectType >::setOverlaps().
00064 {return indicies_.empty();}
void PtrVectorBase::getProduct_ | ( | ) | const [private] |
Definition at line 78 of file PtrVectorBase.cc.
References edm::EDProduct::fillPtrVector(), id, edm::errors::InvalidReference, and edm::errors::LogicError.
Referenced by void_begin(), and void_end().
00078 { 00079 if(hasCache()) { 00080 return; 00081 } 00082 if(indicies_.size() == 0) { 00083 return; 00084 } 00085 if(0 == productGetter()) { 00086 throw edm::Exception(edm::errors::LogicError) << "Tried to get data for a PtrVector which has no EDProductGetter\n"; 00087 } 00088 EDProduct const* product = productGetter()->getIt(id()); 00089 00090 if(0==product) { 00091 throw edm::Exception(edm::errors::InvalidReference) << "Asked for data from a PtrVector which refers to a non-existent product which id " << id() << "\n"; 00092 } 00093 product->fillPtrVector(typeInfo(), 00094 indicies_, 00095 cachedItems_); 00096 }
bool edm::PtrVectorBase::hasCache | ( | ) | const [inline] |
Definition at line 57 of file PtrVectorBase.h.
References cachedItems_.
Referenced by makePtr().
00057 { return !cachedItems_.empty(); }
Accessor for product ID.
Definition at line 52 of file PtrVectorBase.h.
References core_, and edm::RefCore::id().
Referenced by PFTopProjector::printAncestors(), and PFTopProjector::processCollection().
00052 {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 61 of file PtrVectorBase.h.
References core_, and edm::RefCore::isAvailable().
00061 { return core_.isAvailable(); }
bool edm::PtrVectorBase::isNonnull | ( | ) | const [inline] |
Checks for non-null.
Definition at line 46 of file PtrVectorBase.h.
References core_, and edm::RefCore::isNonnull().
Referenced by isNull().
00046 { return core_.isNonnull(); }
bool edm::PtrVectorBase::isNull | ( | ) | const [inline] |
Checks for null.
Definition at line 42 of file PtrVectorBase.h.
References isNonnull().
Referenced by operator!().
00042 {return !isNonnull(); }
bool edm::PtrVectorBase::isTransient | ( | ) | const [inline] |
Definition at line 84 of file PtrVectorBase.h.
References core_, and edm::RefCore::isTransient().
Referenced by makePtr().
00084 {return core_.isTransient();}
TPtr edm::PtrVectorBase::makePtr | ( | std::vector< void const * >::const_iterator const | iIt | ) | const [inline, protected] |
Definition at line 118 of file PtrVectorBase.h.
References cachedItems_, hasCache(), indicies_, isTransient(), productGetter(), and typename.
00118 { 00119 if (isTransient()) { 00120 return TPtr(reinterpret_cast<typename TPtr::value_type const*>(*iIt), 00121 indicies_[iIt - cachedItems_.begin()]); 00122 } 00123 if (hasCache()) { 00124 return TPtr(this->id(), 00125 reinterpret_cast<typename TPtr::value_type const*>(*iIt), 00126 indicies_[iIt - cachedItems_.begin()]); 00127 } 00128 return TPtr(this->id(), indicies_[iIt - cachedItems_.begin()], productGetter()); 00129 }
TPtr edm::PtrVectorBase::makePtr | ( | unsigned long | iIndex | ) | const [inline, protected] |
Definition at line 104 of file PtrVectorBase.h.
References cachedItems_, hasCache(), indicies_, isTransient(), productGetter(), and typename.
00104 { 00105 if (isTransient()) { 00106 return TPtr(reinterpret_cast<typename TPtr::value_type const*>(cachedItems_[iIndex]), 00107 indicies_[iIndex]); 00108 } 00109 if (hasCache()) { 00110 return TPtr(this->id(), 00111 reinterpret_cast<typename TPtr::value_type const*>(cachedItems_[iIndex]), 00112 indicies_[iIndex]); 00113 } 00114 return TPtr(this->id(), indicies_[iIndex], productGetter()); 00115 }
bool edm::PtrVectorBase::operator! | ( | ) | const [inline] |
Checks for null.
Definition at line 49 of file PtrVectorBase.h.
References isNull().
00049 {return isNull();}
bool PtrVectorBase::operator== | ( | PtrVectorBase const & | iRHS | ) | const |
Definition at line 99 of file PtrVectorBase.cc.
References core_, and indicies_.
00099 { 00100 if (core_ != iRHS.core_) { 00101 return false; 00102 } 00103 if (indicies_.size() != iRHS.indicies_.size()){ 00104 return false; 00105 } 00106 return std::equal(indicies_.begin(), 00107 indicies_.end(), 00108 iRHS.indicies_.begin()); 00109 return true; 00110 }
EDProductGetter const* edm::PtrVectorBase::productGetter | ( | ) | const [inline] |
Accessor for product getter.
Definition at line 55 of file PtrVectorBase.h.
References core_, and edm::RefCore::productGetter().
Referenced by makePtr().
00055 {return core_.productGetter();}
void PtrVectorBase::push_back_base | ( | RefCore const & | core, | |
key_type | iKey, | |||
void const * | iData | |||
) | [protected] |
Definition at line 59 of file PtrVectorBase.cc.
Referenced by edm::PtrVector< reco::CaloCluster >::push_back().
00059 { 00060 core_.pushBackItem(core, false); 00061 //Did we already push a 'non-cached' Ptr into the container or is this a 'non-cached' Ptr? 00062 if(indicies_.size() == cachedItems_.size()) { 00063 if(iData) { 00064 cachedItems_.push_back(iData); 00065 } else if(key_traits<key_type>::value == iKey) { 00066 cachedItems_.push_back(0); 00067 } else { 00068 cachedItems_.clear(); 00069 } 00070 } 00071 indicies_.push_back(iKey); 00072 }
Reserve space for RefVector.
Definition at line 80 of file PtrVectorBase.h.
References cachedItems_, and indicies_.
00080 {indicies_.reserve(n); cachedItems_.reserve(n);}
void edm::PtrVectorBase::setProductGetter | ( | EDProductGetter * | iGetter | ) | const [inline] |
Definition at line 82 of file PtrVectorBase.h.
References core_, and edm::RefCore::setProductGetter().
00082 { core_.setProductGetter(iGetter); }
Size of the RefVector.
Definition at line 67 of file PtrVectorBase.h.
References indicies_.
Referenced by FWLiteJetProducer::applyCuts(), NamedCandCombinerBase::combine(), reco::Conversion::EoverP(), PFTopProjector::maskAncestors(), and PFTopProjector::printAncestors().
00067 {return indicies_.size();}
void PtrVectorBase::swap | ( | PtrVectorBase & | other | ) | [protected] |
swap
Definition at line 52 of file PtrVectorBase.cc.
References cachedItems_, core_, and indicies_.
00052 { 00053 core_.swap(other.core_); 00054 indicies_.swap(other.indicies_); 00055 cachedItems_.swap(other.cachedItems_); 00056 }
virtual std::type_info const& edm::PtrVectorBase::typeInfo | ( | ) | const [private, pure virtual] |
std::vector<void const*>::const_iterator edm::PtrVectorBase::void_begin | ( | ) | const [inline, protected] |
Definition at line 94 of file PtrVectorBase.h.
References cachedItems_, and getProduct_().
00094 { 00095 getProduct_(); 00096 return cachedItems_.begin(); 00097 }
std::vector<void const*>::const_iterator edm::PtrVectorBase::void_end | ( | ) | const [inline, protected] |
Definition at line 98 of file PtrVectorBase.h.
References cachedItems_, and getProduct_().
00098 { 00099 getProduct_(); 00100 return cachedItems_.end(); 00101 }
std::vector<void const*> edm::PtrVectorBase::cachedItems_ [mutable, private] |
Definition at line 137 of file PtrVectorBase.h.
Referenced by clear(), hasCache(), makePtr(), reserve(), swap(), void_begin(), and void_end().
RefCore edm::PtrVectorBase::core_ [private] |
Definition at line 135 of file PtrVectorBase.h.
Referenced by clear(), id(), isAvailable(), isNonnull(), isTransient(), operator==(), productGetter(), setProductGetter(), and swap().
std::vector<key_type> edm::PtrVectorBase::indicies_ [private] |
Definition at line 136 of file PtrVectorBase.h.
Referenced by capacity(), clear(), empty(), makePtr(), operator==(), reserve(), size(), and swap().