11#ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSORERROR_HPP
12#define RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSORERROR_HPP
14#include "llnetio/mudpi/mudpi.hpp"
18#include <system_error>
21#include <fmt/format.h>
22#include <fmt/ostream.h>
26template <
class ErrorStruct>
34 ErrorCode(
typename ErrorStruct::VariantType err) : m_error_info(err) {
38 return m_error_info.has_value();
43 return HasError() and std::holds_alternative<E>(*m_error_info);
49 throw std::logic_error(
"bad error access");
51 return std::get<E>(*m_error_info);
56 throw std::logic_error(
"bad error access");
59 std::visit([&](
auto&& arg) { msg = arg.What(); }, *m_error_info);
64 std::optional<typename ErrorStruct::VariantType> m_error_info;
81 inline std::string
What()
const {
83 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2}. FrameId out of "
102 inline std::string
What()
const {
104 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2} Expected SampleId "
105 "{}. Unexpected SampleId, frame rejected.",
123 inline std::string
What()
const {
125 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2} Expected FrameId "
126 "{:2}. Unexpected FrameId, frame rejected.",
143 inline std::string
What()
const {
145 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2}. Synchronising: "
162 inline std::string
What()
const {
164 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {}. Wrangler Error: {}",
183 inline std::string
What()
const {
185 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2}. Packet Size "
186 "mismatch: actual size {} expected size {}",
207 inline std::string
What()
const {
209 "DDS Topic: \"{}\" MUDPI Topic [{}] SampleId: {} FrameId: {:2}. Wrong MUDPI "
210 "Checksum: {} should be: {}",
Definition ddsPubThread.cpp:16
ErrorCode(typename ErrorStruct::VariantType err)
Definition mudpiProcessingError.hpp:34
bool HasError() const
Definition mudpiProcessingError.hpp:42
E GetError() const
Definition mudpiProcessingError.hpp:47
bool HasError() const
Definition mudpiProcessingError.hpp:37
std::string What() const
Definition mudpiProcessingError.hpp:54
MUDPI Checksum error.
Definition mudpiProcessingError.hpp:200
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:202
std::string_view dds_topic
Definition mudpiProcessingError.hpp:201
std::string What() const
Definition mudpiProcessingError.hpp:207
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:203
uint16_t actual_checksum
Definition mudpiProcessingError.hpp:205
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:204
uint16_t expected_checksum
Definition mudpiProcessingError.hpp:206
Frame ID out of range.
Definition mudpiProcessingError.hpp:75
std::string_view dds_topic
Definition mudpiProcessingError.hpp:76
std::string What() const
Definition mudpiProcessingError.hpp:81
llnetio::mudpi::NumFrames num_frames
Definition mudpiProcessingError.hpp:80
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:78
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:79
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:77
(UDP) Packet Size error.
Definition mudpiProcessingError.hpp:176
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:179
std::string What() const
Definition mudpiProcessingError.hpp:183
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:180
std::string_view dds_topic
Definition mudpiProcessingError.hpp:177
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:178
size_t expected_packet_size
Definition mudpiProcessingError.hpp:182
size_t actual_packet_size
Definition mudpiProcessingError.hpp:181
Synchronising.
Definition mudpiProcessingError.hpp:138
std::string What() const
Definition mudpiProcessingError.hpp:143
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:142
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:140
std::string_view dds_topic
Definition mudpiProcessingError.hpp:139
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:141
Unexpected frame ID inside a sample.
Definition mudpiProcessingError.hpp:117
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:121
std::string_view dds_topic
Definition mudpiProcessingError.hpp:118
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:120
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:119
llnetio::mudpi::FrameId expected_frame_id
Definition mudpiProcessingError.hpp:122
std::string What() const
Definition mudpiProcessingError.hpp:123
Unexpected sample ID, so we need to resynchronise.
Definition mudpiProcessingError.hpp:96
llnetio::mudpi::FrameId frame_id
Definition mudpiProcessingError.hpp:100
llnetio::mudpi::SampleId expected_sample_id
Definition mudpiProcessingError.hpp:101
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:99
std::string_view dds_topic
Definition mudpiProcessingError.hpp:97
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:98
std::string What() const
Definition mudpiProcessingError.hpp:102
Wrangler Error.
Definition mudpiProcessingError.hpp:157
llnetio::mudpi::TopicId topic_id
Definition mudpiProcessingError.hpp:159
std::string_view dds_topic
Definition mudpiProcessingError.hpp:158
llnetio::mudpi::SampleId sample_id
Definition mudpiProcessingError.hpp:160
std::error_code error
Definition mudpiProcessingError.hpp:161
std::string What() const
Definition mudpiProcessingError.hpp:162
MUDPI Processor errors.
Definition mudpiProcessingError.hpp:71
std::variant< FrameIdOutOfRange, UnexpectedSampleId, UnexpectedFrameId, Synchronising, WranglerError, PacketSizeError, ChecksumError > VariantType
Definition mudpiProcessingError.hpp:220