Go to the documentation of this file.00001 #ifndef IOPool_Streamer_StreamSerializer_h
00002 #define IOPool_Streamer_StreamSerializer_h
00003
00011 #include "TBufferFile.h"
00012
00013 #include "DataFormats/Provenance/interface/Selections.h"
00014 #include "DataFormats/Provenance/interface/ParameterSetID.h"
00015 #include <stdint.h>
00016 #include <vector>
00017
00018
00019 const int init_size = 1024*1024;
00020
00021
00022 struct SerializeDataBuffer
00023 {
00024 typedef std::vector<char> SBuffer;
00025
00026 SerializeDataBuffer():
00027 comp_buf_(init_size),
00028 curr_event_size_(),
00029 curr_space_used_(),
00030 rootbuf_(TBuffer::kWrite,init_size),
00031 ptr_((unsigned char*)rootbuf_.Buffer()),
00032 header_buf_(),
00033 bufs_(),
00034 adler32_chksum_(0)
00035 { }
00036
00037
00038
00039
00040
00041 unsigned char* bufferPointer() const { return ptr_; }
00042 unsigned int currentSpaceUsed() const { return curr_space_used_; }
00043 unsigned int currentEventSize() const { return curr_event_size_; }
00044 uint32_t adler32_chksum() const { return adler32_chksum_; }
00045
00046 std::vector<unsigned char> comp_buf_;
00047 unsigned int curr_event_size_;
00048 unsigned int curr_space_used_;
00049 TBufferFile rootbuf_;
00050 unsigned char* ptr_;
00051 SBuffer header_buf_;
00052 SBuffer bufs_;
00053 uint32_t adler32_chksum_;
00054 };
00055
00056 class EventMsgBuilder;
00057 class InitMsgBuilder;
00058 namespace edm
00059 {
00060
00061 class EventPrincipal;
00062 class StreamSerializer
00063 {
00064
00065 public:
00066
00067 StreamSerializer(Selections const* selections);
00068
00069 int serializeRegistry(SerializeDataBuffer &data_buffer);
00070 int serializeEvent(EventPrincipal const& eventPrincipal,
00071 ParameterSetID const& selectorConfig,
00072 bool use_compression, int compression_level,
00073 SerializeDataBuffer &data_buffer);
00074
00080 static unsigned int compressBuffer(unsigned char *inputBuffer,
00081 unsigned int inputSize,
00082 std::vector<unsigned char> &outputBuffer,
00083 int compressionLevel);
00084
00085 private:
00086
00087 Selections const* selections_;
00088 TClass* tc_;
00089 };
00090
00091 }
00092
00093 #endif