12#include <catch_amalgamated.hpp>
24template <
typename RDH,
typename Container>
30 for (
int pageNo = 0; pageNo < NofPages; pageNo++) {
33 rdh->headerSize =
sizeof(
RDH);
36 rdh->pageCnt = pageNo;
37 rdh->packetCounter = pageNo;
38 rdh->stop = pageNo + 1 == NofPages;
39 auto*
data =
reinterpret_cast<size_t*
>(
buffer.data() + pageNo *
PageSize + rdh->headerSize);
46 constexpr size_t NofPages = 3;
47 std::array<unsigned char, NofPages * PageSize>
buffer;
48 fillPages<TestType>(
buffer);
53 REQUIRE(*
reinterpret_cast<size_t const*
>(
data) ==
count);
54 INFO(
"Processing block of size " <<
size);
58 parser.
parse(processor);
59 REQUIRE(
count == NofPages);
66 REQUIRE(it.size() ==
PageSize -
sizeof(TestType));
67 REQUIRE(*
reinterpret_cast<size_t const*
>(it.data()) ==
count);
74 REQUIRE(it.get_if((TestType*)
nullptr) !=
nullptr);
75 if constexpr (std::is_same<TestType, V4>::value ==
false) {
76 REQUIRE(it.get_if((
V4*)
nullptr) ==
nullptr);
78 REQUIRE(it.get_if((
V5*)
nullptr) ==
nullptr);
80 REQUIRE(it.raw() + it.offset() == it.data());
81 INFO(it <<
": block size " << it.size());
o2::header::RAWDataHeader RDH
Generic parser for consecutive raw pages.
const_iterator begin() const
bool reset()
Reset parser and set position to beginning of buffer.
const_iterator end() const
void parse(Processor &&processor)
Parse complete raw buffer and call processor on payload data for each page.
Defining PrimaryVertex explicitly as messageable.
constexpr size_t PageSize
void fillPages(Container &buffer)
TEMPLATE_TEST_CASE("test_RawParser", "[RDH][template]", V5, V6, V7)