CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/IOPool/Streamer/interface/StreamDQMSerializer.h

Go to the documentation of this file.
00001 #ifndef IOPool_Streamer_StreamDQMSerializer_h
00002 #define IOPool_Streamer_StreamDQMSerializer_h
00003 
00011 #include "TBufferFile.h"
00012 
00013 #include "IOPool/Streamer/interface/DQMEventMsgBuilder.h"
00014 #include <stdint.h>
00015 #include <vector>
00016 
00017 namespace edm
00018 {
00019 
00020   class StreamDQMSerializer
00021   {
00022 
00023   public:
00024 
00025     StreamDQMSerializer();
00026 
00027     int serializeDQMEvent(DQMEvent::TObjectTable& toTable,
00028                           bool use_compression, int compression_level);
00029 
00030     // This object always caches the results of the last event 
00031     // serialization operation.  You get access to the data using the
00032     // following member functions.
00033 
00034     unsigned char* bufferPointer() const { return ptr_; }
00035     unsigned int currentSpaceUsed() const { return curr_space_used_; }
00036     unsigned int currentEventSize() const { return curr_event_size_; }
00037     uint32_t adler32_chksum() const { return adler32_chksum_; }
00038 
00039   private:
00040 
00041     // helps to keep the data in this class exception safe
00042     struct Arr
00043     {
00044       explicit Arr(int sz); // allocate
00045       ~Arr(); // free
00046 
00047       char* ptr_;
00048     };
00049 
00050     // Arr data_;
00051     std::vector<unsigned char> comp_buf_; // space for compressed data
00052     unsigned int curr_event_size_;
00053     unsigned int curr_space_used_; // less than curr_event_size_ if compressed
00054     TBufferFile rootbuf_;
00055     unsigned char* ptr_; // set to the place where the last event stored
00056     uint32_t  adler32_chksum_; // adler32 check sum for the (compressed) data
00057 
00058   };
00059 
00060 }
00061 
00062 #endif