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 "
daqdataformats/FragmentHeader.hpp
"
15
#include "
daqdataformats/SourceID.hpp
"
16
#include "
detdataformats/HSIFrame.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
{
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
{
52
frame
.
set_timestamp
(ts);
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
64
size_t
get_payload_size
() {
return
HSI_FRAME_STRUCT_SIZE
; }
65
66
size_t
get_num_frames
() {
return
1; }
67
68
size_t
get_frame_size
() {
return
HSI_FRAME_STRUCT_SIZE
; }
69
70
static
const
constexpr
daqdataformats::SourceID::Subsystem
subsystem
=
71
daqdataformats::SourceID::Subsystem::kHwSignalsInterface
;
72
static
const
constexpr
daqdataformats::FragmentType
fragment_type
=
daqdataformats::FragmentType::kHardwareSignal
;
73
static
const
constexpr
uint64_t
expected_tick_difference
= 1;
// NOLINT(build/unsigned)
74
};
75
76
static_assert
(
sizeof
(
struct
HSI_FRAME_STRUCT
) ==
HSI_FRAME_STRUCT_SIZE
,
"Check your assumptions on HSI_FRAME_STRUCT"
);
77
78
}
// namespace hsilibs
79
80
DUNE_DAQ_TYPESTRING
(
hsilibs::HSI_FRAME_STRUCT
,
"HSIFrame"
)
81
82
}
// namespace dunedaq
83
84
#endif
// HSILIBS_INCLUDE_HSILIBS_TYPES_HPP_
85
86
// Local Variables:
87
// c-basic-offset: 2
88
// 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::detdataformats::HSIFrame::get_timestamp
uint64_t get_timestamp() const
Definition
HSIFrame.hpp:33
dunedaq::detdataformats::HSIFrame::set_timestamp
void set_timestamp(uint64_t ts)
Definition
HSIFrame.hpp:39
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:66
dunedaq::hsilibs::HSI_FRAME_STRUCT::expected_tick_difference
static const constexpr uint64_t expected_tick_difference
Definition
Types.hpp:73
dunedaq::hsilibs::HSI_FRAME_STRUCT::get_payload_size
size_t get_payload_size()
Definition
Types.hpp:64
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:68
dunedaq::hsilibs::HSI_FRAME_STRUCT::get_timestamp
uint64_t get_timestamp() const
Definition
Types.hpp:45
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:50
dunedaq::hsilibs::HSI_FRAME_STRUCT::end
FrameType * end()
Definition
Types.hpp:62
dunedaq::hsilibs::HSI_FRAME_STRUCT::begin
FrameType * begin()
Definition
Types.hpp:60
dunedaq::hsilibs::HSI_FRAME_STRUCT::fake_timestamps
void fake_timestamps(uint64_t first_timestamp, uint64_t=0)
Definition
Types.hpp:55
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:72
dunedaq::hsilibs::HSI_FRAME_STRUCT::subsystem
static const constexpr daqdataformats::SourceID::Subsystem subsystem
Definition
Types.hpp:70
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
The DUNE-DAQ namespace.
Definition
cib_utilities.cpp:5
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.18.0