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

SourceID is a generalized representation of the source of a piece of data in the DAQ. That source could be a physical location in the detector, a running process in the DAQ (e.g. a dataflow app, the source of a data request), etc. More...

#include <SourceID.hpp>

Public Types

enum class  Subsystem : Subsystem_t {
  kUnknown = 0 , kDetectorReadout = 1 , kHwSignalsInterface = 2 , kTrigger = 3 ,
  kTRBuilder = 4
}
 The Subsystem enum describes the kind of source we're dealing with. More...
using Version_t = uint16_t
using Subsystem_t = uint16_t
using ID_t = uint32_t

Public Member Functions

 SourceID ()=default
 SourceID (const Subsystem &subsystem_arg, const ID_t &id_arg)
std::string to_string () const
bool is_in_valid_state () const noexcept
bool operator< (const SourceID &other) const noexcept
 Comparison operators to allow SourceID to be used in std::map.
bool operator!= (const SourceID &other) const noexcept
bool operator== (const SourceID &other) const noexcept

Static Public Member Functions

static std::string subsystem_to_string (const Subsystem &type)
static Subsystem string_to_subsystem (const std::string &typestring)

Public Attributes

Version_t version { s_source_id_version }
Subsystem subsystem { Subsystem::kUnknown }
 The general subsystem of the source of the data.
ID_t id { s_invalid_id }
 Unique identifier of the source of the data.

Static Public Attributes

static constexpr Version_t s_source_id_version = 2
static constexpr ID_t s_invalid_id = std::numeric_limits<ID_t>::max()

Detailed Description

SourceID is a generalized representation of the source of a piece of data in the DAQ. That source could be a physical location in the detector, a running process in the DAQ (e.g. a dataflow app, the source of a data request), etc.

Definition at line 31 of file SourceID.hpp.

Member Typedef Documentation

◆ ID_t

Definition at line 36 of file SourceID.hpp.

◆ Subsystem_t

Definition at line 35 of file SourceID.hpp.

◆ Version_t

Definition at line 34 of file SourceID.hpp.

Member Enumeration Documentation

◆ Subsystem

The Subsystem enum describes the kind of source we're dealing with.

Enumerator
kUnknown 
kDetectorReadout 
kHwSignalsInterface 
kTrigger 
kTRBuilder 

Definition at line 39 of file SourceID.hpp.

40 {
41 kUnknown = 0,
42 kDetectorReadout = 1,
43 kHwSignalsInterface = 2,
44 kTrigger = 3,
45 kTRBuilder = 4
46 };

Constructor & Destructor Documentation

◆ SourceID() [1/2]

dunedaq::daqdataformats::SourceID::SourceID ( )
default

◆ SourceID() [2/2]

dunedaq::daqdataformats::SourceID::SourceID ( const Subsystem & subsystem_arg,
const ID_t & id_arg )
inline

Definition at line 63 of file SourceID.hpp.

64 : subsystem(subsystem_arg)
65 , id(id_arg)
66 {
67 }
Subsystem subsystem
The general subsystem of the source of the data.
Definition SourceID.hpp:56
ID_t id
Unique identifier of the source of the data.
Definition SourceID.hpp:59

Member Function Documentation

◆ is_in_valid_state()

bool dunedaq::daqdataformats::SourceID::is_in_valid_state ( ) const
inlinenoexcept

Definition at line 76 of file SourceID.hpp.

◆ operator!=()

bool dunedaq::daqdataformats::SourceID::operator!= ( const SourceID & other) const
inlinenoexcept

Definition at line 51 of file SourceID.hxx.

52{
53 return (*this) < other || other < (*this);
54}

◆ operator<()

bool dunedaq::daqdataformats::SourceID::operator< ( const SourceID & other) const
inlinenoexcept

Comparison operators to allow SourceID to be used in std::map.

Definition at line 87 of file SourceID.hpp.

89{
90 return std::tuple(subsystem, id) < std::tuple(other.subsystem, other.id);
91}

◆ operator==()

bool dunedaq::daqdataformats::SourceID::operator== ( const SourceID & other) const
inlinenoexcept

Definition at line 57 of file SourceID.hxx.

58{
59 return !((*this) != other);
60}

◆ string_to_subsystem()

SourceID::Subsystem dunedaq::daqdataformats::SourceID::string_to_subsystem ( const std::string & typestring)
inlinestatic

Definition at line 81 of file SourceID.hxx.

82{
83 if (typestring == "Detector_Readout")
85 if (typestring == "HW_Signals_Interface")
87 if (typestring == "Trigger")
89 if (typestring == "TR_Builder")
91
93}

◆ subsystem_to_string()

std::string dunedaq::daqdataformats::SourceID::subsystem_to_string ( const Subsystem & type)
inlinestatic

Definition at line 63 of file SourceID.hxx.

64{
65 switch (type) {
67 return "Unknown";
69 return "Detector_Readout";
71 return "HW_Signals_Interface";
73 return "Trigger";
75 return "TR_Builder";
76 }
77 return "Unknown";
78}

◆ to_string()

std::string dunedaq::daqdataformats::SourceID::to_string ( ) const
inline

Definition at line 69 of file SourceID.hpp.

70 {
71 std::ostringstream ostr;
72 ostr << subsystem_to_string(subsystem) << "_0x" << std::hex << std::setfill('0') << std::setw(2 * sizeof(id)) << id;
73 return ostr.str();
74 }
static std::string subsystem_to_string(const Subsystem &type)
Definition SourceID.hxx:63

Member Data Documentation

◆ id

ID_t dunedaq::daqdataformats::SourceID::id { s_invalid_id }

Unique identifier of the source of the data.

Definition at line 59 of file SourceID.hpp.

59{ s_invalid_id };

◆ s_invalid_id

ID_t dunedaq::daqdataformats::SourceID::s_invalid_id = std::numeric_limits<ID_t>::max()
staticconstexpr

Definition at line 51 of file SourceID.hpp.

◆ s_source_id_version

Version_t dunedaq::daqdataformats::SourceID::s_source_id_version = 2
staticconstexpr

Definition at line 49 of file SourceID.hpp.

◆ subsystem

Subsystem dunedaq::daqdataformats::SourceID::subsystem { Subsystem::kUnknown }

The general subsystem of the source of the data.

Definition at line 56 of file SourceID.hpp.

◆ version

Version_t dunedaq::daqdataformats::SourceID::version { s_source_id_version }

Definition at line 53 of file SourceID.hpp.

static constexpr Version_t s_source_id_version
Definition SourceID.hpp:49

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