Project
Loading...
Searching...
No Matches
PixelLaneData.cxx
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.
12#include <algorithm>
13#include <cstdint>
14#include <iostream>
15#include <iomanip>
16
17using namespace o2::focal;
18
20{
21 for (auto& lane : mLaneData) {
22 lane.reset();
23 }
24}
25
26void PixelLaneHandler::resetLane(std::size_t laneID)
27{
28 handleLaneIndex(laneID);
29 mLaneData[laneID].reset();
30}
31
33{
34 handleLaneIndex(index);
35 return mLaneData[index];
36}
37
39{
40 handleLaneIndex(index);
41 return mLaneData[index];
42}
43
44void PixelLaneHandler::handleLaneIndex(std::size_t laneIndex) const
45{
46 if (laneIndex >= PixelLaneHandler::NLANES) {
48 }
49}
50
52{
53 mPayload.clear();
54}
55
56void PixelLanePayload::append(gsl::span<const uint8_t> payloadwords)
57{
58 std::copy(payloadwords.begin(), payloadwords.end(), std::back_inserter(mPayload));
59}
60
61void PixelLanePayload::append(uint8_t word)
62{
63 mPayload.emplace_back(word);
64}
65
66gsl::span<const uint8_t> PixelLanePayload::getPayload() const
67{
68 return mPayload;
69}
70
71void PixelLanePayload::print(std::ostream& stream) const
72{
73 stream << "Next lane with " << mPayload.size() << " words:";
74 for (const auto& word : mPayload) {
75 stream << " 0x" << std::hex << static_cast<int>(word) << std::dec;
76 }
77}
78
80{
81 stream << mMessage;
82}
83
84std::ostream& o2::focal::operator<<(std::ostream& stream, const PixelLaneHandler::LaneIndexException& except)
85{
86 except.print(stream);
87 return stream;
88}
89
90std::ostream& o2::focal::operator<<(std::ostream& stream, const PixelLanePayload& payload)
91{
92 payload.print(stream);
93 return stream;
94}
PixelLanePayload & getLane(std::size_t index)
static constexpr std::size_t NLANES
void resetLane(std::size_t laneID)
gsl::span< const uint8_t > getPayload() const
void print(std::ostream &stream) const
void append(gsl::span< const uint8_t > payloadwords)
GLuint index
Definition glcorearb.h:781
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &in, const IndexExceptionEvent &error)