Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:07

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 default)
0030   FEDRawData(size_t newsize, size_t wordsize = 8);
0031 
0032   /// Copy constructor
0033   FEDRawData(const FEDRawData &);
0034 
0035   /// Assignment operator
0036   FEDRawData &operator=(const FEDRawData &) = default;
0037 
0038   /// Dtor
0039   ~FEDRawData();
0040 
0041   /// Return a const pointer to the beginning of the data buffer
0042   const unsigned char *data() const;
0043 
0044   /// Return a pointer to the beginning of the data buffer
0045   unsigned char *data();
0046 
0047   /// Lenght of the data buffer in bytes
0048   size_t size() const { return data_.size(); }
0049 
0050   /// Resize to the specified size in bytes. It is required that
0051   /// the size is a multiple of the size of a FED word (8 bytes default)
0052   void resize(size_t newsize, size_t wordsize = 8);
0053 
0054 private:
0055   Data data_;
0056 };
0057 
0058 #endif