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  typedef unsigned int size_type; // for persistency
18  typedef unsigned int id_type;
19  typedef unsigned short data_type;
20  typedef data_type *iterator;
21  typedef data_type const *const_iterator;
22 
23  constexpr inline DataFrame() : m_id(0), m_data(nullptr), m_size(0) {}
24  constexpr inline DataFrame(id_type i, data_type const *idata, size_type isize)
25  : m_id(i), m_data(idata), m_size(isize) {}
26 
27  inline DataFrame(DataFrameContainer const &icont, size_type i);
28  inline void set(DataFrameContainer const &icont, size_type i);
29  constexpr inline data_type &operator[](size_type i) { return data()[i]; }
30 
31  constexpr inline data_type operator[](size_type i) const { return m_data[i]; }
32 
33  constexpr inline iterator begin() { return data(); }
34 
35  constexpr inline iterator end() { return data() + m_size; }
36 
37  constexpr inline const_iterator begin() const { return m_data; }
38 
39  constexpr inline const_iterator end() const { return m_data + m_size; }
40 
41  constexpr inline id_type id() const { return m_id; }
42 
43  constexpr inline size_type size() const { return m_size; }
44 
45  private:
46  //for testing
47  friend class ::TestDataFrame;
48 
49  constexpr data_type *data() { return const_cast<data_type *>(m_data); }
50 
52  data_type const *m_data;
54  };
55 } // namespace edm
56 
57 #endif // DataFormats_Common_DataFrame_h
unsigned int id_type
Definition: DataFrame.h:18
data_type const * m_data
Definition: DataFrame.h:52
constexpr iterator end()
Definition: DataFrame.h:35
unsigned short data_type
Definition: DataFrame.h:19
constexpr DataFrame(id_type i, data_type const *idata, size_type isize)
Definition: DataFrame.h:24
constexpr DataFrame()
Definition: DataFrame.h:23
constexpr const_iterator begin() const
Definition: DataFrame.h:37
id_type m_id
Definition: DataFrame.h:51
unsigned int size_type
Definition: DataFrame.h:17
constexpr data_type * data()
Definition: DataFrame.h:49
constexpr size_type size() const
Definition: DataFrame.h:43
constexpr data_type operator[](size_type i) const
Definition: DataFrame.h:31
constexpr id_type id() const
Definition: DataFrame.h:41
constexpr data_type & operator[](size_type i)
Definition: DataFrame.h:29
size_type m_size
Definition: DataFrame.h:53
constexpr iterator begin()
Definition: DataFrame.h:33
HLT enums.
data_type * iterator
Definition: DataFrame.h:20
data_type const * const_iterator
Definition: DataFrame.h:21
constexpr const_iterator end() const
Definition: DataFrame.h:39