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 110 of file ConsRegMessage.cc.

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

112  :
113  buf_((uint8*)buf),bufSize_(bufSize)
114 {
115  uint8* bufPtr;
116 
117  // update the buffer pointer to just beyond the header
118  bufPtr = buf_ + sizeof(Header);
119  assert(((uint32) (bufPtr - buf_)) <= bufSize_);
120 
121  // encode the status
122  assert(((uint32) (bufPtr + sizeof(uint32) - buf_)) <= bufSize_);
123  convert (status, bufPtr);
124  bufPtr += sizeof(uint32);
125 
126  // encode the consumer ID
127  assert(((uint32) (bufPtr + sizeof(uint32) - buf_)) <= bufSize_);
128  convert (consumerId, bufPtr);
129  bufPtr += sizeof(uint32);
130 
131  // create the message header now that we now the full size
132  new (buf_) Header(Header::CONS_REG_RESPONSE, (bufPtr - buf_));
133 }
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
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 149 of file ConsRegMessage.cc.

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

150 {
151  // add the table just beyond the existing data
152  uint8* bufPtr = buf_ + size();
153 
154  // add the number of entries in the table to the message
155  convert (static_cast<uint32>(selTable.size()), bufPtr);
156  bufPtr += sizeof(uint32);
157  assert(((uint32) (bufPtr - buf_)) <= bufSize_);
158 
159  // add each entry in the table to the message
160  std::map<std::string, Strings>::const_iterator mapIter;
161  for (mapIter = selTable.begin(); mapIter != selTable.end(); mapIter++)
162  {
163  // create a new string list with the map key as the last entry
164  Strings workList = mapIter->second;
165  workList.push_back(mapIter->first);
166 
167  // copy the string list into the message
168  bufPtr = MsgTools::fillNames(workList, bufPtr);
169  assert(((uint32) (bufPtr - buf_)) <= bufSize_);
170  }
171 
172  // update the message header with the new full size
173  new (buf_) Header(Header::CONS_REG_RESPONSE, (bufPtr - buf_));
174 }
std::vector< std::string > Strings
Definition: MsgTools.h:18
void convert(uint32 i, char_uint32 v)
Definition: MsgTools.h:46
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 138 of file ConsRegMessage.cc.

References buf_, and HeaderView::size().

Referenced by setStreamSelectionTable().

139 {
140  HeaderView hview(buf_);
141  return hview.size();
142 }
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().