restructure zmq socker interface

zmq socket can now return vector of frames. it knows end of transmission with header.data == 0
it can also send vector of frames
This commit is contained in:
Bechir
2024-04-09 08:32:53 +02:00
committed by Bechir Braham
parent cd46f59b99
commit a2499c96d6
18 changed files with 255 additions and 87 deletions

View File

@ -58,6 +58,14 @@ class Frame {
other.m_data = nullptr;
other.m_rows = other.m_cols = other.m_bitdepth = 0;
}
// copy constructor
Frame(const Frame &other) {
m_rows = other.rows();
m_cols = other.cols();
m_bitdepth = other.bitdepth();
m_data = new std::byte[m_rows * m_cols * m_bitdepth / 8];
std::memcpy(m_data, other.m_data, m_rows * m_cols * m_bitdepth / 8);
}
template <typename T> NDView<T> view() {
std::vector<ssize_t> shape = {m_rows, m_cols};

View File

@ -1,11 +1,11 @@
#pragma once
#include <array>
#include <fmt/format.h>
#include <stdexcept>
#include <cstdint>
#include <string>
#include <string_view>
#include <sys/types.h>
#include <variant>
#include <vector>

View File

@ -31,8 +31,7 @@ template <> DetectorType StringTo(std::string name) {
else if (name == "ChipTestBoard")
return DetectorType::ChipTestBoard;
else {
auto msg = fmt::format("Could not decode dector from: \"{}\"", name);
throw std::runtime_error(msg);
throw std::runtime_error("Could not decode dector from: \"" + name + "\"");
}
}
@ -42,8 +41,7 @@ template <> TimingMode StringTo(std::string mode) {
else if (mode == "trigger")
return TimingMode::Trigger;
else {
auto msg = fmt::format("Could not decode timing mode from: \"{}\"", mode);
throw std::runtime_error(msg);
throw std::runtime_error("Could not decode timing mode from: \"" + mode + "\"");
}
}