CbmRoot
CbmFormatMsBufferPrintout.cxx
Go to the documentation of this file.
1 
3 
4 std::string FormatMsBufferPrintout(const fles::Timeslice& ts,
5  const size_t uMsCompIdx,
6  const size_t uMsIdx,
7  const uint32_t uBlocksPerLine) {
8  fles::MicrosliceDescriptor msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
9  const uint8_t* msContent =
10  reinterpret_cast<const uint8_t*>(ts.content(uMsCompIdx, uMsIdx));
11 
12  return FormatMsBufferPrintout(msDescriptor, msContent, uBlocksPerLine);
13 }
14 
15 std::string
16 FormatMsBufferPrintout(const fles::MicrosliceDescriptor& msDescriptor,
17  const uint8_t* msContent,
18  const uint32_t uBlocksPerLine) {
19  uint32_t uMsSize = msDescriptor.size / 4; // Size in 32 bit blocks
20  const uint32_t* pInBuff = reinterpret_cast<const uint32_t*>(msContent);
21 
22  std::stringstream ss;
23  ss << "Microslice buffer content:" << std::endl << std::setfill('0');
24  for (uint32_t uBlock = 0; uBlock < uMsSize; ++uBlock) {
25  ss << "0x" << std::hex << std::setw(8) << pInBuff[uBlock] << " ";
26 
27  if (uBlocksPerLine - 1 == uBlock % uBlocksPerLine)
28  ss << " : " << std::dec << std::setw(4) << uBlock - 1 << std::endl;
29  } // for( uint32_t uBlock = 0; uBlock < uMsSize; ++uBlock )
30  if (0 < uMsSize % uBlocksPerLine) ss << std::endl;
31  ss << std::dec << std::setfill(' ');
32 
33  return ss.str();
34 }
FormatMsBufferPrintout
std::string FormatMsBufferPrintout(const fles::Timeslice &ts, const size_t uMsCompIdx, const size_t uMsIdx, const uint32_t uBlocksPerLine)
Definition: CbmFormatMsBufferPrintout.cxx:4
CbmFormatMsBufferPrintout.h