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 
19 public:
20  class Iterator {
21  public:
22  typedef std::random_access_iterator_tag iterator_category;
23  typedef const CaloRecHit& value_type;
24  typedef int difference_type;
25  typedef const CaloRecHit& reference;
26  typedef const CaloRecHit* pointer;
27  typedef int offset_type;
28 
29  Iterator() : collection_(0), offset_(0) { }
32  Iterator& operator=(const Iterator& it) { collection_=it.collection_; offset_=it.offset_; return (*this); }
33 
35  reference operator*() const;
37  pointer operator->() const;
38 
40  bool operator==(const Iterator& it) const;
42  bool operator!=(const Iterator& it) const;
43 
47  Iterator operator++(int);
51  Iterator operator--(int);
52 
53  // Random-access iterator requirements
56  Iterator operator+(const difference_type n) const;
58  Iterator operator-(const difference_type n) const;
59  bool operator<(const Iterator& i) const;
60 
61  private:
64  };
65 //
66 // add virtual descructor
67 //
70 
72  virtual const_iterator find(const DetId& id) const;
73 
75  const_iterator begin() const { return const_iterator(this,0); }
79  unsigned int size() const { return size_; }
80 
82  virtual const CaloRecHit* at(const_iterator::offset_type i) const = 0;
83 
84 protected:
86  unsigned int size_; // must be updated by derived classes
87 };
88 
89 #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:20
Iterator & operator++()
Advance the iterator.
unsigned int size() const
get the size of the collection
Iterator operator+(const difference_type n) const
bool operator<(const Iterator &i) const