Project
Loading...
Searching...
No Matches
RawReaderMemory.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_CPV_RAWREADERMEMORY_H
12#define ALICEO2_CPV_RAWREADERMEMORY_H
13
14#include <gsl/span>
15#include <Rtypes.h>
16
18#include "Headers/RDHAny.h"
19
20namespace o2
21{
22
23namespace cpv
24{
25
48
57{
58 public:
60 RawReaderMemory(const gsl::span<const char> rawmemory);
61
63 ~RawReaderMemory() = default;
64
67 void setRawMemory(const gsl::span<const char> rawmemory);
68
73
83
86 const o2::header::RDHAny& getRawHeader() const { return mRawHeader; }
87
90 const std::vector<char>& getPayload() const { return mRawPayload; }
91
94 int getPayloadSize() const { return mRawPayload.size(); }
95
98 int getFileSize() const noexcept { return mRawMemoryBuffer.size(); }
99
102 bool hasNext() const { return mCurrentPosition < mRawMemoryBuffer.size(); }
103
105 uint32_t getCurrentHBFOrbit() const { return mCurrentHBFOrbit; }
106
109 uint8_t getDataFormat() const { return mDataFormat; }
110
111 protected:
115 void init();
116
117 o2::header::RDHAny decodeRawHeader(const void* headerwords);
118
119 private:
120 gsl::span<const char> mRawMemoryBuffer;
121 o2::header::RDHAny mRawHeader;
122 std::vector<char> mRawPayload;
123 unsigned int mCurrentPosition = 0;
124 bool mRawHeaderInitialized = false;
125 bool mPayloadInitialized = false;
126 uint32_t mCurrentHBFOrbit = 0;
127 bool mStopBitWasNotFound;
128 bool mIsJustInited = false;
129 uint8_t mDataFormat = 0x0;
130
131 ClassDefNV(RawReaderMemory, 2);
132};
133
134} // namespace cpv
135
136} // namespace o2
137
138#endif
Definition of the RAW Data Header.
Reader for raw data produced by the Readout application in in-memory format.
int getPayloadSize() const
Return size of the payload.
RawErrorType_t next()
Read next payload from the stream.
RawErrorType_t nextPage()
Read the next page from the stream (single DMA page)
int getFileSize() const noexcept
get the size of the file in bytes
void setRawMemory(const gsl::span< const char > rawmemory)
set new raw memory chunk
uint8_t getDataFormat() const
get data format from RDH
const std::vector< char > & getPayload() const
access to the full raw payload (single or multiple DMA pages)
void init()
Initialize the raw stream.
bool hasNext() const
check if more pages are available in the raw file
uint32_t getCurrentHBFOrbit() const
o2::header::RDHAny decodeRawHeader(const void *headerwords)
const o2::header::RDHAny & getRawHeader() const
access to the raw header of the current page
~RawReaderMemory()=default
Destructor.
@ kCPVTRAILER_INVALID
@ kOK
NoError.
@ kSEGMENT_HEADER_ERROR
@ kOFFSET_TO_NEXT_IS_0
@ kPAYLOAD_INCOMPLETE
@ kOK_NO_PAYLOAD
No payload per ddl (not error)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...