CMS 3D CMS Logo

Public Member Functions | Private Attributes

ConsRegRequestView Class Reference

#include <ConsRegMessage.h>

List of all members.

Public Member Functions

uint32 code () const
 ConsRegRequestView (void *buf)
std::string getConsumerName ()
std::string getConsumerPriority ()
std::string getRequestParameterSet ()
uint32 size () const
uint8startAddress ()

Private Attributes

uint8buf_
std::string consumerName_
std::string consumerPriority_
HeaderView head_
std::string requestParameterSet_

Detailed Description

Definition at line 37 of file ConsRegMessage.h.


Constructor & Destructor Documentation

ConsRegRequestView::ConsRegRequestView ( void *  buf)

Constructor for the consumer registration request viewer.

Definition at line 74 of file ConsRegMessage.cc.

References buf_, code(), Header::CONS_REG_REQUEST, consumerName_, consumerPriority_, convert32(), Exception, requestParameterSet_, and size().

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

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

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

  // determine the consumer name
  len = convert32(bufPtr);
  bufPtr += sizeof(uint32);
  if (len <= 256) // len >= 0, since len is unsigned
  {
    consumerName_.append((char *) bufPtr, len);
  }
  bufPtr += len;

  // determine the consumer priority
  len = convert32(bufPtr);
  bufPtr += sizeof(uint32);
  if (len <= 64) // len >= 0, since len is unsigned
  {
    consumerPriority_.append((char *) bufPtr, len);
  }
  bufPtr += len;

  // determine the request parameter set (maintain backward compatibility
  // with sources of registration requests that don't have the param set)
  if (bufPtr < (buf_ + this->size()))
    {
      len = convert32(bufPtr);
      bufPtr += sizeof(uint32);
      // what is a reasonable limit?  This is just to prevent
      // a bogus, really large value from being used...
      if (len <= 65000) // len >= 0, since len is unsigned
      {
        requestParameterSet_.append((char *) bufPtr, len);
      }
      bufPtr += len;
    }
}

Member Function Documentation

uint32 ConsRegRequestView::code ( ) const [inline]

Definition at line 42 of file ConsRegMessage.h.

References HeaderView::code(), and head_.

Referenced by ConsRegRequestView().

{ return head_.code(); }
std::string ConsRegRequestView::getConsumerName ( ) [inline]

Definition at line 46 of file ConsRegMessage.h.

References consumerName_.

{ return consumerName_; }
std::string ConsRegRequestView::getConsumerPriority ( ) [inline]

Definition at line 47 of file ConsRegMessage.h.

References consumerPriority_.

{ return consumerPriority_; }
std::string ConsRegRequestView::getRequestParameterSet ( ) [inline]

Definition at line 48 of file ConsRegMessage.h.

References requestParameterSet_.

uint32 ConsRegRequestView::size ( void  ) const [inline]

Definition at line 43 of file ConsRegMessage.h.

References head_, and HeaderView::size().

Referenced by ConsRegRequestView().

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

Definition at line 44 of file ConsRegMessage.h.

References buf_.

{ return buf_; }

Member Data Documentation

Definition at line 51 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and startAddress().

std::string ConsRegRequestView::consumerName_ [private]

Definition at line 53 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and getConsumerName().

Definition at line 54 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and getConsumerPriority().

Definition at line 52 of file ConsRegMessage.h.

Referenced by code(), and size().

Definition at line 55 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and getRequestParameterSet().