CMS 3D CMS Logo

DataFrame.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_DataFrame_h
2 #define DataFormats_Common_DataFrame_h
3 
4 class TestDataFrame;
5 namespace edm {
6 
7  class DataFrameContainer;
8 
9  /* a proxy to a fixed size array of 16bit words belonging to
10  * a "channel" identified by an 32bit id
11  *
12  * FIXME interface to be finalized once use-cases fully identified
13  *
14  */
15  class DataFrame {
16  public:
17 
18  typedef unsigned int size_type; // for persistency
19  typedef unsigned int id_type;
20  typedef unsigned short data_type;
21  typedef data_type * iterator;
22  typedef data_type const * const_iterator;
23 
24 
25  inline
26  DataFrame() : m_id(0), m_data(0), m_size(0){}
27  inline
28  DataFrame(id_type i, data_type const * idata, size_type isize) :
29  m_id(i), m_data(idata), m_size(isize) {}
30 
31  inline
32  DataFrame(DataFrameContainer const & icont,
33  size_type i);
34  inline
35  void set(DataFrameContainer const & icont,
36  size_type i);
37  inline
38  data_type & operator[](size_type i) {
39  return data()[i];
40  }
41 
42  inline
43  data_type operator[](size_type i) const {
44  return m_data[i];
45  }
46 
47  inline
48  iterator begin() { return data();}
49 
50  inline
51  iterator end() { return data()+m_size;}
52 
53  inline
54  const_iterator begin() const { return m_data;}
55 
56  inline
57  const_iterator end() const { return m_data+m_size;}
58 
59 
60  inline
61  id_type id() const { return m_id;}
62 
63  inline
64  size_type size() const { return m_size; }
65 
66  private:
67  //for testing
68  friend class ::TestDataFrame;
69 
70  data_type * data() {
71  return const_cast<data_type *>(m_data);
72  }
73 
74  id_type m_id;
75  data_type const * m_data;
76  size_type m_size;
77  };
78 }
79 
80 #endif // DataFormats_Common_DataFrame_h
unsigned int id_type
Definition: DataFrame.h:19
data_type const * m_data
Definition: DataFrame.h:75
unsigned short data_type
Definition: DataFrame.h:20
const_iterator begin() const
Definition: DataFrame.h:54
id_type m_id
Definition: DataFrame.h:74
iterator begin()
Definition: DataFrame.h:48
unsigned int size_type
Definition: DataFrame.h:18
data_type & operator[](size_type i)
Definition: DataFrame.h:38
const_iterator end() const
Definition: DataFrame.h:57
iterator end()
Definition: DataFrame.h:51
DataFrame(id_type i, data_type const *idata, size_type isize)
Definition: DataFrame.h:28
size_type m_size
Definition: DataFrame.h:76
data_type operator[](size_type i) const
Definition: DataFrame.h:43
HLT enums.
data_type * iterator
Definition: DataFrame.h:21
data_type const * const_iterator
Definition: DataFrame.h:22
size_type size() const
Definition: DataFrame.h:64
data_type * data()
Definition: DataFrame.h:70
id_type id() const
Definition: DataFrame.h:61