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, size_t part) {
46 auto header = static_cast<char const*>(this->messages[i].at(2 * part)->data());
47 auto payload = static_cast<char const*>(this->messages[i].at(2 * part + 1)->data());
48 return DataRef{nullptr, header, payload};
49 },
50 [this](size_t i) { return i < this->messages.size() ? messages[i].size() / 2 : 0; }, this->messages.size()},
51 record{schema, span, registry},
52 values{std::move(v)}
53 {
54 }
55
56 std::vector<InputRoute> schema;
60 std::vector<int> values;
61};
62
63using AmendRawDataHeader = std::function<void(RAWDataHeader&)>;
64DataSet createData(std::vector<InputSpec> const& inputspecs, std::vector<DataHeader> const& dataheaders, AmendRawDataHeader amendRdh = nullptr);
65
66} // namespace o2::framework
67#endif // FRAMEWORK_UTILS_RAWPAGETESTDATA_H
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...
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
Defining DataPointCompositeObject explicitly as copiable.
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:618
a move-only header stack with serialized headers This is the flat buffer where all the headers in a m...
Definition Stack.h:36
DataSet createData()