DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Types.hpp
Go to the documentation of this file.
1/*
2 * @file Types.hpp
3 *
4 * Contains declaration of HSI_FRAME_STRUCT.
5 *
6 * This is part of the DUNE DAQ Application Framework, copyright 2020.
7 * Licensing/copyright details are in the COPYING file that you should have
8 * received with this code.
9 */
10
11#ifndef HSILIBS_INCLUDE_HSILIBS_TYPES_HPP_
12#define HSILIBS_INCLUDE_HSILIBS_TYPES_HPP_
13
18
19#include <algorithm> // For std::min
20#include <cassert> // For assert()
21#include <cstdio>
22#include <cstdlib>
23#include <stdexcept> // For std::out_of_range
24#include <stdint.h> // For uint32_t etc
25
26namespace dunedaq {
27namespace hsilibs {
28
33const constexpr std::size_t HSI_FRAME_STRUCT_SIZE = 28;
34
36{
37public:
39
41
42 // comparable based on start timestamp
43 bool operator<(const FrameType& other) const { return this->get_timestamp() < other.get_timestamp() ? true : false; }
44
45 uint64_t get_timestamp() const // NOLINT(build/unsigned)
46 {
47 return frame.get_timestamp(); // NOLINT
48 }
49
50 void set_timestamp(uint64_t ts) // NOLINT(build/unsigned)
51 {
53 }
54
55 void fake_timestamps(uint64_t first_timestamp, uint64_t /*offset*/ = 0) // NOLINT(build/unsigned)
56 {
57 frame.set_timestamp(first_timestamp);
58 }
59
60 FrameType* begin() { return this; }
61
62 FrameType* end() { return (this + 1); } // NOLINT
63
65
66 size_t get_num_frames() { return 1; }
67
69
73 static const constexpr uint64_t expected_tick_difference = 1; // NOLINT(build/unsigned)
74};
75
76static_assert(sizeof(struct HSI_FRAME_STRUCT) == HSI_FRAME_STRUCT_SIZE, "Check your assumptions on HSI_FRAME_STRUCT");
77
78} // namespace hsilibs
79
81
82} // namespace dunedaq
83
84#endif // HSILIBS_INCLUDE_HSILIBS_TYPES_HPP_
85
86// Local Variables:
87// c-basic-offset: 2
88// End:
#define DUNE_DAQ_TYPESTRING(Type, typestring)
Declare the datatype_to_string method for the given type.
void set_timestamp(uint64_t ts)
Definition HSIFrame.hpp:39
static const constexpr uint64_t expected_tick_difference
Definition Types.hpp:73
bool operator<(const FrameType &other) const
Definition Types.hpp:43
uint64_t get_timestamp() const
Definition Types.hpp:45
dunedaq::detdataformats::HSIFrame frame
Definition Types.hpp:40
void set_timestamp(uint64_t ts)
Definition Types.hpp:50
void fake_timestamps(uint64_t first_timestamp, uint64_t=0)
Definition Types.hpp:55
static const constexpr daqdataformats::FragmentType fragment_type
Definition Types.hpp:72
static const constexpr daqdataformats::SourceID::Subsystem subsystem
Definition Types.hpp:70
FragmentType
All defined Fragment types.
const constexpr std::size_t HSI_FRAME_STRUCT_SIZE
For HSI the numbers are different. 1[HSI frames] x 24[Bytes] = 24[Bytes].
Definition Types.hpp:33
The DUNE-DAQ namespace.
Subsystem
The Subsystem enum describes the kind of source we're dealing with.
Definition SourceID.hpp:40