CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/DataFormats/Common/interface/DataFrame.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Common_DataFrame_h
00002 #define DataFormats_Common_DataFrame_h
00003 
00004 namespace edm {
00005 
00006   class DataFrameContainer;
00007   
00008   /* a proxy to a fixed size array of 16bit words belonging to
00009    * a "channel" identified by an 32bit id
00010    *
00011    * FIXME interface to be finalized once use-cases fully identified
00012    * 
00013    */
00014   class DataFrame {
00015   public: 
00016     
00017     typedef unsigned int size_type; // for persistency
00018     typedef unsigned int id_type;
00019     typedef unsigned short data_type;
00020     typedef data_type * iterator;
00021     typedef data_type const * const_iterator;
00022     
00023     
00024     inline
00025     DataFrame() : m_id(0), m_data(0), m_size(0){}
00026     inline
00027     DataFrame(id_type i, data_type const * idata, size_type isize) :
00028       m_id(i), m_data(idata), m_size(isize) {}
00029     
00030     inline
00031     DataFrame(DataFrameContainer const & icont,
00032               size_type i);
00033     inline
00034     void set(DataFrameContainer const & icont,
00035              size_type i);
00036     inline
00037     data_type & operator[](size_type i) {
00038       return data()[i];
00039     }
00040     
00041     inline
00042     data_type operator[](size_type i) const {
00043       return m_data[i];
00044     }
00045     
00046     inline
00047     iterator begin() { return data();}
00048 
00049     inline
00050     iterator end() { return data()+m_size;}
00051 
00052     inline
00053     const_iterator begin() const { return m_data;}
00054 
00055     inline
00056     const_iterator end() const { return m_data+m_size;}
00057 
00058 
00059     inline
00060     id_type id() const { return m_id;}
00061     
00062     inline
00063     size_type size() const { return m_size; }
00064     
00065   private:
00066     data_type * data() {
00067       return const_cast<data_type *>(m_data);
00068     }
00069     
00070     id_type m_id;
00071     data_type const * m_data;
00072     size_type m_size;
00073   };
00074 }
00075 
00076 #endif // DataFormats_Common_DataFrame_h