CMS 3D CMS Logo

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

#include <ConsRegMessage.h>

Public Types

enum  STATUS_CODES { ES_NOT_READY = 0x10000 }
 

Public Member Functions

uint32 bufferSize () const
 
 ConsRegResponseBuilder (void *buf, uint32 bufSize, uint32 status, uint32 consumerId)
 
void setStreamSelectionTable (std::map< std::string, Strings > const &selTable)
 
uint32 size () const
 
uint8startAddress ()
 

Private Attributes

uint8buf_
 
uint32 bufSize_
 

Detailed Description

Definition at line 57 of file ConsRegMessage.h.

Member Enumeration Documentation

Enumerator
ES_NOT_READY 

Definition at line 69 of file ConsRegMessage.h.

Constructor & Destructor Documentation

ConsRegResponseBuilder::ConsRegResponseBuilder ( void *  buf,
uint32  bufSize,
uint32  status,
uint32  consumerId 
)

Constructor for the consumer registration response builder.

Definition at line 105 of file ConsRegMessage.cc.

References buf_, bufSize_, Header::CONS_REG_RESPONSE, and fileCollector::convert().

107  :
108  buf_((uint8*)buf),bufSize_(bufSize)
109 {
110  // update the buffer pointer to just beyond the header
111  uint8* bufPtr = buf_ + sizeof(Header);
112  assert(((uint32) (bufPtr - buf_)) <= bufSize_);
113 
114  // encode the status
115  assert(((uint32) (bufPtr + sizeof(uint32) - buf_)) <= bufSize_);
116  convert (status, bufPtr);
117  bufPtr += sizeof(uint32);
118 
119  // encode the consumer ID
120  assert(((uint32) (bufPtr + sizeof(uint32) - buf_)) <= bufSize_);
121  convert (consumerId, bufPtr);
122  bufPtr += sizeof(uint32);
123 
124  // create the message header now that we now the full size
125  new (buf_) Header(Header::CONS_REG_RESPONSE, (bufPtr - buf_));
126 }
static int const bufSize
Definition: Guid.cc:24
unsigned int uint32
Definition: MsgTools.h:13
unsigned char uint8
Definition: MsgTools.h:11
tuple status
Definition: ntuplemaker.py:245

Member Function Documentation

uint32 ConsRegResponseBuilder::bufferSize ( ) const
inline

Definition at line 63 of file ConsRegMessage.h.

References bufSize_.

63 { return bufSize_; }
void ConsRegResponseBuilder::setStreamSelectionTable ( std::map< std::string, Strings > const &  selTable)

Sets the stream selection table (map of trigger selections for each storage manager output stream) in the response.

Definition at line 142 of file ConsRegMessage.cc.

References buf_, bufSize_, Header::CONS_REG_RESPONSE, fileCollector::convert(), MsgTools::fillNames(), and size().

143 {
144  // add the table just beyond the existing data
145  uint8* bufPtr = buf_ + size();
146 
147  // add the number of entries in the table to the message
148  convert (static_cast<uint32>(selTable.size()), bufPtr);
149  bufPtr += sizeof(uint32);
150  assert(((uint32) (bufPtr - buf_)) <= bufSize_);
151 
152  // add each entry in the table to the message
153  std::map<std::string, Strings>::const_iterator mapIter;
154  for (mapIter = selTable.begin(); mapIter != selTable.end(); mapIter++)
155  {
156  // create a new string list with the map key as the last entry
157  Strings workList = mapIter->second;
158  workList.push_back(mapIter->first);
159 
160  // copy the string list into the message
161  bufPtr = MsgTools::fillNames(workList, bufPtr);
162  assert(((uint32) (bufPtr - buf_)) <= bufSize_);
163  }
164 
165  // update the message header with the new full size
166  new (buf_) Header(Header::CONS_REG_RESPONSE, (bufPtr - buf_));
167 }
std::vector< std::string > Strings
Definition: MsgTools.h:18
unsigned int uint32
Definition: MsgTools.h:13
unsigned char uint8
Definition: MsgTools.h:11
uint8 * fillNames(const Strings &names, uint8 *pos)
Definition: MsgTools.h:75
uint32 ConsRegResponseBuilder::size ( void  ) const

Returns the size of the consumer registration response.

Definition at line 131 of file ConsRegMessage.cc.

References buf_, and HeaderView::size().

Referenced by setStreamSelectionTable().

132 {
133  HeaderView hview(buf_);
134  return hview.size();
135 }
uint8* ConsRegResponseBuilder::startAddress ( )
inline

Definition at line 64 of file ConsRegMessage.h.

References buf_.

64 { return buf_; }

Member Data Documentation

uint8* ConsRegResponseBuilder::buf_
private
uint32 ConsRegResponseBuilder::bufSize_
private

Definition at line 73 of file ConsRegMessage.h.

Referenced by bufferSize(), ConsRegResponseBuilder(), and setStreamSelectionTable().