CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloRecHitMetaCollectionV.h
Go to the documentation of this file.
1 #ifndef RECOCALOTOOLS_METACOLLECTIONS_CALORECHITMETACOLLECTIONV_H
2 #define RECOCALOTOOLS_METACOLLECTIONS_CALORECHITMETACOLLECTIONV_H 1
3 
5 #include <iterator>
6 
7 
8 
17 public:
18  class Iterator {
19  public:
20  typedef std::random_access_iterator_tag iterator_category;
21  typedef const CaloRecHit& value_type;
22  typedef int difference_type;
23  typedef const CaloRecHit& reference;
24  typedef const CaloRecHit* pointer;
25  typedef int offset_type;
26 
27  Iterator() : collection_(0), offset_(0) { }
30  Iterator& operator=(const Iterator& it) { collection_=it.collection_; offset_=it.offset_; return (*this); }
31 
33  reference operator*() const;
35  pointer operator->() const;
36 
38  bool operator==(const Iterator& it) const;
40  bool operator!=(const Iterator& it) const;
41 
45  Iterator operator++(int);
49  Iterator operator--(int);
50 
51  // Random-access iterator requirements
54  Iterator operator+(const difference_type n) const;
56  Iterator operator-(const difference_type n) const;
57  bool operator<(const Iterator& i) const;
58 
59  private:
62  };
63 //
64 // add virtual descructor
65 //
68 
70  virtual const_iterator find(const DetId& id) const;
71 
73  const_iterator begin() const { return const_iterator(this,0); }
77  unsigned int size() const { return size_; }
78 
80  virtual const CaloRecHit* at(const_iterator::offset_type i) const = 0;
81 
82 protected:
84  unsigned int size_; // must be updated by derived classes
85 };
86 
87 #endif
virtual const_iterator find(const DetId &id) const
find by id (default version is very slow unsorted find)
std::random_access_iterator_tag iterator_category
int i
Definition: DBlmapReader.cc:9
Iterator & operator+=(const difference_type n)
pointer operator->() const
pointer operator
Iterator & operator=(const Iterator &it)
bool operator==(const Iterator &it) const
comparison operator
Iterator operator-(const difference_type n) const
Iterator & operator--()
Reverse-advance the iterator.
Iterator & operator-=(const difference_type n)
const_iterator begin() const
get the starting iterator
reference operator[](const difference_type n) const
reference operator*() const
dereference operator
bool operator!=(const Iterator &it) const
comparison operator
const_iterator end() const
get the ending iterator
virtual const CaloRecHit * at(const_iterator::offset_type i) const =0
get an item by index
Iterator(const CaloRecHitMetaCollectionV *col, offset_type pos)
const CaloRecHitMetaCollectionV * collection_
Definition: DetId.h:18
Iterator & operator++()
Advance the iterator.
unsigned int size() const
get the size of the collection
Iterator operator+(const difference_type n) const
int col
Definition: cuy.py:1008
bool operator<(const Iterator &i) const