Project
Loading...
Searching...
No Matches
PageDecoder.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef O2_MCH_RAW_DECODER_PAGE_DECODER_H
13#define O2_MCH_RAW_DECODER_PAGE_DECODER_H
14
15#include <functional>
16#include <gsl/span>
17#include <map>
20
21namespace o2::mch::raw
22{
23
24// A (CRU) Page is a raw memory buffer containing a pair (RDH,payload)
25using Page = gsl::span<const std::byte>;
26
27// A PageDecoder decodes a single (CRU) Page
28using PageDecoder = std::function<void(Page buffer)>;
29
30using RawBuffer = gsl::span<const std::byte>;
31
32// Create a PageDecoder depending on the first rdh found in the buffer.
33//
34// @param rdhBuffer a raw memory buffer containing (at least) one RDH
35// which information is used to decide which PageDecoder implementation to choose
36// @param decodedDataHandlers a structure with various callable objects (optional) that
38//
40 DecodedDataHandlers decodedDataHandlers);
41
42// Same as above but only to be used for special cases, e.g. when
43// trying to decode test beam data with an electronic mapping that
44// does not match the expected one for Run3.
45//
46// @param fee2solar (optional) a callable object that will convert a FeeLinkId
47// object into a solarId.
48//
50 DecodedDataHandlers decodedDataHandlers,
51 FeeLink2SolarMapper fee2solar);
52
53// Alternative versions of the same functions, taking a SampaChannelHandler as parameter.
54[[deprecated("Use createPageDecoder(RawBuffer,DecodedDataHandlers) instead.")]] PageDecoder createPageDecoder(RawBuffer rdhBuffer,
55 SampaChannelHandler channelHandler);
56
57[[deprecated("Use createPageDecoder(RawBuffer,DecodedDataHandlers,fee2solar) instead.")]] PageDecoder createPageDecoder(RawBuffer rdhBuffer,
58 SampaChannelHandler channelHandler,
59 FeeLink2SolarMapper fee2solar);
60
61// A PageParser loops over the given buffer and apply the given page decoder
62// to each page.
63using PageParser = std::function<void(RawBuffer buffer, PageDecoder pageDecoder)>;
64
65// Create a PageParser
67
68} // namespace o2::mch::raw
69
70#endif
GLuint buffer
Definition glcorearb.h:655
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
gsl::span< const std::byte > RawBuffer
Definition PageDecoder.h:30
PageParser createPageParser()
std::function< void(Page buffer)> PageDecoder
Definition PageDecoder.h:28
gsl::span< const std::byte > Page
Definition PageDecoder.h:25
std::function< void(DsElecId dsId, DualSampaChannelId channel, SampaCluster)> SampaChannelHandler
std::function< std::optional< uint16_t >(FeeLinkId id)> FeeLink2SolarMapper
From (feeId,linkId) to solarId.
Definition Mapper.h:52
PageDecoder createPageDecoder(RawBuffer rdhBuffer, DecodedDataHandlers decodedDataHandlers)
will be called for each decoded Sampa packet and in case of decoding errors
std::function< void(RawBuffer buffer, PageDecoder pageDecoder)> PageParser
Definition PageDecoder.h:63