Project
Loading...
Searching...
No Matches
RawPageTestData.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
16
17#ifndef FRAMEWORK_UTILS_RAWPAGETESTDATA_H
18#define FRAMEWORK_UTILS_RAWPAGETESTDATA_H
19
21#include "Framework/InputSpan.h"
23#include "Headers/DataHeader.h"
24#include <vector>
25#include <memory>
26
30
31namespace o2::framework::test
32{
34static const size_t PAGESIZE = 8192;
35
39struct DataSet {
40 // not nice with the double vector but for quick unit test ok
41 using Messages = std::vector<std::vector<std::unique_ptr<std::vector<char>>>>;
42 DataSet(std::vector<InputRoute>&& s, Messages&& m, std::vector<int>&& v, ServiceRegistryRef registry)
43 : schema{std::move(s)},
44 messages{std::move(m)},
45 span{[this](size_t i) { return i < this->messages.size() ? messages[i].size() / 2 : 0; },
46 nullptr,
47 [this](size_t i, DataRefIndices idx) {
48 auto header = static_cast<char const*>(this->messages[i].at(idx.headerIdx)->data());
49 auto payload = static_cast<char const*>(this->messages[i].at(idx.payloadIdx)->data());
50 return DataRef{nullptr, header, payload};
51 },
52 [this](size_t i, DataRefIndices current) -> DataRefIndices {
53 size_t next = current.headerIdx + 2;
54 return next < this->messages[i].size() ? DataRefIndices{next, next + 1} : DataRefIndices{size_t(-1), size_t(-1)};
55 },
56 this->messages.size()},
57 record{schema, span, registry},
58 values{std::move(v)}
59 {
60 }
61
62 std::vector<InputRoute> schema;
66 std::vector<int> values;
67};
68
69using AmendRawDataHeader = std::function<void(RAWDataHeader&)>;
70DataSet createData(std::vector<InputSpec> const& inputspecs, std::vector<DataHeader> const& dataheaders, AmendRawDataHeader amendRdh = nullptr);
71
72} // namespace o2::framework::test
73#endif // FRAMEWORK_UTILS_RAWPAGETESTDATA_H
std::shared_ptr< arrow::Schema > schema
int32_t i
Definition of the RAW Data Header.
o2::header::RAWDataHeaderV6 RAWDataHeaderV6
auto const PAGESIZE
The input API of the Data Processing Layer This class holds the inputs which are valid for processing...
size_t size() const
Number of elements in the InputSpan.
Definition InputSpan.h:93
const GLfloat * m
Definition glcorearb.h:4066
const GLdouble * v
Definition glcorearb.h:832
GLenum GLsizei GLsizei GLint * values
Definition glcorearb.h:1576
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
std::function< void(RAWDataHeader &)> AmendRawDataHeader
Simple helper struct to keep the InputRecord and ownership of messages together with some test data.
std::vector< std::vector< std::unique_ptr< std::vector< char > > > > Messages
std::vector< InputRoute > schema
DataSet(std::vector< InputRoute > &&s, Messages &&m, std::vector< int > &&v, ServiceRegistryRef registry)
the main header struct
Definition DataHeader.h:620
a move-only header stack with serialized headers This is the flat buffer where all the headers in a m...
Definition Stack.h:33
DataSet createData()