DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
ReadoutTypes.hpp
Go to the documentation of this file.
1
8#ifndef DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_READOUTTYPES_HPP_
9#define DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_READOUTTYPES_HPP_
10
12
13#include <cstdint> // uint_t types
14#include <memory> // unique_ptr
15#include <tuple> // std::tie
16
17#include <iostream>
18
19namespace dunedaq {
20namespace datahandlinglibs {
21namespace types {
22
23const constexpr std::size_t DUMMY_FRAME_SIZE = 1024;
25{
27
28 // header
29 uint64_t timestamp; // NOLINT(build/unsigned)
30 uint64_t another_key; // NOLINT(build/unsigned)
31
32 // data
34
35 // comparable based on composite key (timestamp + other unique keys)
36 bool operator<(const DUMMY_FRAME_STRUCT& other) const
37 {
38 auto const & f1 = std::tie(this->timestamp, this->another_key);
39 auto const & f2 = std::tie(other.timestamp, other.another_key);
40 return f1 < f2;
41 }
42
43 uint64_t get_timestamp() const // NOLINT(build/unsigned)
44 {
45 return timestamp;
46 }
47
48 size_t get_num_frames() const { return frames_per_element; }
49
50 size_t get_frame_size() const { return frame_size; }
51
52 size_t get_payload_size() const { return get_num_frames() * get_frame_size(); }
53
54 void set_another_key(uint64_t compkey)
55 {
56 another_key = compkey;
57 }
58
59 void set_timestamp(uint64_t ts) // NOLINT(build/unsigned)
60 {
61 timestamp = ts;
62 }
63
64 void fake_timestamp(uint64_t /*first_timestamp*/, uint64_t /*offset = 25*/) // NOLINT(build/unsigned)
65 {
66 // tp.time_start = first_timestamp;
67 }
68
69 FrameType* begin() { return this; }
70
71 FrameType* end() { return (this + 1); } // NOLINT
72
73 static const constexpr size_t frame_size = DUMMY_FRAME_SIZE;
74 static const constexpr uint8_t frames_per_element = 1; // NOLINT(build/unsigned)
75 static const constexpr size_t element_size = DUMMY_FRAME_SIZE;
80 static const constexpr uint64_t expected_tick_difference = 1; // NOLINT(build/unsigned)
81};
82
83} // namespace types
84} // namespace datahandlinglibs
85} // namespace dunedaq
86
87#endif // DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_READOUTTYPES_HPP_
FragmentType
This enumeration should list all defined Fragment types.
const constexpr std::size_t DUMMY_FRAME_SIZE
The DUNE-DAQ namespace.
Subsystem
The Subsystem enum describes the kind of source we're dealing with.
Definition SourceID.hpp:43
bool operator<(const DUMMY_FRAME_STRUCT &other) const
static const constexpr uint64_t expected_tick_difference
static const constexpr dunedaq::daqdataformats::SourceID::Subsystem subsystem
static const constexpr dunedaq::daqdataformats::FragmentType fragment_type