CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
26  typedef std::vector<char> SBuffer;
27 
32  rootbuf_(TBuffer::kWrite,init_size),
33  ptr_((unsigned char*)rootbuf_.Buffer()),
34  header_buf_(),
35  bufs_(),
37  { }
38 
39  // This object caches the results of the last INIT or event
40  // serialization operation. You get access to the data using the
41  // following member functions.
42 
43  unsigned char const* bufferPointer() const { return get_underlying_safe(ptr_); }
44  unsigned char*& bufferPointer() { return get_underlying_safe(ptr_); }
45  unsigned int currentSpaceUsed() const { return curr_space_used_; }
46  unsigned int currentEventSize() const { return curr_event_size_; }
47  uint32_t adler32_chksum() const { return adler32_chksum_; }
48 
49  std::vector<unsigned char> comp_buf_; // space for compressed data
50  unsigned int curr_event_size_;
51  unsigned int curr_space_used_; // less than curr_event_size_ if compressed
52  TBufferFile rootbuf_;
53  edm::propagate_const<unsigned char*> ptr_; // set to the place where the last event stored
54  SBuffer header_buf_; // place for INIT message creation
55  SBuffer bufs_; // place for EVENT message creation
56  uint32_t adler32_chksum_; // adler32 check sum for the (compressed) data
57 };
58 
59 class EventMsgBuilder;
60 class InitMsgBuilder;
61 namespace edm
62 {
63 
64  class EventForOutput;
65  class ModuleCallingContext;
66  class ThinnedAssociationsHelper;
67 
69  {
70 
71  public:
72 
73  StreamSerializer(SelectedProducts const* selections);
74 
75  int serializeRegistry(SerializeDataBuffer &data_buffer,
76  const BranchIDLists &branchIDLists,
77  ThinnedAssociationsHelper const& thinnedAssociationsHelper);
78 
79  int serializeEvent(EventForOutput const& event, ParameterSetID const& selectorConfig,
81  SerializeDataBuffer &data_buffer);
82 
88  static unsigned int compressBuffer(unsigned char *inputBuffer,
89  unsigned int inputSize,
90  std::vector<unsigned char> &outputBuffer,
91  int compressionLevel);
92 
93  private:
94 
97  };
98 
99 }
100 
101 #endif
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
edm::propagate_const< TClass * > tc_
std::vector< char > SBuffer
edm::propagate_const< unsigned char * > ptr_
static unsigned int compressBuffer(unsigned char *inputBuffer, unsigned int inputSize, std::vector< unsigned char > &outputBuffer, int compressionLevel)
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
int serializeRegistry(SerializeDataBuffer &data_buffer, const BranchIDLists &branchIDLists, ThinnedAssociationsHelper const &thinnedAssociationsHelper)
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
unsigned int curr_space_used_
unsigned char *& bufferPointer()
SelectedProducts const * selections_
uint32_t adler32_chksum() const
int serializeEvent(EventForOutput const &event, ParameterSetID const &selectorConfig, bool use_compression, int compression_level, SerializeDataBuffer &data_buffer)
const int init_size
unsigned int currentEventSize() const
StreamSerializer(SelectedProducts const *selections)