CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
InitMsgBuilder Class Reference

#include <InitMsgBuilder.h>

Public Member Functions

uint32 bufferSize () const
 
uint8dataAddress () const
 
uint32 headerSize () 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)
 
uint32 run () const
 
void setDataLength (uint32 registry_length)
 
uint32 size () const
 
uint8startAddress () const
 

Private Attributes

uint8buf_
 
uint8data_addr_
 
uint32 size_
 

Detailed Description

Definition at line 9 of file InitMsgBuilder.h.

Constructor & Destructor Documentation

◆ InitMsgBuilder()

InitMsgBuilder::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 
)

Definition at line 9 of file InitMsgBuilder.cc.

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  // 18-Apr-2008, KAB: create a dummy event message so that we can
71  // determine the expected event header size. (Previously, the event
72  // header size was hard-coded.)
73  std::vector<bool> dummyL1Bits(l1_names.size());
74  std::vector<char> dummyHLTBits(hlt_names.size());
75  const uint32 TEMP_BUFFER_SIZE = 256;
76  char msgBuff[TEMP_BUFFER_SIZE]; // not large enough for a real event!
77  uint32_t adler32 = 0;
78  char host_name[255];
79  int got_host = gethostname(host_name, 255);
80  if (got_host != 0)
81  strcpy(host_name, "noHostNameFoundOrTooLong");
82  EventMsgBuilder dummyMsg(&msgBuff[0],
83  TEMP_BUFFER_SIZE,
84  0,
85  0,
86  0,
87  0,
88  0,
89  dummyL1Bits,
90  (uint8*)&dummyHLTBits[0],
91  hlt_names.size(),
92  adler32,
93  host_name);
94 
95  //Size of Event Header
96  uint32 eventHeaderSize = dummyMsg.headerSize();
97  convert(eventHeaderSize, h->event_header_size_);
98 }

References cms::cuda::assert(), buf_, fileCollector::convert(), data_addr_, MsgTools::fillNames(), EventMsgBuilder::headerSize(), run(), setDataLength(), and findQualityFiles::v.

Member Function Documentation

◆ bufferSize()

uint32 InitMsgBuilder::bufferSize ( ) const
inline

Required by EOF Record Builder

Definition at line 30 of file InitMsgBuilder.h.

30 { return size_; }

References size_.

◆ dataAddress()

uint8* InitMsgBuilder::dataAddress ( ) const
inline

Definition at line 26 of file InitMsgBuilder.h.

26 { return data_addr_; }

References data_addr_.

◆ headerSize()

uint32 InitMsgBuilder::headerSize ( ) const
inline

Definition at line 27 of file InitMsgBuilder.h.

27 { return data_addr_ - buf_; }

References buf_, and data_addr_.

◆ run()

uint32 InitMsgBuilder::run ( ) const

Definition at line 111 of file InitMsgBuilder.cc.

111  {
113  return convert32(h->run_);
114 }

References buf_, and convert32().

Referenced by InitMsgBuilder().

◆ setDataLength()

void InitMsgBuilder::setDataLength ( uint32  registry_length)

Definition at line 100 of file InitMsgBuilder.cc.

100  {
101  convert(len, data_addr_ - sizeof(char_uint32));
103  new (&h->header_) Header(Header::INIT, data_addr_ - buf_ + len);
104 }

References buf_, fileCollector::convert(), data_addr_, and Header::INIT.

Referenced by InitMsgBuilder().

◆ size()

uint32 InitMsgBuilder::size ( void  ) const

Definition at line 106 of file InitMsgBuilder.cc.

106  {
107  HeaderView v(buf_);
108  return v.size();
109 }

References buf_, and findQualityFiles::v.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

◆ startAddress()

uint8* InitMsgBuilder::startAddress ( ) const
inline

Member Data Documentation

◆ buf_

uint8* InitMsgBuilder::buf_
private

Definition at line 33 of file InitMsgBuilder.h.

Referenced by headerSize(), InitMsgBuilder(), run(), setDataLength(), size(), and startAddress().

◆ data_addr_

uint8* InitMsgBuilder::data_addr_
private

Definition at line 35 of file InitMsgBuilder.h.

Referenced by dataAddress(), headerSize(), InitMsgBuilder(), and setDataLength().

◆ size_

uint32 InitMsgBuilder::size_
private

Definition at line 34 of file InitMsgBuilder.h.

Referenced by bufferSize().

InitMsgBuilder::data_addr_
uint8 * data_addr_
Definition: InitMsgBuilder.h:35
Header
Definition: MsgHeader.h:6
uint8
unsigned char uint8
Definition: MsgTools.h:11
pos
Definition: PixelAliasList.h:18
cms::cuda::assert
assert(be >=bs)
char_uint32
unsigned char char_uint32[sizeof(uint32)]
Definition: MsgTools.h:16
findQualityFiles.v
v
Definition: findQualityFiles.py:179
Header::INIT
Definition: MsgHeader.h:15
uint32
unsigned int uint32
Definition: MsgTools.h:13
EventMsgBuilder
Definition: EventMsgBuilder.h:8
MsgTools::fillNames
uint8 * fillNames(const Strings &names, uint8 *pos)
Definition: MsgTools.h:67
InitHeader
Definition: InitMessage.h:46
convert32
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:28
HeaderView
Definition: MsgHeader.h:35
h
EventMsgBuilder::headerSize
uint32 headerSize() const
Definition: EventMsgBuilder.h:29
fileCollector.convert
def convert(infile, ofile)
Definition: fileCollector.py:47
InitMsgBuilder::run
uint32 run() const
Definition: InitMsgBuilder.cc:111
InitMsgBuilder::setDataLength
void setDataLength(uint32 registry_length)
Definition: InitMsgBuilder.cc:100
InitMsgBuilder::size_
uint32 size_
Definition: InitMsgBuilder.h:34
visDQMUpload.buf
buf
Definition: visDQMUpload.py:160
InitMsgBuilder::buf_
uint8 * buf_
Definition: InitMsgBuilder.h:33
InitMsgBuilder::size
uint32 size() const
Definition: InitMsgBuilder.cc:106
Version
Definition: InitMessage.h:39