DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter Struct Reference

#include <DAPHNEEthStreamTypeAdapter.hpp>

Public Types

using FrameType = dunedaq::fddetdataformats::DAPHNEEthStreamFrame

Public Member Functions

bool operator< (const DAPHNEEthStreamTypeAdapter &other) const
uint64_t get_timestamp () const
void set_timestamp (uint64_t ts)
void fake_timestamps (uint64_t first_timestamp, uint64_t offset=280)
void fake_geoid (uint16_t crate_id, uint16_t slot_id, uint16_t stream_id)
void fake_adc_pattern (int channel)
void fake_frame_errors (std::vector< uint16_t > *)
FrameType * begin ()
FrameType * end ()
constexpr size_t get_payload_size () const
constexpr size_t get_num_frames () const
constexpr size_t get_frame_size () const

Public Attributes

char data [kDAPHNEEthStreamSize]

Static Public Attributes

static const constexpr daqdataformats::SourceID::Subsystem subsystem
static const constexpr daqdataformats::FragmentType fragment_type = daqdataformats::FragmentType::kDAPHNEEthStream
static const constexpr uint64_t expected_tick_difference = 280

Detailed Description

Definition at line 16 of file DAPHNEEthStreamTypeAdapter.hpp.

Member Typedef Documentation

◆ FrameType

Member Function Documentation

◆ begin()

FrameType * dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::begin ( )
inline

Definition at line 74 of file DAPHNEEthStreamTypeAdapter.hpp.

75 {
76 return reinterpret_cast<FrameType*>(&data[0]); // NOLINT
77 }
dunedaq::fddetdataformats::DAPHNEEthStreamFrame FrameType

◆ end()

FrameType * dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::end ( )
inline

Definition at line 79 of file DAPHNEEthStreamTypeAdapter.hpp.

80 {
81 return reinterpret_cast<FrameType*>(data + kDAPHNEEthStreamSize); // NOLINT
82 }
const constexpr std::size_t kDAPHNEEthStreamSize

◆ fake_adc_pattern()

void dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::fake_adc_pattern ( int channel)
inline

Definition at line 62 of file DAPHNEEthStreamTypeAdapter.hpp.

63 {
64 // Set the ADC for the first sample to the 14-bit max value
65 auto frame = reinterpret_cast<FrameType*>(&data); // NOLINT
66 frame->set_adc(0, channel, 0x3FFF);
67 }
void set_adc(int i_adc, int i_channel, uint16_t val)
Set the i_adc-th ADC value of i_channel-th channel in the frame to val.

◆ fake_frame_errors()

void dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::fake_frame_errors ( std::vector< uint16_t > * )
inline

Definition at line 69 of file DAPHNEEthStreamTypeAdapter.hpp.

70 {
71 // Set frame error bits in header
72 }

◆ fake_geoid()

void dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::fake_geoid ( uint16_t crate_id,
uint16_t slot_id,
uint16_t stream_id )
inline

Definition at line 52 of file DAPHNEEthStreamTypeAdapter.hpp.

53 {
54 for (unsigned int i = 0; i < get_num_frames(); ++i) {
55 auto df = reinterpret_cast<FrameType*>((reinterpret_cast<uint8_t*>(&data)) + i * get_frame_size());
57 df->daq_header.slot_id = slot_id;
58 df->daq_header.stream_id = stream_id;
59 }
60 }

◆ fake_timestamps()

void dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::fake_timestamps ( uint64_t first_timestamp,
uint64_t offset = 280 )
inline

Definition at line 42 of file DAPHNEEthStreamTypeAdapter.hpp.

43 {
44 uint64_t ts_next = first_timestamp; // NOLINT(build/unsigned)
45 for (unsigned int i = 0; i < get_num_frames(); ++i) {
46 auto df = reinterpret_cast<FrameType*>((reinterpret_cast<uint8_t*>(&data)) + i * get_frame_size());
47 df->set_timestamp(ts_next);
48 ts_next += offset;
49 }
50 }
double offset
void set_timestamp(const uint64_t new_timestamp)
Set the starting 64-bit timestamp of the frame.

◆ get_frame_size()

size_t dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::get_frame_size ( ) const
inlineconstexpr

Definition at line 88 of file DAPHNEEthStreamTypeAdapter.hpp.

88{ return sizeof(dunedaq::fddetdataformats::DAPHNEEthStreamFrame); }

◆ get_num_frames()

size_t dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::get_num_frames ( ) const
inlineconstexpr

Definition at line 86 of file DAPHNEEthStreamTypeAdapter.hpp.

const constexpr std::size_t kDAPHNEEthStreamNumFrames

◆ get_payload_size()

size_t dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::get_payload_size ( ) const
inlineconstexpr

Definition at line 84 of file DAPHNEEthStreamTypeAdapter.hpp.

84{ return kDAPHNEEthStreamSize; }

◆ get_timestamp()

uint64_t dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::get_timestamp ( ) const
inline

Definition at line 31 of file DAPHNEEthStreamTypeAdapter.hpp.

32 { // NOLINT(build/unsigned)
33 return reinterpret_cast<const FrameType*>(&data)->get_timestamp(); // NOLINT
34 }

◆ operator<()

bool dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::operator< ( const DAPHNEEthStreamTypeAdapter & other) const
inline

Definition at line 24 of file DAPHNEEthStreamTypeAdapter.hpp.

25 {
26 auto thisptr = reinterpret_cast<const FrameType*>(&data); // NOLINT
27 auto otherptr = reinterpret_cast<const FrameType*>(&other.data); // NOLINT
28 return thisptr->get_timestamp() < otherptr->get_timestamp() ? true : false;
29 }
uint64_t get_timestamp() const
Get the starting 64-bit timestamp of the frame.

◆ set_timestamp()

void dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::set_timestamp ( uint64_t ts)
inline

Definition at line 36 of file DAPHNEEthStreamTypeAdapter.hpp.

37 {
38 auto frame = reinterpret_cast<FrameType*>(&data); // NOLINT
39 frame->set_timestamp(ts);
40 }

Member Data Documentation

◆ data

char dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::data[kDAPHNEEthStreamSize]

Definition at line 21 of file DAPHNEEthStreamTypeAdapter.hpp.

◆ expected_tick_difference

const constexpr uint64_t dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::expected_tick_difference = 280
staticconstexpr

Definition at line 93 of file DAPHNEEthStreamTypeAdapter.hpp.

◆ fragment_type

const constexpr daqdataformats::FragmentType dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::fragment_type = daqdataformats::FragmentType::kDAPHNEEthStream
staticconstexpr

Definition at line 92 of file DAPHNEEthStreamTypeAdapter.hpp.

◆ subsystem

const constexpr daqdataformats::SourceID::Subsystem dunedaq::fdreadoutlibs::types::DAPHNEEthStreamTypeAdapter::subsystem
staticconstexpr

The documentation for this struct was generated from the following file: