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_EMCAL_RAWBUFFER_H
12#define ALICEO2_EMCAL_RAWBUFFER_H
13
14#include <array>
15#include <cstdint>
16#include <iosfwd>
17#include <gsl/span>
18
19namespace o2
20{
21namespace emcal
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
62 uint32_t getNextDataWord();
63
68 uint32_t getWord(int index) const;
69
72 const gsl::span<const uint32_t> getDataWords() const { return gsl::span<const uint32_t>(mDataWords.data(), mNDataWords); }
73
78 bool hasNext() const { return mCurrentDataWord < mNDataWords; }
79
80 private:
81 std::array<uint32_t, 2048> mDataWords;
82 int mNDataWords = 0;
83 int mCurrentDataWord = 0;
84};
85
86} // namespace emcal
87
88} // namespace o2
89
90#endif
Buffer for EMCAL 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:72
bool hasNext() const
Check whether the next data word exists.
Definition RawBuffer.h:78
uint32_t getWord(int index) const
Get the data word at a given index.
Definition RawBuffer.cxx:63
uint32_t getNextDataWord()
Get the next data word in the superpage.
Definition RawBuffer.cxx:71
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
GLuint index
Definition glcorearb.h:781
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...