CbmRoot
Loading...
Searching...
No Matches
CommonUnpacker.cxx
Go to the documentation of this file.
1/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Felix Weiglhofer [committer], Dominik Smith */
4#include "CommonUnpacker.h"
5
6using namespace cbm::algo;
7
8detail::MSData::MSData(const fles::Timeslice& ts, fles::Subsystem subsystem, gsl::span<u16> legalEqIds)
9{
10 monitor.system = subsystem;
11
12 for (uint64_t comp = 0; comp < ts.num_components(); comp++) {
13 auto this_subsystem = static_cast<fles::Subsystem>(ts.descriptor(comp, 0).sys_id);
14
15 if (this_subsystem != subsystem) {
16 continue;
17 }
18
19 const u64 numMsInComp = ts.num_microslices(comp);
20 const u16 componentId = ts.descriptor(comp, 0).eq_id;
21
22 if (std::find(legalEqIds.begin(), legalEqIds.end(), componentId) == legalEqIds.end()) {
23 L_(error) << "Invalid equipment id " << componentId << " for subsystem " << ToString(subsystem);
25 continue;
26 }
27
29 monitor.sizeBytesIn += ts.size_component(comp);
30 monitor.numMs += numMsInComp;
31 for (u64 mslice = 0; mslice < numMsInComp; mslice++) {
32 msDesc.push_back(ts.descriptor(comp, mslice));
33 msContent.push_back(ts.content(comp, mslice));
34 }
35 }
36 L_(debug) << "Found " << monitor.numMs << " microslices for subsystem " << ToString(subsystem);
37}
#define L_(level)
std::string_view ToString(T t)
Definition EnumDict.h:64
std::uint64_t u64
Definition Definitions.h:23
std::uint16_t u16
Definition Definitions.h:19
MSData(const fles::Timeslice &ts, fles::Subsystem system, gsl::span< u16 > legalEqIds)
UnpackMonitorBase monitor
std::vector< const u8 * > msContent
std::vector< fles::MicrosliceDescriptor > msDesc