DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::daqdataformats::TimeSlice Class Reference

C++ Representation of a DUNE TimeSlice, consisting of a TimeSliceHeader object and a vector of pointers to Fragment objects. More...

#include <TimeSlice.hpp>

Collaboration diagram for dunedaq::daqdataformats::TimeSlice:
[legend]

Public Member Functions

 TimeSlice (timeslice_number_t timeslice_number, run_number_t run_number)
 Construct a TimeSlice, filling in header fields.
 
 TimeSlice (TimeSliceHeader const &header)
 Construct a TimeSlice using the given TimeSliceHeader.
 
virtual ~TimeSlice ()=default
 TimeSlice default destructor.
 
 TimeSlice (TimeSlice const &)=delete
 TimeSlices are not copy-constructible.
 
 TimeSlice (TimeSlice &&)=default
 Default TimeSlice move constructor.
 
TimeSliceoperator= (TimeSlice const &)=delete
 TimeSlices are not copy-assignable.
 
TimeSliceoperator= (TimeSlice &&)=default
 Default TimeSlice move assignment operator.
 
TimeSliceHeader get_header () const
 Get a copy of the TimeSliceHeader struct.
 
void set_header (TimeSliceHeader header)
 Set the TimeSliceHeader to the given TimeSliceHeader object.
 
const std::vector< std::unique_ptr< Fragment > > & get_fragments_ref () const
 Get a handle to the Fragments.
 
void set_fragments (std::vector< std::unique_ptr< Fragment > > &&fragments)
 Set the Fragments vector to the given vector of Fragments.
 
void add_fragment (std::unique_ptr< Fragment > &&fragment)
 Add a Fragment pointer to the Fragments vector.
 
void set_element_id (SourceID source_id)
 Set the SourceID for this TimeSlice.
 
size_t get_total_size_bytes () const
 Get size of timeslice from underlying TimeSliceHeader and Fragments.
 
size_t get_sum_of_fragment_payload_sizes () const
 Get the sum of the fragment payload sizes.
 

Private Attributes

TimeSliceHeader m_header
 TimeSliceHeader object.
 
std::vector< std::unique_ptr< Fragment > > m_fragments
 Vector of unique_ptrs to Fragment objects.
 

Detailed Description

C++ Representation of a DUNE TimeSlice, consisting of a TimeSliceHeader object and a vector of pointers to Fragment objects.

Definition at line 26 of file TimeSlice.hpp.

Constructor & Destructor Documentation

◆ TimeSlice() [1/4]

dunedaq::daqdataformats::TimeSlice::TimeSlice ( timeslice_number_t timeslice_number,
run_number_t run_number )
inlineexplicit

Construct a TimeSlice, filling in header fields.

Definition at line 115 of file TimeSlice.hpp.

116 : m_header()
117 , m_fragments()
118{
119 m_header.timeslice_number = timeslice_number;
120 m_header.run_number = run_number;
121}
std::vector< std::unique_ptr< Fragment > > m_fragments
Vector of unique_ptrs to Fragment objects.
TimeSliceHeader m_header
TimeSliceHeader object.
run_number_t run_number
Run Number for the TimeSlice.
timeslice_number_t timeslice_number
Slice number of this TimeSlice within the stream.

◆ TimeSlice() [2/4]

dunedaq::daqdataformats::TimeSlice::TimeSlice ( TimeSliceHeader const & header)
inlineexplicit

Construct a TimeSlice using the given TimeSliceHeader.

Parameters
headerTimeSliceHeader to copy into the TimeSlice

Definition at line 123 of file TimeSlice.hpp.

124 : m_header(header)
125 , m_fragments()
126{}

◆ ~TimeSlice()

virtual dunedaq::daqdataformats::TimeSlice::~TimeSlice ( )
virtualdefault

TimeSlice default destructor.

◆ TimeSlice() [3/4]

dunedaq::daqdataformats::TimeSlice::TimeSlice ( TimeSlice const & )
delete

TimeSlices are not copy-constructible.

◆ TimeSlice() [4/4]

dunedaq::daqdataformats::TimeSlice::TimeSlice ( TimeSlice && )
default

Default TimeSlice move constructor.

Member Function Documentation

◆ add_fragment()

void dunedaq::daqdataformats::TimeSlice::add_fragment ( std::unique_ptr< Fragment > && fragment)
inline

Add a Fragment pointer to the Fragments vector.

Parameters
fragmentFragment to add

Definition at line 74 of file TimeSlice.hpp.

74{ m_fragments.emplace_back(std::move(fragment)); }

◆ get_fragments_ref()

const std::vector< std::unique_ptr< Fragment > > & dunedaq::daqdataformats::TimeSlice::get_fragments_ref ( ) const
inline

Get a handle to the Fragments.

Returns
A reference to the Fragments vector

Definition at line 62 of file TimeSlice.hpp.

62{ return m_fragments; }

◆ get_header()

TimeSliceHeader dunedaq::daqdataformats::TimeSlice::get_header ( ) const
inline

Get a copy of the TimeSliceHeader struct.

Returns
A copy of the TimeSliceHeader struct

Definition at line 51 of file TimeSlice.hpp.

51{ return m_header; }

◆ get_sum_of_fragment_payload_sizes()

size_t dunedaq::daqdataformats::TimeSlice::get_sum_of_fragment_payload_sizes ( ) const
inline

Get the sum of the fragment payload sizes.

Definition at line 98 of file TimeSlice.hpp.

99 {
100 size_t total_size = 0;
101
102 for (auto const& frag_ptr : m_fragments)
103 total_size += frag_ptr->get_data_size();
104
105 return total_size;
106 }

◆ get_total_size_bytes()

size_t dunedaq::daqdataformats::TimeSlice::get_total_size_bytes ( ) const
inline

Get size of timeslice from underlying TimeSliceHeader and Fragments.

Definition at line 85 of file TimeSlice.hpp.

86 {
87 size_t total_size = sizeof(get_header());
88
89 for (auto const& frag_ptr : m_fragments)
90 total_size += frag_ptr->get_size();
91
92 return total_size;
93 }
TimeSliceHeader get_header() const
Get a copy of the TimeSliceHeader struct.
Definition TimeSlice.hpp:51

◆ operator=() [1/2]

TimeSlice & dunedaq::daqdataformats::TimeSlice::operator= ( TimeSlice && )
default

Default TimeSlice move assignment operator.

◆ operator=() [2/2]

TimeSlice & dunedaq::daqdataformats::TimeSlice::operator= ( TimeSlice const & )
delete

TimeSlices are not copy-assignable.

◆ set_element_id()

void dunedaq::daqdataformats::TimeSlice::set_element_id ( SourceID source_id)
inline

Set the SourceID for this TimeSlice.

Parameters
source_idSourceID value to set

Definition at line 80 of file TimeSlice.hpp.

◆ set_fragments()

void dunedaq::daqdataformats::TimeSlice::set_fragments ( std::vector< std::unique_ptr< Fragment > > && fragments)
inline

Set the Fragments vector to the given vector of Fragments.

Parameters
fragmentsFragments vector to use

Definition at line 68 of file TimeSlice.hpp.

68{ m_fragments = std::move(fragments); }

◆ set_header()

void dunedaq::daqdataformats::TimeSlice::set_header ( TimeSliceHeader header)
inline

Set the TimeSliceHeader to the given TimeSliceHeader object.

Parameters
headernew TimeSliceHeader to use

Definition at line 56 of file TimeSlice.hpp.

56{ m_header = header; }

Member Data Documentation

◆ m_fragments

std::vector<std::unique_ptr<Fragment> > dunedaq::daqdataformats::TimeSlice::m_fragments
private

Vector of unique_ptrs to Fragment objects.

Definition at line 110 of file TimeSlice.hpp.

◆ m_header

TimeSliceHeader dunedaq::daqdataformats::TimeSlice::m_header
private

TimeSliceHeader object.

Definition at line 109 of file TimeSlice.hpp.


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