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  constexpr inline
27  constexpr 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  constexpr inline
38  data_type & operator[](size_type i) {
39  return data()[i];
40  }
41 
42  constexpr inline
43  data_type operator[](size_type i) const {
44  return m_data[i];
45  }
46 
47  constexpr inline
48  iterator begin() { return data();}
49 
50  constexpr inline
51  iterator end() { return data()+m_size;}
52 
53  constexpr inline
54  const_iterator begin() const { return m_data;}
55 
56  constexpr inline
57  const_iterator end() const { return m_data+m_size;}
58 
59 
60  constexpr inline
61  id_type id() const { return m_id;}
62 
63  constexpr inline
64  size_type size() const { return m_size; }
65 
66  private:
67  //for testing
68  friend class ::TestDataFrame;
69 
70  constexpr 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
constexpr iterator end()
Definition: DataFrame.h:51
unsigned short data_type
Definition: DataFrame.h:20
#define nullptr
constexpr DataFrame(id_type i, data_type const *idata, size_type isize)
Definition: DataFrame.h:28
constexpr DataFrame()
Definition: DataFrame.h:26
id_type m_id
Definition: DataFrame.h:74
unsigned int size_type
Definition: DataFrame.h:18
constexpr id_type id() const
Definition: DataFrame.h:61
constexpr data_type * data()
Definition: DataFrame.h:70
constexpr size_type size() const
Definition: DataFrame.h:64
constexpr const_iterator end() const
Definition: DataFrame.h:57
constexpr const_iterator begin() const
Definition: DataFrame.h:54
constexpr data_type & operator[](size_type i)
Definition: DataFrame.h:38
size_type m_size
Definition: DataFrame.h:76
constexpr iterator begin()
Definition: DataFrame.h:48
HLT enums.
data_type * iterator
Definition: DataFrame.h:21
data_type const * const_iterator
Definition: DataFrame.h:22
#define constexpr
constexpr data_type operator[](size_type i) const
Definition: DataFrame.h:43