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