CMS 3D CMS Logo

Public Member Functions | Private Attributes

DQMEventMsgView Class Reference

#include <DQMEventMessage.h>

List of all members.

Public Member Functions

uint32 adler32_chksum () const
uint32 code () const
uint32 compressionFlag () const
 DQMEventMsgView (void *buf)
uint8eventAddress () const
uint32 eventLength () const
uint32 eventNumberAtUpdate () const
uint32 fuGuid () const
uint32 fuProcessId () const
uint32 headerSize () const
std::string hostName () const
uint32 hostName_len () const
uint32 lumiSection () const
uint32 meCount (std::string const &subFolderName) const
uint32 meCount (uint32 const subFolderIndex) const
uint32 protocolVersion () const
std::string releaseTag () const
uint32 reserved () const
uint32 runNumber () const
uint32 size () const
uint8startAddress () const
uint32 subFolderCount () const
std::string subFolderName (uint32 const subFolderIndex) const
boost::shared_ptr< std::vector
< std::string > > 
subFolderNames () const
edm::Timestamp timeStamp () const
std::string topFolderName () const
uint32 updateNumber () const

Private Attributes

uint32 adler32_chksum_
uint8buf_
uint8eventAddr_
uint32 eventLen_
std::string folderName_
HeaderView head_
uint32 host_name_len_
uint8host_name_start_
std::vector< uint32meCountList_
boost::shared_ptr< std::vector
< std::string > > 
nameListPtr_
std::string releaseTag_
uint32 subFolderCount_
std::map< std::string, uint32subFolderIndexTable_

Detailed Description

Definition at line 73 of file DQMEventMessage.h.


Constructor & Destructor Documentation

DQMEventMsgView::DQMEventMsgView ( void *  buf)

Constructor.

Definition at line 16 of file DQMEventMessage.cc.

References adler32_chksum_, buf_, code(), convert32(), Header::DQM_EVENT, eventAddr_, eventLen_, eventLength(), Exception, folderName_, headerSize(), host_name_len_, host_name_start_, MAX_STRING_SIZE, meCount(), meCountList_, nameListPtr_, protocolVersion(), releaseTag_, size(), subFolderCount_, subFolderIndexTable_, and subFolderName().

                                         :
  buf_((uint8*)buf),head_(buf)
{
  uint8* bufPtr;
  uint32 len;

  // verify that the buffer actually contains a DQM Event message
  if (this->code() != Header::DQM_EVENT)
    {
      throw cms::Exception("MessageDecoding", "DQMEventMsgView")
        << "Invalid DQM Event message code (" << this->code()
        << "). Should be " << Header::DQM_EVENT << "\n";
    }

  // verify that the message has a protocol that we support
  if (this->protocolVersion() != 3)
    {
      throw cms::Exception("MessageDecoding", "DQMEventMsgView")
        << "Unsupport protocol version (" << this->protocolVersion() << ").\n";
    }

  // set our buffer pointer to just beyond the fixed header data
  bufPtr = buf_ + sizeof(DQMEventHeader);

  // determine the release tag
  len = convert32(bufPtr);
  bufPtr += sizeof(uint32);
  if (len <= MAX_STRING_SIZE) // prevent something totally crazy // len >= 0, since len is unsigned.
  {
    releaseTag_.append((char *) bufPtr, len);
  }
  bufPtr += len;

  // determine the top-level folder name
  len = convert32(bufPtr);
  bufPtr += sizeof(uint32);
  if (len <= MAX_STRING_SIZE) // prevent something totally crazy // len >= 0, since len is unsigned.
  {
    folderName_.append((char *) bufPtr, len);
  }
  bufPtr += len;

  // determine the number of subfolders
  subFolderCount_ = convert32(bufPtr);
  bufPtr += sizeof(uint32);

  // loop over the subfolders to extract relevant quantities
  nameListPtr_.reset(new std::vector<std::string>());
  for (int idx = 0; idx < (int) subFolderCount_; idx++)
    {
      // number of MEs in subfolder
      uint32 meCount = convert32(bufPtr);
      bufPtr += sizeof(uint32);
      meCountList_.push_back(meCount);

      // subfolder name
      std::string subFolderName = "Subfolder " + idx;
      uint32 nameLen = convert32(bufPtr);
      bufPtr += sizeof(uint32);
      if (nameLen <= MAX_STRING_SIZE) // prevent something totally crazy // nameLen >= 0, since nameLen is unsigned.
      {
        subFolderName.clear();
        subFolderName.append((char *) bufPtr, nameLen);
      }
      bufPtr += nameLen;
      nameListPtr_->push_back(subFolderName);
      subFolderIndexTable_[subFolderName] = idx;
    }
  adler32_chksum_ = convert32(bufPtr);
  bufPtr += sizeof(uint32);

  host_name_len_ = *bufPtr;
  bufPtr += sizeof(uint8);
  host_name_start_ = bufPtr;
  bufPtr += host_name_len_;

  // determine the event length and address
  eventLen_ = convert32(bufPtr);
  bufPtr += sizeof(uint32);
  eventAddr_ = bufPtr;

  // check that the event data doesn't extend beyond the reported
  // size of the message
  if ((this->headerSize() + this->eventLength()) > this->size())
    {
      throw cms::Exception("MessageDecoding", "DQMEventMsgView")
        << "Inconsistent data sizes. The size of the header ("
        << this->headerSize() << ") and the data (" << this->eventLength()
        << ") exceed the size of the message (" << this->size() << ").\n";
    }
}

Member Function Documentation

uint32 DQMEventMsgView::adler32_chksum ( ) const [inline]
uint32 DQMEventMsgView::code ( ) const [inline]
uint32 DQMEventMsgView::compressionFlag ( ) const

Returns the compression flag (uncompressed data size or zero if uncompressed).

Definition at line 228 of file DQMEventMessage.cc.

References buf_, DQMEventHeader::compressionFlag_, convert32(), and h.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and dumpDQMEventHeader().

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

Definition at line 82 of file DQMEventMessage.h.

References eventAddr_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and StreamDQMOutputFile::write().

{ return eventAddr_; }
uint32 DQMEventMsgView::eventLength ( ) const [inline]
uint32 DQMEventMsgView::eventNumberAtUpdate ( ) const
uint32 DQMEventMsgView::fuGuid ( ) const

Returns the GUID of the filter unit that created this update.

Definition at line 246 of file DQMEventMessage.cc.

References buf_, convert32(), DQMEventHeader::fuGuid_, and h.

Referenced by dumpDQMEventHeader().

uint32 DQMEventMsgView::fuProcessId ( ) const

Returns the process ID of the filter unit that created this update.

Definition at line 237 of file DQMEventMessage.cc.

References buf_, convert32(), DQMEventHeader::fuProcessId_, and h.

Referenced by dumpDQMEventHeader().

uint32 DQMEventMsgView::headerSize ( ) const

Returns the size of the DQM Event header.

Definition at line 183 of file DQMEventMessage.cc.

References buf_, convert32(), h, and DQMEventHeader::headerSize_.

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

std::string DQMEventMsgView::hostName ( ) const

Definition at line 268 of file DQMEventMessage.cc.

References host_name_len_, and host_name_start_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and dumpDQMEventHeader().

{
   return std::string(reinterpret_cast<char *>(host_name_start_),host_name_len_);
}
uint32 DQMEventMsgView::hostName_len ( ) const [inline]

Definition at line 86 of file DQMEventMessage.h.

References host_name_len_.

{return host_name_len_;}
uint32 DQMEventMsgView::lumiSection ( ) const
uint32 DQMEventMsgView::meCount ( std::string const &  subFolderName) const

Returns the number of monitor elements in the specified subfolder.

Definition at line 136 of file DQMEventMessage.cc.

References Exception, and subFolderIndexTable_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), DQMEventMsgView(), and dumpDQMEventView().

{
  // lookup the index of the specified subfolder
  std::map<std::string, uint32>::const_iterator subFolderIter;
  subFolderIter = subFolderIndexTable_.find(subFolderName);

  // throw an exception if the name was not found
  if (subFolderIter == subFolderIndexTable_.end())
    {
      throw cms::Exception("MessageDecoding", "DQMEventMsgView")
        << "Unable to find the subfolder index for \""
        << subFolderName << "\".\n";
    }

  // fetch the count by index
  return this->meCount(subFolderIter->second);
}
uint32 DQMEventMsgView::meCount ( uint32 const  subFolderIndex) const

Returns the number of monitor elements in the subfolder at the specified index.

Definition at line 158 of file DQMEventMessage.cc.

References Exception, meCountList_, and subFolderCount_.

{
  // catch attempts to access an invalid entry
  if (subFolderIndex >= subFolderCount_)
    {
      throw cms::Exception("MessageDecoding", "DQMEventMsgView")
        << "Invalid subfolder index (" << subFolderIndex << ") - "
        << "the number of subfolders is " << subFolderCount_ << ".\n";
    }

  return meCountList_[subFolderIndex];
}
uint32 DQMEventMsgView::protocolVersion ( ) const

Returns the protocol version of the DQM Event.

Definition at line 174 of file DQMEventMessage.cc.

References buf_, convert32(), h, and DQMEventHeader::protocolVersion_.

Referenced by DQMEventMsgView(), and dumpDQMEventHeader().

std::string DQMEventMsgView::releaseTag ( ) const [inline]

Definition at line 101 of file DQMEventMessage.h.

References releaseTag_.

Referenced by stor::DQMTopLevelFolder::addDQMEvent(), and dumpDQMEventHeader().

{ return releaseTag_; }
uint32 DQMEventMsgView::reserved ( ) const

Returns the reserved word associated with the DQM Event.

Definition at line 255 of file DQMEventMessage.cc.

References buf_, convert32(), h, and DQMEventHeader::reserved_.

Referenced by dumpDQMEventHeader().

uint32 DQMEventMsgView::runNumber ( ) const
uint32 DQMEventMsgView::size ( void  ) const [inline]
uint8* DQMEventMsgView::startAddress ( ) const [inline]

Definition at line 81 of file DQMEventMessage.h.

References buf_.

Referenced by smproxy::DQMEventMsg::DQMEventMsg(), and StreamDQMOutputFile::writeDQMEventHeader().

{ return buf_; }
uint32 DQMEventMsgView::subFolderCount ( ) const [inline]

Definition at line 104 of file DQMEventMessage.h.

References subFolderCount_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent().

{ return subFolderCount_; }
std::string DQMEventMsgView::subFolderName ( uint32 const  subFolderIndex) const

Returns the name of the subfolder at the specified index.

Definition at line 120 of file DQMEventMessage.cc.

References Exception, nameListPtr_, and subFolderCount_.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and DQMEventMsgView().

{
  // catch attempts to access an invalid entry
  if (subFolderIndex >= subFolderCount_)
    {
      throw cms::Exception("MessageDecoding", "DQMEventMsgView")
        << "Invalid subfolder index (" << subFolderIndex << ") - "
        << "the number of subfolders is " << subFolderCount_ << ".\n";
    }

  return (*nameListPtr_)[subFolderIndex];
}
boost::shared_ptr< std::vector< std::string > > DQMEventMsgView::subFolderNames ( ) const

Returns a shared pointer to the list of subfolder names.

Definition at line 112 of file DQMEventMessage.cc.

References nameListPtr_.

Referenced by dumpDQMEventView().

{
  return nameListPtr_;
}
edm::Timestamp DQMEventMsgView::timeStamp ( ) const
std::string DQMEventMsgView::topFolderName ( ) const [inline]
uint32 DQMEventMsgView::updateNumber ( ) const

Member Data Documentation

Definition at line 118 of file DQMEventMessage.h.

Referenced by adler32_chksum(), and DQMEventMsgView().

Definition at line 116 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and eventAddress().

Definition at line 117 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and eventLength().

std::string DQMEventMsgView::folderName_ [private]

Definition at line 115 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and topFolderName().

Definition at line 113 of file DQMEventMessage.h.

Referenced by code(), and size().

Definition at line 120 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), hostName(), and hostName_len().

Definition at line 119 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and hostName().

std::vector<uint32> DQMEventMsgView::meCountList_ [private]

Definition at line 124 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and meCount().

boost::shared_ptr< std::vector<std::string> > DQMEventMsgView::nameListPtr_ [private]

Definition at line 123 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), subFolderName(), and subFolderNames().

std::string DQMEventMsgView::releaseTag_ [private]

Definition at line 114 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and releaseTag().

Definition at line 121 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), meCount(), subFolderCount(), and subFolderName().

std::map<std::string, uint32> DQMEventMsgView::subFolderIndexTable_ [private]

Definition at line 122 of file DQMEventMessage.h.

Referenced by DQMEventMsgView(), and meCount().