DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
hsilibs
include
hsilibs
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
14
#include "
detdataformats/HSIFrame.hpp
"
15
#include "
daqdataformats/FragmentHeader.hpp
"
16
#include "
daqdataformats/SourceID.hpp
"
17
#include "
serialization/Serialization.hpp
"
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
26
namespace
dunedaq
{
27
namespace
hsilibs
{
28
33
const
constexpr
std::size_t
HSI_FRAME_STRUCT_SIZE
= 28;
34
35
class
HSI_FRAME_STRUCT
36
{
37
public
:
38
using
FrameType
=
HSI_FRAME_STRUCT
;
39
40
dunedaq::detdataformats::HSIFrame
frame
;
41
42
// comparable based on start timestamp
43
bool
operator<
(
const
FrameType
& other)
const
44
{
45
return
this->
get_timestamp
() < other.
get_timestamp
() ? true :
false
;
46
}
47
48
uint64_t
get_timestamp
() const
// NOLINT(build/unsigned)
49
{
50
return
frame
.get_timestamp();
// NOLINT
51
}
52
53
void
set_timestamp
(uint64_t ts)
// NOLINT(build/unsigned)
54
{
55
frame
.set_timestamp(ts);
56
}
57
58
void
fake_timestamps
(uint64_t first_timestamp, uint64_t
/*offset*/
= 0 )
// NOLINT(build/unsigned)
59
{
60
frame
.set_timestamp(first_timestamp);
61
}
62
63
FrameType
*
begin
() {
return
this
; }
64
65
FrameType
*
end
() {
return
(
this
+ 1); }
// NOLINT
66
67
size_t
get_payload_size
() {
return
HSI_FRAME_STRUCT_SIZE
; }
68
69
size_t
get_num_frames
() {
return
1; }
70
71
size_t
get_frame_size
() {
return
HSI_FRAME_STRUCT_SIZE
; }
72
73
static
const
constexpr
daqdataformats::SourceID::Subsystem
subsystem
=
74
daqdataformats::SourceID::Subsystem::kHwSignalsInterface
;
75
static
const
constexpr
daqdataformats::FragmentType
fragment_type
=
daqdataformats::FragmentType::kHardwareSignal
;
76
static
const
constexpr
uint64_t
expected_tick_difference
= 1;
// NOLINT(build/unsigned)
77
};
78
79
static_assert
(
sizeof
(
struct
HSI_FRAME_STRUCT
) ==
HSI_FRAME_STRUCT_SIZE
,
80
"Check your assumptions on HSI_FRAME_STRUCT"
);
81
82
}
// namespace hsilibs
83
84
DUNE_DAQ_TYPESTRING
(
hsilibs::HSI_FRAME_STRUCT
,
"HSIFrame"
)
85
86
}
// namespace dunedaq
87
88
#endif
// HSILIBS_INCLUDE_HSILIBS_TYPES_HPP_
89
90
// Local Variables:
91
// c-basic-offset: 2
92
// End:
FragmentHeader.hpp
HSIFrame.hpp
Serialization.hpp
DUNE_DAQ_TYPESTRING
#define DUNE_DAQ_TYPESTRING(Type, typestring)
Declare the datatype_to_string method for the given type.
Definition
Serialization.hpp:36
SourceID.hpp
dunedaq::detdataformats::HSIFrame
Definition
HSIFrame.hpp:20
dunedaq::hsilibs::HSI_FRAME_STRUCT
Definition
Types.hpp:36
dunedaq::hsilibs::HSI_FRAME_STRUCT::get_num_frames
size_t get_num_frames()
Definition
Types.hpp:69
dunedaq::hsilibs::HSI_FRAME_STRUCT::expected_tick_difference
static const constexpr uint64_t expected_tick_difference
Definition
Types.hpp:76
dunedaq::hsilibs::HSI_FRAME_STRUCT::get_payload_size
size_t get_payload_size()
Definition
Types.hpp:67
dunedaq::hsilibs::HSI_FRAME_STRUCT::operator<
bool operator<(const FrameType &other) const
Definition
Types.hpp:43
dunedaq::hsilibs::HSI_FRAME_STRUCT::get_frame_size
size_t get_frame_size()
Definition
Types.hpp:71
dunedaq::hsilibs::HSI_FRAME_STRUCT::get_timestamp
uint64_t get_timestamp() const
Definition
Types.hpp:48
dunedaq::hsilibs::HSI_FRAME_STRUCT::frame
dunedaq::detdataformats::HSIFrame frame
Definition
Types.hpp:40
dunedaq::hsilibs::HSI_FRAME_STRUCT::set_timestamp
void set_timestamp(uint64_t ts)
Definition
Types.hpp:53
dunedaq::hsilibs::HSI_FRAME_STRUCT::end
FrameType * end()
Definition
Types.hpp:65
dunedaq::hsilibs::HSI_FRAME_STRUCT::begin
FrameType * begin()
Definition
Types.hpp:63
dunedaq::hsilibs::HSI_FRAME_STRUCT::fake_timestamps
void fake_timestamps(uint64_t first_timestamp, uint64_t=0)
Definition
Types.hpp:58
dunedaq::hsilibs::HSI_FRAME_STRUCT::FrameType
HSI_FRAME_STRUCT FrameType
Definition
Types.hpp:38
dunedaq::hsilibs::HSI_FRAME_STRUCT::fragment_type
static const constexpr daqdataformats::FragmentType fragment_type
Definition
Types.hpp:75
dunedaq::hsilibs::HSI_FRAME_STRUCT::subsystem
static const constexpr daqdataformats::SourceID::Subsystem subsystem
Definition
Types.hpp:73
dunedaq::daqdataformats::FragmentType
FragmentType
All defined Fragment types.
Definition
FragmentHeader.hpp:114
dunedaq::daqdataformats::FragmentType::kHardwareSignal
@ kHardwareSignal
Definition
FragmentHeader.hpp:134
dunedaq::hsilibs
Definition
HSIEventSender.hpp:27
dunedaq::hsilibs::HSI_FRAME_STRUCT_SIZE
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
dunedaq
Including Qt Headers.
Definition
module.cpp:16
dunedaq::daqdataformats::SourceID::Subsystem
Subsystem
The Subsystem enum describes the kind of source we're dealing with.
Definition
SourceID.hpp:40
dunedaq::daqdataformats::SourceID::Subsystem::kHwSignalsInterface
@ kHwSignalsInterface
Definition
SourceID.hpp:43
Generated on
for DUNE-DAQ by
1.17.0