DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
sourceid.cpp
Go to the documentation of this file.
1
10
11#include <pybind11/operators.h>
12#include <pybind11/pybind11.h>
13#include <pybind11/stl.h>
14
15#include <sstream>
16
17namespace py = pybind11;
18
20
21void
22register_sourceid(py::module& m)
23{
24
25 py::class_<SourceID> py_sourceid(m, "SourceID");
26 py_sourceid.def(py::init()).def(py::init<const SourceID::Subsystem&, const SourceID::ID_t&>());
27 py_sourceid.def(py::self < py::self).def("__repr__", [](const SourceID& gid) {
28 std::ostringstream oss;
29 oss << "<daqdataformats::SourceID " << gid << ">";
30 return oss.str();
31 });
32
33 py::enum_<SourceID::Subsystem>(py_sourceid, "Subsystem")
34 .value("kUnknown", SourceID::Subsystem::kUnknown)
35 .value("kDetectorReadout", SourceID::Subsystem::kDetectorReadout)
36 .value("kHwSignalsInterface", SourceID::Subsystem::kHwSignalsInterface)
37 .value("kTrigger", SourceID::Subsystem::kTrigger)
38 .value("kTRBuilder", SourceID::Subsystem::kTRBuilder)
39 .export_values();
40
41 py_sourceid.def_readwrite("version", &SourceID::version)
42 .def_readwrite("subsystem", &SourceID::subsystem)
43 .def_readwrite("id", &SourceID::id);
44
45 py_sourceid.def("subsystem_to_string", &SourceID::subsystem_to_string)
46 .def("string_to_subsystem", &SourceID::string_to_subsystem)
47 .def("to_string", &SourceID::to_string);
48}
49
50} // namespace dunedaq::daqdataformats::python
void register_sourceid(py::module &)
Definition sourceid.cpp:22
SourceID is a generalized representation of the source of a piece of data in the DAQ....
Definition SourceID.hpp:32
Version_t version
Version number of the SourceID.
Definition SourceID.hpp:65
Subsystem subsystem
The general subsystem of the source of the data.
Definition SourceID.hpp:69
static std::string subsystem_to_string(const Subsystem &type)
Definition SourceID.hxx:88
static Subsystem string_to_subsystem(const std::string &typestring)
Definition SourceID.hxx:106
std::string to_string() const
Definition SourceID.hpp:83
ID_t id
Unique identifier of the source of the data.
Definition SourceID.hpp:74