CMS 3D CMS Logo

StreamDQMSerializer.h

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

Generated on Tue Jun 9 17:39:17 2009 for CMSSW by  doxygen 1.5.4