#include <DQMEventMsgBuilder.h>
Public Member Functions | |
uint32 | bufferSize () const |
DQMEventMsgBuilder (void *buf, uint32 bufSize, uint32 run, uint32 event, edm::Timestamp timeStamp, uint32 lumiSection, uint32 updateNumber, uint32 adler32_chksum, const char *host_name, std::string const &releaseTag, std::string const &topFolderName, DQMEvent::TObjectTable monitorElementsBySubFolder) | |
uint8 * | eventAddress () const |
uint32 | headerSize () const |
void | setCompressionFlag (uint32) |
void | setEventLength (uint32 len) |
void | setFUGuid (uint32) |
void | setFUProcessId (uint32) |
void | setReserved (uint32) |
uint32 | size () const |
uint8 * | startAddress () const |
Private Attributes | |
uint8 * | buf_ |
uint32 | bufSize_ |
uint8 * | eventAddr_ |
This class is used to build and view the DQM Event data that is exchanged between the filter units and the storage manager.
09-Feb-2007 - Initial Implementation DQM Event Message Format:
Definition at line 48 of file DQMEventMsgBuilder.h.
DQMEventMsgBuilder::DQMEventMsgBuilder | ( | void * | buf, |
uint32 | bufSize, | ||
uint32 | run, | ||
uint32 | event, | ||
edm::Timestamp | timeStamp, | ||
uint32 | lumiSection, | ||
uint32 | updateNumber, | ||
uint32 | adler_chksum, | ||
const char * | host_name, | ||
std::string const & | releaseTag, | ||
std::string const & | topFolderName, | ||
DQMEvent::TObjectTable | monitorElementsBySubFolder | ||
) |
This class is used to build and view the DQM Event data that is exchanged between the filter units and the storage manager.
09-Feb-2007 - Initial Implementation Constructor.
Definition at line 18 of file DQMEventMsgBuilder.cc.
References buf_, bufSize_, lhef::cc::convert(), eventAddr_, DQMEventHeader::eventNumber_, Exception, DQMEventHeader::headerSize_, DQMEventHeader::lumiSection_, DQMEventHeader::protocolVersion_, DQMEventHeader::runNumber_, setCompressionFlag(), setEventLength(), setFUGuid(), setFUProcessId(), setReserved(), DQMEventHeader::timeStamp_, DQMEventHeader::updateNumber_, and edm::Timestamp::value().
: buf_((uint8*)buf),bufSize_(bufSize) { DQMEventHeader* evtHdr; uint8* bufPtr; uint32 len; uint32 protocolVersion = 3; // fill in event header information bufPtr = buf_ + sizeof(DQMEventHeader); if (((uint32) (bufPtr - buf_)) > bufSize_) { throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder") << "Input buffer size is too small for required header " << "information. Size = " << bufSize_ << ", necessary size is >= " << ((uint32) (bufPtr - buf_)) << ".\n"; } evtHdr = (DQMEventHeader*) buf_; convert(protocolVersion, evtHdr->protocolVersion_); convert(run, evtHdr->runNumber_); convert(event, evtHdr->eventNumber_); convert(timeStamp.value(), evtHdr->timeStamp_); convert(lumiSection, evtHdr->lumiSection_); convert(updateNumber, evtHdr->updateNumber_); // copy the release tag into the message len = releaseTag.length(); if (((uint32) (bufPtr + len + sizeof(uint32) - buf_)) > bufSize_) { throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder") << "Input buffer size is too small for required header " << "information. Size = " << bufSize_ << ", necessary size is >= " << ((uint32) (bufPtr + len + sizeof(uint32) - buf_)) << ".\n"; } convert(len, bufPtr); bufPtr += sizeof(uint32); releaseTag.copy((char*) bufPtr, len); bufPtr += len; // copy the top folder name into the message len = topFolderName.length(); if (((uint32) (bufPtr + len + sizeof(uint32) - buf_)) > bufSize_) { throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder") << "Input buffer size is too small for required header " << "information. Size = " << bufSize_ << ", necessary size is >= " << ((uint32) (bufPtr + len + sizeof(uint32) - buf_)) << ".\n"; } convert(len, bufPtr); bufPtr += sizeof(uint32); topFolderName.copy((char*) bufPtr, len); bufPtr += len; // copy the subfolder count into the message convert(static_cast<uint32>(monitorElementsBySubFolder.size()), bufPtr); bufPtr += sizeof(uint32); // copy the ME count and name for each subfolder into the message DQMEvent::TObjectTable::const_iterator sfIter; for (sfIter = monitorElementsBySubFolder.begin(); sfIter != monitorElementsBySubFolder.end(); sfIter++) { std::string subFolderName = sfIter->first; std::vector<TObject *> toList = sfIter->second; convert(static_cast<uint32>(toList.size()), bufPtr); bufPtr += sizeof(uint32); len = subFolderName.length(); convert(len, bufPtr); bufPtr += sizeof(uint32); subFolderName.copy((char*) bufPtr, len); bufPtr += len; } // adler32 check sum of data blob convert(adler_chksum, bufPtr); bufPtr += sizeof(uint32); // put host name (Length and then Name) right after check sum uint32 host_name_len = strlen(host_name); assert(host_name_len < 0x00ff); //Put host_name_len *bufPtr++ = host_name_len; //Put host_name memcpy(bufPtr,host_name,host_name_len); bufPtr += host_name_len; // set the header size and the event address, taking into account the // size of the event length field if (((uint32) (bufPtr + sizeof(uint32) - buf_)) > bufSize_) { throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder") << "Input buffer size is too small for required header " << "information. Size = " << bufSize_ << ", necessary size is >= " << ((uint32) (bufPtr + sizeof(uint32) - buf_)) << ".\n"; } convert(((uint32) (bufPtr - buf_)), evtHdr->headerSize_); bufPtr += sizeof(uint32); eventAddr_ = bufPtr; // set the event length to 0 initially. (The setEventLength method // sets the message code and message size for us. It shouldn't be called // until *after* the event address is set.) setEventLength(0); // initialize the compression flag to zero setCompressionFlag(0); // initialize the filter unit process ID to zero setFUProcessId(0); // initialize the filter unit GUID to zero setFUGuid(0); // initialize the reserved word to zero setReserved(0); }
uint32 DQMEventMsgBuilder::bufferSize | ( | ) | const [inline] |
uint8* DQMEventMsgBuilder::eventAddress | ( | ) | const [inline] |
Definition at line 67 of file DQMEventMsgBuilder.h.
References eventAddr_.
Referenced by StreamDQMOutputFile::write().
{ return eventAddr_; }
uint32 DQMEventMsgBuilder::headerSize | ( | ) | const [inline] |
Definition at line 62 of file DQMEventMsgBuilder.h.
References buf_, and eventAddr_.
Referenced by setEventLength(), StreamDQMOutputFile::write(), and StreamDQMOutputFile::writeDQMEventHeader().
{ return eventAddr_-buf_; }
void DQMEventMsgBuilder::setCompressionFlag | ( | uint32 | value | ) |
Sets the value of the compression flag in the header.
Definition at line 174 of file DQMEventMsgBuilder.cc.
References buf_, DQMEventHeader::compressionFlag_, and lhef::cc::convert().
Referenced by DQMEventMsgBuilder().
{ DQMEventHeader* evtHdr = (DQMEventHeader*) buf_; convert(value, evtHdr->compressionFlag_); }
void DQMEventMsgBuilder::setEventLength | ( | uint32 | len | ) |
Sets the length of the event (payload). This method verifies that the buffer in which we are building the message is large enough and updates the size of the message taking into account the new event length.
Definition at line 157 of file DQMEventMsgBuilder.cc.
References buf_, bufSize_, lhef::cc::convert(), Header::DQM_EVENT, eventAddr_, Exception, DQMEventHeader::header_, and headerSize().
Referenced by DQMEventMsgBuilder().
{ if (((uint32) (eventAddr_ + len - buf_)) > bufSize_) { throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder") << "Event data overflows buffer. Buffer size = " << bufSize_ << ", header size = " << this->headerSize() << ", event size = " << len << ".\n"; } convert(len, eventAddr_ - sizeof(char_uint32)); DQMEventHeader* evtHdr = (DQMEventHeader*) buf_; new (&evtHdr->header_) Header(Header::DQM_EVENT, (eventAddr_ - buf_ + len)); }
void DQMEventMsgBuilder::setFUGuid | ( | uint32 | value | ) |
Sets the value of the filter unit GUID in the header.
Definition at line 192 of file DQMEventMsgBuilder.cc.
References buf_, lhef::cc::convert(), and DQMEventHeader::fuGuid_.
Referenced by DQMEventMsgBuilder().
{ DQMEventHeader* evtHdr = (DQMEventHeader*) buf_; convert(value, evtHdr->fuGuid_); }
void DQMEventMsgBuilder::setFUProcessId | ( | uint32 | value | ) |
Sets the value of the filter unit process ID in the header.
Definition at line 183 of file DQMEventMsgBuilder.cc.
References buf_, lhef::cc::convert(), and DQMEventHeader::fuProcessId_.
Referenced by DQMEventMsgBuilder().
{ DQMEventHeader* evtHdr = (DQMEventHeader*) buf_; convert(value, evtHdr->fuProcessId_); }
void DQMEventMsgBuilder::setReserved | ( | uint32 | value | ) |
Sets the value of the reserved word in the header.
Definition at line 201 of file DQMEventMsgBuilder.cc.
References buf_, lhef::cc::convert(), and DQMEventHeader::reserved_.
Referenced by DQMEventMsgBuilder().
{ DQMEventHeader* evtHdr = (DQMEventHeader*) buf_; convert(value, evtHdr->reserved_); }
uint32 DQMEventMsgBuilder::size | ( | void | ) | const |
Returns the size of the message.
Definition at line 210 of file DQMEventMsgBuilder.cc.
References buf_, HeaderView::size(), and v.
Referenced by StreamDQMOutputFile::write(), and FUShmDQMOutputService::writeShmDQMData().
{ HeaderView v(buf_); return v.size(); }
uint8* DQMEventMsgBuilder::startAddress | ( | ) | const [inline] |
Definition at line 61 of file DQMEventMsgBuilder.h.
References buf_.
Referenced by StreamDQMOutputFile::writeDQMEventHeader(), and FUShmDQMOutputService::writeShmDQMData().
{ return buf_; }
uint8* DQMEventMsgBuilder::buf_ [private] |
Definition at line 72 of file DQMEventMsgBuilder.h.
Referenced by DQMEventMsgBuilder(), headerSize(), setCompressionFlag(), setEventLength(), setFUGuid(), setFUProcessId(), setReserved(), size(), and startAddress().
uint32 DQMEventMsgBuilder::bufSize_ [private] |
Definition at line 73 of file DQMEventMsgBuilder.h.
Referenced by bufferSize(), DQMEventMsgBuilder(), and setEventLength().
uint8* DQMEventMsgBuilder::eventAddr_ [private] |
Definition at line 74 of file DQMEventMsgBuilder.h.
Referenced by DQMEventMsgBuilder(), eventAddress(), headerSize(), and setEventLength().