CMS 3D CMS Logo

InitMsgBuilder.cc
Go to the documentation of this file.
4 #include <cassert>
5 #include <cstring>
6 #include <cstdint>
7 #include <unistd.h>
8 
9 using namespace edm::streamer;
10 
12  uint32 size,
13  uint32 run,
14  const Version& v,
15  const char* release_tag,
16  const char* process_name,
17  const char* output_module_label,
18  uint32 output_module_id,
19  const Strings& hlt_names,
20  const Strings& hlt_selections,
21  const Strings& l1_names,
22  uint32 adler_chksum)
23  : buf_((uint8*)buf), size_(size) {
25  // fixed length parts
26  new (&h->version_) Version(v);
27  convert(run, h->run_);
28  // variable length parts
29  uint32 tag_len = strlen(release_tag);
30  assert(tag_len < 0x00ff);
31  uint8* pos = buf_ + sizeof(InitHeader);
32 
33  *pos++ = tag_len; // length of release tag
34  memcpy(pos, release_tag, tag_len); // copy release tag in
35  pos += tag_len;
36 
37  //Lets put Process Name (Length and then Name) right after release_tag
38  uint32 process_name_len = strlen(process_name);
39  assert(process_name_len < 0x00ff);
40  //Put process_name_len
41  *pos++ = process_name_len;
42  //Put process_name
43  memcpy(pos, process_name, process_name_len);
44  pos += process_name_len;
45 
46  // output module label next
47  uint32 outmod_label_len = strlen(output_module_label);
48  assert(outmod_label_len < 0x00ff);
49  *pos++ = outmod_label_len;
50  memcpy(pos, output_module_label, outmod_label_len);
51  pos += outmod_label_len;
52 
53  // output module ID next
54  convert(output_module_id, pos);
55  pos += sizeof(char_uint32);
56 
57  pos = MsgTools::fillNames(hlt_names, pos);
58  pos = MsgTools::fillNames(hlt_selections, pos);
59  pos = MsgTools::fillNames(l1_names, pos);
60 
61  // adler32 check sum of data blob
62  convert(adler_chksum, pos);
63  pos = pos + sizeof(uint32);
64 
65  data_addr_ = pos + sizeof(char_uint32);
66  setDataLength(0);
67 
68  // Two news fileds added to InitMsg in Proto V3 init_header_size, and event_header_size.
69  //Set the size of Init Header Start of buf to Start of desc.
70  convert((uint32)(data_addr_ - buf_), h->init_header_size_);
71 
72  //Size of Event Header
73  uint32 eventHeaderSize = EventMsgBuilder::computeHeaderSize(l1_names.size(), hlt_names.size());
74  convert(eventHeaderSize, h->event_header_size_);
75 }
76 
78  convert(len, data_addr_ - sizeof(char_uint32));
80  new (&h->header_) Header(Header::INIT, data_addr_ - buf_ + len);
81 }
82 
84  HeaderView v(buf_);
85  return v.size();
86 }
87 
90  return convert32(h->run_);
91 }
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:43
void setDataLength(uint32 registry_length)
uint8 * fillNames(const Strings &names, uint8 *pos)
Definition: MsgTools.h:68
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:29
assert(be >=bs)
unsigned char uint8
Definition: MsgTools.h:12
static uint32 computeHeaderSize(uint32 l1t_bit_count, uint32 hlt_bit_count)
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:17
std::vector< std::string > Strings
Definition: MsgTools.h:19
unsigned int uint32
Definition: MsgTools.h:14
InitMsgBuilder(void *msg_mem, uint32 size, uint32 run, const Version &v, const char *release_tag, const char *process_name, const char *output_module_label, uint32 output_module_id, const Strings &hlt_names, const Strings &hlt_selections, const Strings &l1_names, uint32 adler32_chksum)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4