Project
Loading...
Searching...
No Matches
RawBuffer.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#ifndef ALICEO2_PHOS_RAWBUFFER_H
12#define ALICEO2_PHOS_RAWBUFFER_H
13
14#include <array>
15#include <cstdint>
16#include <iosfwd>
17#include <gsl/span>
18
19namespace o2
20{
21namespace phos
22{
23
30{
31 public:
32 RawBuffer() = default;
33 ~RawBuffer() = default;
34
35 void reset() { mCurrentDataWord = 0; }
36
39 void flush();
40
47 void readFromStream(std::istream& in, uint32_t payloadsize);
48
53 void readFromMemoryBuffer(const gsl::span<const char> rawmemory);
54
57 int getNDataWords() const { return mNDataWords; }
58
61 const gsl::span<const uint32_t> getDataWords() const { return gsl::span<const uint32_t>(mDataWords.data(), mNDataWords); }
62
67 bool hasNext() const { return mCurrentDataWord < mNDataWords; }
68
69 private:
70 std::array<uint32_t, 2048> mDataWords;
71 int mNDataWords = 0;
72 int mCurrentDataWord = 0;
73};
74
75} // namespace phos
76
77} // namespace o2
78
79#endif
Buffer for PHOS raw pages.
Definition RawBuffer.h:30
void readFromMemoryBuffer(const gsl::span< const char > rawmemory)
Read page from raw memory buffer.
Definition RawBuffer.cxx:46
const gsl::span< const uint32_t > getDataWords() const
Get all data words from the raw buffer.
Definition RawBuffer.h:61
bool hasNext() const
Check whether the next data word exists.
Definition RawBuffer.h:67
void readFromStream(std::istream &in, uint32_t payloadsize)
Read page from stream.
Definition RawBuffer.cxx:26
void flush()
Flush the buffer Does not overwrite the word buffer but just resets the counter and iterator.
Definition RawBuffer.cxx:19
int getNDataWords() const
Get the number of data words read for the superpage.
Definition RawBuffer.h:57
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...