22 return std::get<Assignment>(
msg).toString();
24 return std::get<Inquiry>(
msg).toString();
26 return std::get<Command>(
msg).toString();
29 throw std::invalid_argument(
"Unknown in message type");
37 return std::get<Success>(
msg).toString();
39 return std::get<Error>(
msg).toString();
41 return std::get<BinaryDataBuffer>(
msg).toString();
43 return std::get<ImageBinaryData>(
msg).toString();
45 return std::get<ColorImageBinaryData>(
msg).toString();
48 throw std::invalid_argument(
"Unknown out message type");
57 using T = std::decay_t<
decltype(
value)>;
58 return getInMessageKind<T>(
value);
86 using T = std::decay_t<
decltype(
value)>;
87 return getOutMessageKind<T>(
value);
Protocol assignment operation representation.
Protocol binary data types and attributes definitions.
Protocol command representation.
Protocol error message representation.
#define IRSOL_ASSERT_FALSE(message)
Assertion macro that always fails fatally.
constexpr bool isError(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given outgoing message type is Error.
std::variant< Assignment, Inquiry, Command > InMessage
Variant type representing any incoming message.
constexpr OutMessageKind getOutMessageKind(IRSOL_MAYBE_UNUSED const T &msg)
Returns the OutMessageKind enum value corresponding to a given outgoing message type.
constexpr bool isCommand(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given incoming message type is a Command.
constexpr bool isSuccess(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given outgoing message type is Success.
constexpr bool isColorImageBinaryData(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given outgoing message type is ColorImageBinaryData.
OutMessageKind
Represents the type of an outgoing message.
constexpr bool isInquiry(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given incoming message type is an Inquiry.
constexpr bool isBinaryDataBuffer(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given outgoing message type is BinaryDataBuffer.
constexpr bool isAssignment(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given incoming message type is an Assignment.
constexpr bool isImageBinaryData(IRSOL_MAYBE_UNUSED T &msg)
Checks if a given outgoing message type is ImageBinaryData (black & white).
std::variant< Success, BinaryDataBuffer, ImageBinaryData, ColorImageBinaryData, Error > OutMessage
Variant type representing any outgoing message.
InMessageKind
Represents the type of an incoming message.
std::string toString(const InMessage &msg)
Converts an incoming message variant to a human-readable string.
constexpr InMessageKind getInMessageKind(IRSOL_MAYBE_UNUSED const T &msg)
Returns the InMessageKind enum value corresponding to a given incoming message type.
Protocol inquiry representation.
Utility functions for protocol string handling and validation in the irsol library.
Protocol success message representation.
Definitions and utilities for incoming and outgoing protocol messages.