CMS 3D CMS Logo

InitMsgBuilder Class Reference

#include <IOPool/Streamer/interface/InitMsgBuilder.h>

List of all members.

Public Member Functions

uint32 bufferSize () const
 Required by EOF Record Builder.
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 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 ( 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 
)

Definition at line 7 of file InitMsgBuilder.cc.

References buf_, convert(), data_addr_, InitHeader::event_header_size_, MsgTools::fillNames(), h, InitHeader::init_header_size_, InitHeader::run_, setDataLength(), and InitHeader::version_.

00015                                                        :
00016   buf_((uint8*)buf),size_(size)
00017 {
00018   InitHeader* h = (InitHeader*)buf_;
00019   // fixed length parts
00020   new (&h->version_) Version(v);
00021   convert(run,h->run_);
00022   // variable length parts
00023   uint32 tag_len = strlen(release_tag);
00024   assert(tag_len < 0x00ff);
00025   uint8* pos = buf_+sizeof(InitHeader);
00026 
00027   *pos++ = tag_len; // length of release tag
00028   memcpy(pos,release_tag,tag_len); // copy release tag in
00029   pos += tag_len;
00030 
00031   //Lets put Process Name (Length and then Name) right after release_tag
00032   uint32 process_name_len = strlen(process_name);
00033   assert(process_name_len < 0x00ff);
00034   //Put process_name_len
00035   *pos++ = process_name_len;
00036   //Put process_name
00037   memcpy(pos,process_name,process_name_len);
00038   pos += process_name_len;
00039 
00040   // output module label next
00041   uint32 outmod_label_len = strlen(output_module_label);
00042   assert(outmod_label_len < 0x00ff);
00043   *pos++ = outmod_label_len;
00044   memcpy(pos,output_module_label,outmod_label_len);
00045   pos += outmod_label_len;
00046 
00047   // output module ID next
00048   convert(output_module_id, pos);
00049   pos += sizeof(char_uint32);
00050 
00051   pos = MsgTools::fillNames(hlt_names,pos);
00052   pos = MsgTools::fillNames(hlt_selections,pos);
00053   pos = MsgTools::fillNames(l1_names,pos);
00054 
00055   data_addr_ = pos + sizeof(char_uint32);
00056   setDataLength(0);
00057 
00058   // Two news fileds added to InitMsg in Proto V3 init_header_size, and event_header_size.
00059   //Set the size of Init Header Start of buf to Start of desc.
00060   convert((uint32)(data_addr_ - buf_), h->init_header_size_);
00061 
00062   // 18-Apr-2008, KAB:  create a dummy event message so that we can
00063   // determine the expected event header size.  (Previously, the event
00064   // header size was hard-coded.)
00065   std::vector<bool> dummyL1Bits(l1_names.size());
00066   std::vector<char> dummyHLTBits(hlt_names.size());
00067   const uint32 TEMP_BUFFER_SIZE = 256;
00068   char msgBuff[TEMP_BUFFER_SIZE];  // not large enough for a real event!
00069   EventMsgBuilder dummyMsg(&msgBuff[0], TEMP_BUFFER_SIZE, 0, 0, 0, 0,
00070                            dummyL1Bits, (uint8*) &dummyHLTBits[0],
00071                            hlt_names.size());
00072 
00073   //Size of Event Header
00074   uint32 eventHeaderSize = dummyMsg.headerSize();
00075   convert(eventHeaderSize, h->event_header_size_);
00076 }


Member Function Documentation

uint32 InitMsgBuilder::bufferSize (  )  const [inline]

Required by EOF Record Builder.

Definition at line 28 of file InitMsgBuilder.h.

References size_.

00028 {return size_;}

uint8* InitMsgBuilder::dataAddress (  )  const [inline]

Definition at line 24 of file InitMsgBuilder.h.

References data_addr_.

00024 { return data_addr_; }

uint32 InitMsgBuilder::headerSize (  )  const [inline]

Definition at line 25 of file InitMsgBuilder.h.

References buf_, and data_addr_.

Referenced by StreamerOutputIndexFile::write().

00025 {return data_addr_-buf_;}

uint32 InitMsgBuilder::run ( void   )  const

Definition at line 94 of file InitMsgBuilder.cc.

References buf_, convert32(), h, and InitHeader::run_.

Referenced by StreamerOutputIndexFile::write().

00095 {
00096   InitHeader* h = (InitHeader*)buf_;
00097   return convert32(h->run_);
00098 }

void InitMsgBuilder::setDataLength ( uint32  registry_length  ) 

Definition at line 78 of file InitMsgBuilder.cc.

References buf_, convert(), data_addr_, h, InitHeader::header_, and Header::INIT.

Referenced by InitMsgBuilder().

00079 {
00080   convert(len,data_addr_-sizeof(char_uint32));
00081   InitHeader* h = (InitHeader*)buf_;
00082   new (&h->header_) Header(Header::INIT, data_addr_ - buf_ + len);
00083 }

uint32 InitMsgBuilder::size ( void   )  const

Definition at line 86 of file InitMsgBuilder.cc.

References buf_, HeaderView::size(), and v.

Referenced by edm::FUShmOutputModule::doOutputHeader().

00087 {
00088 
00089   HeaderView v(buf_);
00090   return v.size();
00091 }

uint8* InitMsgBuilder::startAddress (  )  const [inline]

Definition at line 22 of file InitMsgBuilder.h.

References buf_.

Referenced by edm::FUShmOutputModule::doOutputHeader(), edm::StreamerFileWriter::doOutputHeader(), StreamerOutputFile::write(), and StreamerOutputIndexFile::write().

00022 { return buf_; }


Member Data Documentation

uint8* InitMsgBuilder::buf_ [private]

Definition at line 31 of file InitMsgBuilder.h.

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

uint8* InitMsgBuilder::data_addr_ [private]

Definition at line 33 of file InitMsgBuilder.h.

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

uint32 InitMsgBuilder::size_ [private]

Definition at line 32 of file InitMsgBuilder.h.

Referenced by bufferSize().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:51 2009 for CMSSW by  doxygen 1.5.4