CMS 3D CMS Logo

DQMEventMsgBuilder Class Reference

This class is used to build and view the DQM Event data that is exchanged between the filter units and the storage manager. More...

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

List of all members.

Public Member Functions

uint32 bufferSize () const
 DQMEventMsgBuilder (void *buf, uint32 bufSize, uint32 run, uint32 event, edm::Timestamp timeStamp, uint32 lumiSection, uint32 updateNumber, 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.
uint8eventAddress () const
uint32 headerSize () const
void setCompressionFlag (uint32)
 Sets the value of the compression flag in the header.
void setEventLength (uint32 len)
 Sets the length of the event (payload).
void setFUGuid (uint32)
 Sets the value of the filter unit GUID in the header.
void setFUProcessId (uint32)
 Sets the value of the filter unit process ID in the header.
void setReserved (uint32)
 Sets the value of the reserved word in the header.
uint32 size () const
 Returns the size of the message.
uint8startAddress () const

Private Attributes

uint8buf_
uint32 bufSize_
uint8eventAddr_


Detailed Description

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 44 of file DQMEventMsgBuilder.h.


Constructor & Destructor Documentation

DQMEventMsgBuilder::DQMEventMsgBuilder ( void buf,
uint32  bufSize,
uint32  run,
uint32  event,
edm::Timestamp  timeStamp,
uint32  lumiSection,
uint32  updateNumber,
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 15 of file DQMEventMsgBuilder.cc.

References buf_, bufSize_, convert(), eventAddr_, DQMEventHeader::eventNumber_, Exception, DQMEventHeader::headerSize_, len, DQMEventHeader::lumiSection_, DQMEventHeader::protocolVersion_, DQMEventHeader::runNumber_, setCompressionFlag(), setEventLength(), setFUGuid(), setFUProcessId(), setReserved(), DQMEventHeader::timeStamp_, DQMEventHeader::updateNumber_, and edm::Timestamp::value().

00022                                                                             :
00023   buf_((uint8*)buf),bufSize_(bufSize)
00024 {
00025   DQMEventHeader* evtHdr;
00026   uint8* bufPtr;
00027   uint32 len;
00028   uint32 protocolVersion = 2;
00029 
00030   // fill in event header information
00031   bufPtr = buf_ + sizeof(DQMEventHeader);
00032   if (((uint32) (bufPtr - buf_)) > bufSize_)
00033     {
00034       throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder")
00035         << "Input buffer size is too small for required header "
00036         << "information.  Size = " << bufSize_
00037         << ", necessary size is >= "
00038         << ((uint32) (bufPtr - buf_)) << ".\n";
00039     }
00040 
00041   evtHdr = (DQMEventHeader*) buf_;
00042   convert(protocolVersion, evtHdr->protocolVersion_);
00043   convert(run, evtHdr->runNumber_);
00044   convert(event, evtHdr->eventNumber_);
00045 
00046   convert(timeStamp.value(), evtHdr->timeStamp_);
00047 
00048   convert(lumiSection, evtHdr->lumiSection_);
00049   convert(updateNumber, evtHdr->updateNumber_);
00050 
00051   // copy the release tag into the message
00052   len = releaseTag.length();
00053   if (((uint32) (bufPtr + len + sizeof(uint32) - buf_)) > bufSize_)
00054     {
00055       throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder")
00056         << "Input buffer size is too small for required header "
00057         << "information.  Size = " << bufSize_
00058         << ", necessary size is >= "
00059         << ((uint32) (bufPtr + len + sizeof(uint32) - buf_)) << ".\n";
00060     }
00061   convert(len, bufPtr);
00062   bufPtr += sizeof(uint32);
00063   releaseTag.copy((char*) bufPtr, len);
00064   bufPtr += len;
00065 
00066   // copy the top folder name into the message
00067   len = topFolderName.length();
00068   if (((uint32) (bufPtr + len + sizeof(uint32) - buf_)) > bufSize_)
00069     {
00070       throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder")
00071         << "Input buffer size is too small for required header "
00072         << "information.  Size = " << bufSize_
00073         << ", necessary size is >= "
00074         << ((uint32) (bufPtr + len + sizeof(uint32) - buf_)) << ".\n";
00075     }
00076   convert(len, bufPtr);
00077   bufPtr += sizeof(uint32);
00078   topFolderName.copy((char*) bufPtr, len);
00079   bufPtr += len;
00080 
00081   // copy the subfolder count into the message
00082   convert(static_cast<uint32>(monitorElementsBySubFolder.size()), bufPtr);
00083   bufPtr += sizeof(uint32);
00084 
00085   // copy the ME count and name for each subfolder into the message
00086   DQMEvent::TObjectTable::const_iterator sfIter;
00087   for (sfIter = monitorElementsBySubFolder.begin();
00088        sfIter != monitorElementsBySubFolder.end(); sfIter++)
00089     {
00090       std::string subFolderName = sfIter->first;
00091       std::vector<TObject *> toList = sfIter->second;
00092 
00093       convert(static_cast<uint32>(toList.size()), bufPtr);
00094       bufPtr += sizeof(uint32);
00095 
00096       len = subFolderName.length();
00097       convert(len, bufPtr);
00098       bufPtr += sizeof(uint32);
00099       subFolderName.copy((char*) bufPtr, len);
00100       bufPtr += len;
00101     }
00102 
00103   // set the header size and the event address, taking into account the
00104   // size of the event length field
00105   if (((uint32) (bufPtr + sizeof(uint32) - buf_)) > bufSize_)
00106     {
00107       throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder")
00108         << "Input buffer size is too small for required header "
00109         << "information.  Size = " << bufSize_
00110         << ", necessary size is >= "
00111         << ((uint32) (bufPtr + sizeof(uint32) - buf_)) << ".\n";
00112     }
00113   convert(((uint32) (bufPtr - buf_)), evtHdr->headerSize_);
00114   bufPtr += sizeof(uint32);
00115   eventAddr_ = bufPtr;
00116 
00117   // set the event length to 0 initially.  (The setEventLength method
00118   // sets the message code and message size for us.  It shouldn't be called
00119   // until *after* the event address is set.)
00120   setEventLength(0);
00121 
00122   // initialize the compression flag to zero
00123   setCompressionFlag(0);
00124 
00125   // initialize the filter unit process ID to zero
00126   setFUProcessId(0);
00127 
00128   // initialize the filter unit GUID to zero
00129   setFUGuid(0);
00130 
00131   // initialize the reserved word to zero
00132   setReserved(0);
00133 }


Member Function Documentation

uint32 DQMEventMsgBuilder::bufferSize (  )  const [inline]

Definition at line 54 of file DQMEventMsgBuilder.h.

References bufSize_.

00054 { return bufSize_; }

uint8* DQMEventMsgBuilder::eventAddress (  )  const [inline]

Definition at line 61 of file DQMEventMsgBuilder.h.

References eventAddr_.

Referenced by StreamDQMOutputFile::write().

00061 { return eventAddr_; }

uint32 DQMEventMsgBuilder::headerSize (  )  const [inline]

Definition at line 56 of file DQMEventMsgBuilder.h.

References buf_, and eventAddr_.

Referenced by setEventLength(), StreamDQMOutputFile::write(), and StreamDQMOutputFile::writeDQMEventHeader().

00056 { return eventAddr_-buf_; }

void DQMEventMsgBuilder::setCompressionFlag ( uint32  value  ) 

Sets the value of the compression flag in the header.

Definition at line 157 of file DQMEventMsgBuilder.cc.

References buf_, DQMEventHeader::compressionFlag_, and convert().

Referenced by DQMEventMsgBuilder().

00158 {
00159   DQMEventHeader* evtHdr = (DQMEventHeader*) buf_;
00160   convert(value, evtHdr->compressionFlag_);
00161 }

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 140 of file DQMEventMsgBuilder.cc.

References buf_, bufSize_, convert(), Header::DQM_EVENT, eventAddr_, Exception, DQMEventHeader::header_, and headerSize().

Referenced by DQMEventMsgBuilder().

00141 {
00142   if (((uint32) (eventAddr_ + len - buf_)) > bufSize_)
00143     {
00144       throw cms::Exception("MessageBuilding", "DQMEventMsgBuilder")
00145         << "Event data overflows buffer. Buffer size = " << bufSize_
00146         << ", header size = " << this->headerSize()
00147         << ", event size = " << len << ".\n";
00148     }
00149   convert(len, eventAddr_ - sizeof(char_uint32));
00150   DQMEventHeader* evtHdr = (DQMEventHeader*) buf_;
00151   new (&evtHdr->header_) Header(Header::DQM_EVENT, (eventAddr_ - buf_ + len));
00152 }

void DQMEventMsgBuilder::setFUGuid ( uint32  value  ) 

Sets the value of the filter unit GUID in the header.

Definition at line 175 of file DQMEventMsgBuilder.cc.

References buf_, convert(), and DQMEventHeader::fuGuid_.

Referenced by DQMEventMsgBuilder().

00176 {
00177   DQMEventHeader* evtHdr = (DQMEventHeader*) buf_;
00178   convert(value, evtHdr->fuGuid_);
00179 }

void DQMEventMsgBuilder::setFUProcessId ( uint32  value  ) 

Sets the value of the filter unit process ID in the header.

Definition at line 166 of file DQMEventMsgBuilder.cc.

References buf_, convert(), and DQMEventHeader::fuProcessId_.

Referenced by DQMEventMsgBuilder().

00167 {
00168   DQMEventHeader* evtHdr = (DQMEventHeader*) buf_;
00169   convert(value, evtHdr->fuProcessId_);
00170 }

void DQMEventMsgBuilder::setReserved ( uint32  value  ) 

Sets the value of the reserved word in the header.

Definition at line 184 of file DQMEventMsgBuilder.cc.

References buf_, convert(), and DQMEventHeader::reserved_.

Referenced by DQMEventMsgBuilder().

00185 {
00186   DQMEventHeader* evtHdr = (DQMEventHeader*) buf_;
00187   convert(value, evtHdr->reserved_);
00188 }

uint32 DQMEventMsgBuilder::size ( void   )  const

Returns the size of the message.

Definition at line 193 of file DQMEventMsgBuilder.cc.

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

Referenced by StreamDQMOutputFile::write(), and FUShmDQMOutputService::writeShmDQMData().

00194 {
00195   HeaderView v(buf_);
00196   return v.size();
00197 }

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

Definition at line 55 of file DQMEventMsgBuilder.h.

References buf_.

Referenced by StreamDQMOutputFile::writeDQMEventHeader(), and FUShmDQMOutputService::writeShmDQMData().

00055 { return buf_; }


Member Data Documentation

uint8* DQMEventMsgBuilder::buf_ [private]

Definition at line 66 of file DQMEventMsgBuilder.h.

Referenced by DQMEventMsgBuilder(), headerSize(), setCompressionFlag(), setEventLength(), setFUGuid(), setFUProcessId(), setReserved(), size(), and startAddress().

uint32 DQMEventMsgBuilder::bufSize_ [private]

Definition at line 67 of file DQMEventMsgBuilder.h.

Referenced by bufferSize(), DQMEventMsgBuilder(), and setEventLength().

uint8* DQMEventMsgBuilder::eventAddr_ [private]

Definition at line 68 of file DQMEventMsgBuilder.h.

Referenced by DQMEventMsgBuilder(), eventAddress(), headerSize(), and setEventLength().


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