Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:49:46

0001 #ifndef FEDRawData_FEDRawData_h
0002 #define FEDRawData_FEDRawData_h
0003 
0004 /** \class FEDRawData
0005  *
0006  *  Class representing the raw data for one FED.
0007  *  The raw data is owned as a binary buffer. It is required that the 
0008  *  lenght of the data is a multiple of the S-Link64 word lenght (8 byte).
0009  *  The FED data should include the standard FED header and trailer.
0010  *
0011  *  \author G. Bruno - CERN, EP Division
0012  *  \author S. Argiro - CERN and INFN - 
0013  *                      Refactoring and Modifications to fit into CMSSW
0014  */
0015 
0016 #include <vector>
0017 #include <cstddef>
0018 
0019 class FEDRawData {
0020 public:
0021   typedef std::vector<unsigned char> Data;
0022   typedef Data::iterator iterator;
0023 
0024   /// Default ctor
0025   FEDRawData();
0026 
0027   /// Ctor specifying the size to be preallocated, in bytes.
0028   /// It is required that the size is a multiple of the size of a FED
0029   /// word (8 bytes)
0030   FEDRawData(size_t newsize);
0031 
0032   /// Copy constructor
0033   FEDRawData(const FEDRawData &);
0034 
0035   /// Dtor
0036   ~FEDRawData();
0037 
0038   /// Return a const pointer to the beginning of the data buffer
0039   const unsigned char *data() const;
0040 
0041   /// Return a pointer to the beginning of the data buffer
0042   unsigned char *data();
0043 
0044   /// Lenght of the data buffer in bytes
0045   size_t size() const { return data_.size(); }
0046 
0047   /// Resize to the specified size in bytes. It is required that
0048   /// the size is a multiple of the size of a FED word (8 bytes)
0049   void resize(size_t newsize);
0050 
0051 private:
0052   Data data_;
0053 };
0054 
0055 #endif