CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

ConsRegResponseBuilder Class Reference

#include <ConsRegMessage.h>

List of all members.

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.

{ ES_NOT_READY = 0x10000 };

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 lhef::cc::convert().

                                                                 :
  buf_((uint8*)buf),bufSize_(bufSize)
{
  // update the buffer pointer to just beyond the header
  uint8* bufPtr = buf_ + sizeof(Header);
  assert(((uint32) (bufPtr - buf_)) <= bufSize_);

  // encode the status
  assert(((uint32) (bufPtr + sizeof(uint32) - buf_)) <= bufSize_);
  convert (status, bufPtr);
  bufPtr += sizeof(uint32);

  // encode the consumer ID
  assert(((uint32) (bufPtr + sizeof(uint32) - buf_)) <= bufSize_);
  convert (consumerId, bufPtr);
  bufPtr += sizeof(uint32);

  // create the message header now that we now the full size
  new (buf_) Header(Header::CONS_REG_RESPONSE, (bufPtr - buf_));
}

Member Function Documentation

uint32 ConsRegResponseBuilder::bufferSize ( ) const [inline]

Definition at line 63 of file ConsRegMessage.h.

References bufSize_.

{ 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, lhef::cc::convert(), MsgTools::fillNames(), and size().

{
  // add the table just beyond the existing data
  uint8* bufPtr = buf_ + size();

  // add the number of entries in the table to the message
  convert (static_cast<uint32>(selTable.size()), bufPtr);
  bufPtr += sizeof(uint32);
  assert(((uint32) (bufPtr - buf_)) <= bufSize_);

  // add each entry in the table to the message
  std::map<std::string, Strings>::const_iterator mapIter;
  for (mapIter = selTable.begin(); mapIter != selTable.end(); mapIter++)
    {
      // create a new string list with the map key as the last entry
      Strings workList = mapIter->second;
      workList.push_back(mapIter->first);

      // copy the string list into the message
      bufPtr = MsgTools::fillNames(workList, bufPtr);
      assert(((uint32) (bufPtr - buf_)) <= bufSize_);
    }

  // update the message header with the new full size
  new (buf_) Header(Header::CONS_REG_RESPONSE, (bufPtr - buf_));
}
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().

{
  HeaderView hview(buf_);
  return hview.size();
}
uint8* ConsRegResponseBuilder::startAddress ( ) [inline]

Definition at line 64 of file ConsRegMessage.h.

References buf_.

{ return buf_; }

Member Data Documentation

Definition at line 73 of file ConsRegMessage.h.

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