CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ConsRegRequestView Class Reference

#include <ConsRegMessage.h>

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(), edm::hlt::Exception, requestParameterSet_, and size().

65  :
66  buf_((uint8*)buf),head_(buf)
67 {
68  uint8* bufPtr;
69  uint32 len;
70 
71  // verify that the buffer actually contains a registration request
72  if (this->code() != Header::CONS_REG_REQUEST)
73  {
74  throw cms::Exception("MessageDecoding","ConsRegRequestView")
75  << "Invalid consumer registration request message code ("
76  << this->code() << "). Should be " << Header::CONS_REG_REQUEST << "\n";
77  }
78 
79  // update the buffer pointer to just beyond the header
80  bufPtr = buf_ + sizeof(Header);
81 
82  // determine the consumer name
83  len = convert32(bufPtr);
84  bufPtr += sizeof(uint32);
85  if (len <= 256) // len >= 0, since len is unsigned
86  {
87  consumerName_.append((char *) bufPtr, len);
88  }
89  bufPtr += len;
90 
91  // determine the request parameter set (maintain backward compatibility
92  // with sources of registration requests that don't have the param set)
93  if (bufPtr < (buf_ + this->size()))
94  {
95  len = convert32(bufPtr);
96  bufPtr += sizeof(uint32);
97  // what is a reasonable limit? This is just to prevent
98  // a bogus, really large value from being used...
99  if (len <= 65000) // len >= 0, since len is unsigned
100  {
101  requestParameterSet_.append((char *) bufPtr, len);
102  }
103  bufPtr += len;
104  }
105 }
std::string requestParameterSet_
uint32 code() const
unsigned int uint32
Definition: MsgTools.h:13
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
unsigned char uint8
Definition: MsgTools.h:11
uint32 size() const
std::string consumerName_

Member Function Documentation

uint32 ConsRegRequestView::code ( ) const
inline

Definition at line 41 of file ConsRegMessage.h.

References HeaderView::code(), and head_.

Referenced by ConsRegRequestView().

41 { return head_.code(); }
uint32 code() const
Definition: MsgHeader.h:34
std::string ConsRegRequestView::getConsumerName ( )
inline

Definition at line 45 of file ConsRegMessage.h.

References consumerName_.

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

Definition at line 46 of file ConsRegMessage.h.

References requestParameterSet_.

46 { return requestParameterSet_; }
std::string requestParameterSet_
uint32 ConsRegRequestView::size ( void  ) const
inline

Definition at line 42 of file ConsRegMessage.h.

References head_, and HeaderView::size().

Referenced by ConsRegRequestView().

42 { return head_.size(); }
uint32 size() const
Definition: MsgHeader.h:35
uint8* ConsRegRequestView::startAddress ( )
inline

Definition at line 43 of file ConsRegMessage.h.

References buf_.

43 { return buf_; }

Member Data Documentation

uint8* ConsRegRequestView::buf_
private

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().

HeaderView ConsRegRequestView::head_
private

Definition at line 50 of file ConsRegMessage.h.

Referenced by code(), and size().

std::string ConsRegRequestView::requestParameterSet_
private

Definition at line 52 of file ConsRegMessage.h.

Referenced by ConsRegRequestView(), and getRequestParameterSet().