CbmRoot
Loading...
Searching...
No Matches
CbmFormatMsBufferPrintout.cxx
Go to the documentation of this file.
1/* Copyright (C) 2020 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
6
7std::string FormatMsBufferPrintout(const fles::Timeslice& ts, const size_t uMsCompIdx, const size_t uMsIdx,
8 const uint32_t uBlocksPerLine)
9{
10 fles::MicrosliceDescriptor msDescriptor = ts.descriptor(uMsCompIdx, uMsIdx);
11 const uint8_t* msContent = reinterpret_cast<const uint8_t*>(ts.content(uMsCompIdx, uMsIdx));
12
13 return FormatMsBufferPrintout(msDescriptor, msContent, uBlocksPerLine);
14}
15
16std::string FormatMsBufferPrintout(const fles::MicrosliceDescriptor& msDescriptor, const uint8_t* msContent,
17 const uint32_t uBlocksPerLine)
18{
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}
std::string FormatMsBufferPrintout(const fles::Timeslice &ts, const size_t uMsCompIdx, const size_t uMsIdx, const uint32_t uBlocksPerLine)