1 #ifndef DataFormats_Common_AssociativeIterator_h
2 #define DataFormats_Common_AssociativeIterator_h
47 template <
class T>
struct View;
51 template <
class T>
struct Ptr;
52 template <
class C,
class T,
class F>
struct Ref;
61 template<
typename RefFrom,
typename RefTo>
63 static RefTo
convert(
const RefFrom &ref) {
return RefTo(ref); }
69 template<
typename T,
typename C,
typename V,
typename F>
77 template<
typename RefType>
90 BaseRefType ref =
view_->refAt(idx);
103 template<
typename AC>
114 template<
typename KeyRefType,
typename AssociativeCollection,
141 operator bool()
const {
return idx_ <
map_.size(); }
151 const AssociativeCollection &
map_;
164 template<
typename KeyRefType,
typename AC,
typename IG>
166 map_(map), ioi_(map_.ids().
begin()), ioi2_(ioi_+1), idx_(0),
172 template<
typename KeyRefType,
typename AC,
typename IG>
176 if (ioi2_ < map_.ids().end()) {
177 if (ioi2_->second == idx_) {
184 template<
typename KeyRefType,
typename AC,
typename IG>
188 if (ioi_->second < idx_) {
195 template<
typename KeyRefType,
typename AC,
typename IG>
199 if (ioi_ == map_.ids().end()) {
214 template<
typename KeyRefType,
typename AC,
typename IG>
217 ret.
ioi_ = map_.ids().end();
219 ret.
idx_ = map_.size();
223 template<
typename KeyRefType,
typename AC,
typename IG>
226 pair_.first = getter_.get(
id(), idx_ - ioi_->second);
227 pair_.second = map_.get(idx_);
AssociativeIterator(const AssociativeCollection &map, const ItemGetter &getter)
Create the associative iterator, pointing at the beginning of the collection.
KeyRefType::value_type key_val_type
Association< C >::reference_type type
AssociativeCollection::id_offset_vector id_offset_vector
static HepMC::IO_HEPEVT conv
const val_type & val() const
Handle< View< element_type > > view_
AssociativeIterator< KeyRefType, AssociativeCollection, ItemGetter > self_type
reco::GenParticleCollection::const_iterator IG
const edm::Event & iEvent_
self_type & nextProductID()
static RefTo convert(const RefFrom &ref)
EdmEventItemGetter(const edm::Event &iEvent)
const value_type & operator*() const
Helper class that fetches some type of Ref given ProductID and index, using the edm::Event.
bool get(ProductID const &oid, Handle< PROD > &result) const
bool operator<(const self_type &other) const
Container::value_type value_type
RefType::value_type element_type
const value_type * operator->() const
id_offset_vector::const_iterator id_offset_iterator
std::pair< key_type, val_type > value_type
static Ptr< T > convert(const RefToBase< T > &ref)
const AssociativeCollection & map_
helper::AssociativeCollectionValueType< AssociativeCollection >::type val_type
bool operator!=(const self_type &other) const
bool operator==(const self_type &other) const
static Ref< C, V, F > convert(const RefToBase< T > &ref)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
const ProductID & id() const
value_type const * get() const
const key_type & key() const