CMS 3D CMS Logo

StreamSerializer.h
Go to the documentation of this file.
1 #ifndef IOPool_Streamer_StreamSerializer_h
2 #define IOPool_Streamer_StreamSerializer_h
3 
11 #include "TBufferFile.h"
12 
13 #include <cstdint>
14 #include <vector>
15 
20 
21 const int init_size = 1024 * 1024;
22 
23 // Data structure to be shared by all output modules for event serialization
25  typedef std::vector<char> SBuffer;
26 
31  rootbuf_(TBuffer::kWrite, init_size),
32  ptr_((unsigned char*)rootbuf_.Buffer()),
33  header_buf_(),
34  bufs_(),
35  adler32_chksum_(0) {}
36 
37  // This object caches the results of the last INIT or event
38  // serialization operation. You get access to the data using the
39  // following member functions.
40 
41  unsigned char const* bufferPointer() const { return get_underlying_safe(ptr_); }
42  unsigned char*& bufferPointer() { return get_underlying_safe(ptr_); }
43  unsigned int currentSpaceUsed() const { return curr_space_used_; }
44  unsigned int currentEventSize() const { return curr_event_size_; }
45  uint32_t adler32_chksum() const { return adler32_chksum_; }
46 
47  std::vector<unsigned char> comp_buf_; // space for compressed data
48  unsigned int curr_event_size_;
49  unsigned int curr_space_used_; // less than curr_event_size_ if compressed
50  TBufferFile rootbuf_;
51  edm::propagate_const<unsigned char*> ptr_; // set to the place where the last event stored
52  SBuffer header_buf_; // place for INIT message creation
53  SBuffer bufs_; // place for EVENT message creation
54  uint32_t adler32_chksum_; // adler32 check sum for the (compressed) data
55 };
56 
57 class EventMsgBuilder;
58 class InitMsgBuilder;
59 namespace edm {
60 
61  class EventForOutput;
62  class ModuleCallingContext;
63  class ThinnedAssociationsHelper;
64 
66  public:
68 
69  int serializeRegistry(SerializeDataBuffer& data_buffer,
70  const BranchIDLists& branchIDLists,
71  ThinnedAssociationsHelper const& thinnedAssociationsHelper);
72 
73  int serializeEvent(EventForOutput const& event,
74  ParameterSetID const& selectorConfig,
75  bool use_compression,
76  int compression_level,
77  SerializeDataBuffer& data_buffer) const;
78 
84  static unsigned int compressBuffer(unsigned char* inputBuffer,
85  unsigned int inputSize,
86  std::vector<unsigned char>& outputBuffer,
87  int compressionLevel);
88 
89  private:
92  };
93 
94 } // namespace edm
95 
96 #endif
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
edm::propagate_const< TClass * > tc_
std::vector< char > SBuffer
edm::propagate_const< unsigned char * > ptr_
std::vector< std::pair< BranchDescription const *, EDGetToken > > SelectedProducts
unsigned int currentSpaceUsed() const
std::vector< unsigned char > comp_buf_
unsigned int curr_event_size_
unsigned char const * bufferPointer() const
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
unsigned int curr_space_used_
unsigned char *& bufferPointer()
SelectedProducts const * selections_
uint32_t adler32_chksum() const
HLT enums.
const int init_size
unsigned int currentEventSize() const
Definition: event.py:1