CMS 3D CMS Logo

Public Member Functions | Private Attributes

ConsRegResponseView Class Reference

#include <ConsRegMessage.h>

List of all members.

Public Member Functions

uint32 code () const
 ConsRegResponseView (void *buf)
uint32 getConsumerId ()
uint32 getStatus ()
std::map< std::string, StringsgetStreamSelectionTable ()
uint32 size () const
uint8startAddress ()

Private Attributes

uint8buf_
uint32 consumerId_
HeaderView head_
uint32 status_

Detailed Description

Definition at line 78 of file ConsRegMessage.h.


Constructor & Destructor Documentation

ConsRegResponseView::ConsRegResponseView ( void *  buf)

Constructor for the consumer registration response viewer.

Definition at line 179 of file ConsRegMessage.cc.

References buf_, code(), Header::CONS_REG_RESPONSE, consumerId_, convert32(), Exception, and status_.

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

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

  // update the buffer pointer to just beyond the header
  bufPtr = buf_ + sizeof(Header);

  // decode the status
  status_ = convert32(bufPtr);
  bufPtr += sizeof(uint32);

  // decode the consumer ID
  consumerId_ = convert32(bufPtr);
  bufPtr += sizeof(uint32);
}

Member Function Documentation

uint32 ConsRegResponseView::code ( ) const [inline]

Definition at line 83 of file ConsRegMessage.h.

References HeaderView::code(), and head_.

Referenced by ConsRegResponseView().

{ return head_.code(); }
uint32 ConsRegResponseView::getConsumerId ( ) [inline]

Definition at line 88 of file ConsRegMessage.h.

References consumerId_.

{ return consumerId_; }
uint32 ConsRegResponseView::getStatus ( void  ) [inline]

Definition at line 87 of file ConsRegMessage.h.

References status_.

{ return status_; }
std::map< std::string, Strings > ConsRegResponseView::getStreamSelectionTable ( )

Returns the map of trigger selections for each storage manager output stream.

Definition at line 208 of file ConsRegMessage.cc.

References buf_, convert32(), MsgTools::getNames(), size(), and python::StorageManager_cfg::streamLabel.

{
  std::map<std::string, Strings> selTable;

  // check if there is more than just the status code and consumer id
  if (size() >= (3 * sizeof(uint32)))
    {
      // initialize the data pointer to the start of the map data
      uint8* bufPtr = buf_ + sizeof(Header);
      bufPtr += (2 * sizeof(uint32));

      // decode the number of streams in the table
      uint32 streamCount = convert32(bufPtr);
      bufPtr += sizeof(uint32);

      // loop over each stream
      for (uint32 idx = 0; idx < streamCount; idx++)
        {
          // decode the vector of strings for the stream
          Strings workList;
          //uint32 listCount = convert32(bufPtr);
          bufPtr += sizeof(uint32);
          uint32 listLen = convert32(bufPtr);
          bufPtr += sizeof(uint32);
          MsgTools::getNames(bufPtr, listLen, workList);

          // pull the map key off the end of the list 
          std::string streamLabel = workList.back();
          workList.pop_back();
          selTable[streamLabel] = workList;

          // move on to the next entry in the message
          bufPtr += listLen;
        }
    }

  return selTable;
}
uint32 ConsRegResponseView::size ( void  ) const [inline]

Definition at line 84 of file ConsRegMessage.h.

References head_, and HeaderView::size().

Referenced by getStreamSelectionTable().

{ return head_.size(); }
uint8* ConsRegResponseView::startAddress ( ) [inline]

Definition at line 85 of file ConsRegMessage.h.

References buf_.

{ return buf_; }

Member Data Documentation

Definition at line 92 of file ConsRegMessage.h.

Referenced by ConsRegResponseView(), getStreamSelectionTable(), and startAddress().

Definition at line 95 of file ConsRegMessage.h.

Referenced by ConsRegResponseView(), and getConsumerId().

Definition at line 93 of file ConsRegMessage.h.

Referenced by code(), and size().

Definition at line 94 of file ConsRegMessage.h.

Referenced by ConsRegResponseView(), and getStatus().