CMS 3D CMS Logo

Functions

MsgTools Namespace Reference

Functions

uint8fillNames (const Strings &names, uint8 *pos)
void getNames (uint8 *from, uint32 from_len, Strings &to)

Function Documentation

uint8* MsgTools::fillNames ( const Strings names,
uint8 pos 
) [inline]

Definition at line 75 of file MsgTools.h.

References lhef::cc::convert(), edm::copy_all(), first, and pos.

Referenced by InitMsgBuilder::InitMsgBuilder(), and ConsRegResponseBuilder::setStreamSelectionTable().

{
  uint32 sz = names.size();
  convert(sz,pos); // save number of strings
  uint8* len_pos = pos + sizeof(char_uint32); // area for length
  pos = len_pos + sizeof(char_uint32); // area for full string of names
  bool first = true;

  for(Strings::const_iterator beg = names.begin(); beg != names.end(); ++beg) {
      if(first) first = false; else *pos++ = ' ';
      pos = edm::copy_all(*beg,pos);
  }
  convert((uint32)(pos-len_pos-sizeof(char_uint32)),len_pos);
  return pos;
}
void MsgTools::getNames ( uint8 from,
uint32  from_len,
Strings to 
) [inline]

Definition at line 91 of file MsgTools.h.

References filterCSVwithJSON::copy.

Referenced by ConsRegResponseView::getStreamSelectionTable(), InitMsgView::hltTriggerNames(), InitMsgView::hltTriggerSelections(), and InitMsgView::l1TriggerNames().

{
  // not the most efficient way to do this
  std::istringstream ist(std::string(reinterpret_cast<char *>(from),from_len));
  typedef std::istream_iterator<std::string> Iter;
  std::copy(Iter(ist),Iter(),std::back_inserter(to));
}