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
ConsRegResponseView Class Reference

#include <ConsRegMessage.h>

Public Member Functions

uint32 code () const
 
 ConsRegResponseView (void *buf)
 
uint32 getConsumerId ()
 
uint32 getStatus ()
 
std::map< std::string, StringsgetStreamSelectionTable ()
 
uint32 size () const
 
uint8startAddress ()
 

Private Attributes

uint8buf_
 
uint32 consumerId_
 
HeaderView head_
 
uint32 status_
 

Detailed Description

Definition at line 78 of file ConsRegMessage.h.

Constructor & Destructor Documentation

ConsRegResponseView::ConsRegResponseView ( void *  buf)

Constructor for the consumer registration response viewer.

Definition at line 179 of file ConsRegMessage.cc.

References buf_, code(), Header::CONS_REG_RESPONSE, consumerId_, convert32(), edm::hlt::Exception, and status_.

179  :
180  buf_((uint8*)buf),head_(buf)
181 {
182  uint8* bufPtr;
183 
184  // verify that the buffer actually contains a registration response
185  if (this->code() != Header::CONS_REG_RESPONSE)
186  {
187  throw cms::Exception("MessageDecoding","ConsRegResponseView")
188  << "Invalid consumer registration response message code ("
189  << this->code() << "). Should be " << Header::CONS_REG_RESPONSE << "\n";
190  }
191 
192  // update the buffer pointer to just beyond the header
193  bufPtr = buf_ + sizeof(Header);
194 
195  // decode the status
196  status_ = convert32(bufPtr);
197  bufPtr += sizeof(uint32);
198 
199  // decode the consumer ID
200  consumerId_ = convert32(bufPtr);
201  bufPtr += sizeof(uint32);
202 }
unsigned int uint32
Definition: MsgTools.h:13
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
unsigned char uint8
Definition: MsgTools.h:11
uint32 code() const

Member Function Documentation

uint32 ConsRegResponseView::code ( ) const
inline

Definition at line 83 of file ConsRegMessage.h.

References HeaderView::code(), and head_.

Referenced by ConsRegResponseView().

83 { return head_.code(); }
uint32 code() const
Definition: MsgHeader.h:34
uint32 ConsRegResponseView::getConsumerId ( )
inline

Definition at line 88 of file ConsRegMessage.h.

References consumerId_.

88 { return consumerId_; }
uint32 ConsRegResponseView::getStatus ( void  )
inline

Definition at line 87 of file ConsRegMessage.h.

References status_.

87 { return status_; }
std::map< std::string, Strings > ConsRegResponseView::getStreamSelectionTable ( )

Returns the map of trigger selections for each storage manager output stream.

Definition at line 208 of file ConsRegMessage.cc.

References buf_, convert32(), MsgTools::getNames(), size(), and StorageManager_cfg::streamLabel.

209 {
210  std::map<std::string, Strings> selTable;
211 
212  // check if there is more than just the status code and consumer id
213  if (size() >= (3 * sizeof(uint32)))
214  {
215  // initialize the data pointer to the start of the map data
216  uint8* bufPtr = buf_ + sizeof(Header);
217  bufPtr += (2 * sizeof(uint32));
218 
219  // decode the number of streams in the table
220  uint32 streamCount = convert32(bufPtr);
221  bufPtr += sizeof(uint32);
222 
223  // loop over each stream
224  for (uint32 idx = 0; idx < streamCount; idx++)
225  {
226  // decode the vector of strings for the stream
227  Strings workList;
228  //uint32 listCount = convert32(bufPtr);
229  bufPtr += sizeof(uint32);
230  uint32 listLen = convert32(bufPtr);
231  bufPtr += sizeof(uint32);
232  MsgTools::getNames(bufPtr, listLen, workList);
233 
234  // pull the map key off the end of the list
235  std::string streamLabel = workList.back();
236  workList.pop_back();
237  selTable[streamLabel] = workList;
238 
239  // move on to the next entry in the message
240  bufPtr += listLen;
241  }
242  }
243 
244  return selTable;
245 }
std::vector< std::string > Strings
Definition: MsgTools.h:18
unsigned int uint32
Definition: MsgTools.h:13
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:30
unsigned char uint8
Definition: MsgTools.h:11
void getNames(uint8 *from, uint32 from_len, Strings &to)
Definition: MsgTools.h:91
uint32 size() const
uint32 ConsRegResponseView::size ( void  ) const
inline

Definition at line 84 of file ConsRegMessage.h.

References head_, and HeaderView::size().

Referenced by getStreamSelectionTable().

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

Definition at line 85 of file ConsRegMessage.h.

References buf_.

85 { return buf_; }

Member Data Documentation

uint8* ConsRegResponseView::buf_
private

Definition at line 92 of file ConsRegMessage.h.

Referenced by ConsRegResponseView(), getStreamSelectionTable(), and startAddress().

uint32 ConsRegResponseView::consumerId_
private

Definition at line 95 of file ConsRegMessage.h.

Referenced by ConsRegResponseView(), and getConsumerId().

HeaderView ConsRegResponseView::head_
private

Definition at line 93 of file ConsRegMessage.h.

Referenced by code(), and size().

uint32 ConsRegResponseView::status_
private

Definition at line 94 of file ConsRegMessage.h.

Referenced by ConsRegResponseView(), and getStatus().