CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DetSetNew.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_DetSetNew_h
2 #define DataFormats_Common_DetSetNew_h
3 
4 namespace edmNew {
5  // FIXME move it elsewhere....
6  typedef unsigned int det_id_type;
7 
8  template<typename T> class DetSetVector;
9 
10  /* a proxy to a variable size array of T belonging to
11  * a "channel" identified by an 32bit id
12  *
13  * FIXME interface to be finalized once use-cases fully identified
14  *
15  */
16  template<typename T>
17  class DetSet {
18  public:
20  typedef unsigned int size_type; // for persistency
21  typedef unsigned int id_type;
22  typedef T data_type;
23 
24  typedef data_type * iterator;
25  typedef data_type const * const_iterator;
26 
28  typedef id_type key_type;
29 
30 
31  inline
32  DetSet() : m_id(0), m_data(0), m_size(0){}
33  inline
34  DetSet(id_type i, data_type const * idata, size_type isize) :
35  m_id(i), m_data(idata), m_size(isize) {}
36 
37  inline
38  DetSet(Container const & icont,
39  typename Container::Item const & item);
40 
41  //FIXME (it may confuse users as size_type is same type as id_type...)
42  inline
43  void set(Container const & icont,
44  typename Container::Item const & item);
45  inline
47  return data()[i];
48  }
49 
50  inline
52  return data()[i];
53  }
54 
55  inline
56  iterator begin() { return data();}
57 
58  inline
59  iterator end() { return data()+m_size;}
60 
61  inline
62  const_iterator begin() const { return data();}
63 
64  inline
65  const_iterator end() const { return data()+m_size;}
66 
67 
68  inline
69  id_type id() const { return m_id;}
70 
71  inline
72  id_type detId() const { return m_id;}
73 
74  inline
75  size_type size() const { return m_size; }
76 
77  inline
78  bool empty() const { return m_size==0;}
79 
80  private:
81  data_type const * data() const {
82  return m_data;
83  }
84 
86  return const_cast<data_type *>(m_data);
87  }
88 
90  data_type const * m_data;
92  };
93 }
94 
95 #endif // DataFormats_Common_DetSet_h
const_iterator begin() const
Definition: DetSetNew.h:62
int i
Definition: DBlmapReader.cc:9
const_iterator end() const
Definition: DetSetNew.h:65
unsigned int det_id_type
Definition: DetSetNew.h:6
data_type operator[](size_type i) const
Definition: DetSetNew.h:51
unsigned int id_type
Definition: DetSetNew.h:21
data_type value_type
Definition: DetSetNew.h:27
data_type const * const_iterator
Definition: DetSetNew.h:25
data_type * iterator
Definition: DetSetNew.h:24
id_type key_type
Definition: DetSetNew.h:28
size_type m_size
Definition: DetSetNew.h:91
void set(Container const &icont, typename Container::Item const &item)
bool empty() const
Definition: DetSetNew.h:78
data_type & operator[](size_type i)
Definition: DetSetNew.h:46
data_type * data()
Definition: DetSetNew.h:85
DetSet(id_type i, data_type const *idata, size_type isize)
Definition: DetSetNew.h:34
id_type detId() const
Definition: DetSetNew.h:72
id_type m_id
Definition: DetSetNew.h:89
Pixel cluster – collection of neighboring pixels above threshold.
DetSetVector< T > Container
Definition: DetSetNew.h:19
iterator end()
Definition: DetSetNew.h:59
id_type id() const
Definition: DetSetNew.h:69
data_type const * m_data
Definition: DetSetNew.h:90
size_type size() const
Definition: DetSetNew.h:75
long double T
data_type const * data() const
Definition: DetSetNew.h:81
unsigned int size_type
Definition: DetSetNew.h:20
iterator begin()
Definition: DetSetNew.h:56