CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DataFormats/Common/interface/TransientDataFrame.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Common_TransientDataFrame_h
00002 #define DataFormats_Common_TransientDataFrame_h
00003 
00004 #include "DataFormats/Common/interface/DataFrame.h"
00005 #include <algorithm>
00006 
00007 namespace edm {
00008 
00009   /* a fixed size array of 16bit words belonging to
00010    * a "channel" identified by an 32bit id
00011    *
00012    * FIXME interface to be finalized once use-cases fully identified
00013    * 
00014    */
00015   template<unsigned int SIZE>
00016   class TransientDataFrame {
00017   public: 
00018     
00019     typedef DataFrame::data_type data_type;   
00020     typedef DataFrame::id_type id_type;   
00021     
00022     TransientDataFrame() {}
00023     TransientDataFrame( id_type i) : m_id(i) {}
00024     TransientDataFrame(DataFrame const & iframe) : 
00025       m_id(iframe.id())
00026     {
00027       data_type const * p = iframe.begin();
00028       std::copy(p,p+SIZE,m_data);
00029     }
00030     
00031     int size() const { return SIZE;}
00032     
00033     data_type operator[](size_t i) const {
00034       return m_data[i];
00035     } 
00036     
00037     data_type & operator[](size_t i) {
00038       return m_data[i];
00039     } 
00040     
00041     id_type id() const { return m_id; }
00042     
00043   private:
00044     id_type m_id;
00045     data_type m_data[SIZE];
00046     
00047   };
00048   
00049 }
00050 
00051 #endif // DataFormats_Common_TransientDataFrame_h