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 getRequestParameterSet ()
uint32 size () const
uint8startAddress ()

Private Attributes

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

Detailed Description

Definition at line 36 of file ConsRegMessage.h.


Constructor & Destructor Documentation

ConsRegRequestView::ConsRegRequestView ( void *  buf)

Constructor for the consumer registration request viewer.

Definition at line 65 of file ConsRegMessage.cc.

References buf_, code(), Header::CONS_REG_REQUEST, consumerName_, 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 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 41 of file ConsRegMessage.h.

References HeaderView::code(), and head_.

Referenced by ConsRegRequestView().

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

Definition at line 45 of file ConsRegMessage.h.

References consumerName_.

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

Definition at line 46 of file ConsRegMessage.h.

References requestParameterSet_.

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

Definition at line 42 of file ConsRegMessage.h.

References head_, and HeaderView::size().

Referenced by ConsRegRequestView().

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

Definition at line 43 of file ConsRegMessage.h.

References buf_.

{ return buf_; }

Member Data Documentation

Definition at line 49 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and startAddress().

std::string ConsRegRequestView::consumerName_ [private]

Definition at line 51 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and getConsumerName().

Definition at line 50 of file ConsRegMessage.h.

Referenced by code(), and size().

Definition at line 52 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and getRequestParameterSet().