![]() |
IRSOL
C++ code implementing socket server for interacting with Baumer camera.
|
Comprehensive structured types, utilities, and mechanisms for irsol protocol message exchange. More...
Files | |
file | assignment.hpp |
Protocol assignment operation representation. | |
file | binary.hpp |
Protocol binary data types and attributes definitions. | |
file | command.hpp |
Protocol command representation. | |
file | error.hpp |
Protocol error message representation. | |
file | inquiry.hpp |
Protocol inquiry representation. | |
file | success.hpp |
Protocol success message representation. | |
file | variants.hpp |
Definitions and utilities for incoming and outgoing protocol messages. | |
file | parser.hpp |
Parses raw protocol input strings into structured messages. | |
file | parser_result.hpp |
Encapsulates the result of a protocol parsing operation. | |
file | serializer.hpp |
Serialization utilities for protocol messages and primitive values. | |
Namespaces | |
namespace | irsol::protocol |
Core protocol message types, serialization, parsing, and communication utilities for the irsol framework. | |
Classes | |
struct | irsol::protocol::Assignment |
Represents an assignment operation in the protocol. More... | |
struct | irsol::protocol::BinaryDataAttribute |
Represents a single binary data attribute within the protocol. More... | |
struct | irsol::protocol::internal::BinaryDataBufferName< N > |
Helper to get a descriptive name for binary data buffers by dimensionality. More... | |
struct | irsol::protocol::internal::BinaryData< NBytes, N > |
Represents a binary data object within the protocol. More... | |
struct | irsol::protocol::Command |
Represents a command invocation in the protocol. More... | |
struct | irsol::protocol::Error |
Represents an error response message from the server. More... | |
struct | irsol::protocol::Inquiry |
Represents a value inquiry in the protocol. More... | |
struct | irsol::protocol::Success |
Represents a success response message from the server. More... | |
class | irsol::protocol::Parser |
Parses raw input strings into structured InMessage instances. More... | |
class | irsol::protocol::internal::ParserResult< T, > |
Wrapper for the result of a protocol parsing attempt. More... | |
struct | irsol::protocol::internal::SerializedMessage |
Represents a serialized protocol message with header and payload. More... | |
class | irsol::protocol::Serializer |
Serializes outgoing protocol messages and primitive values. More... | |
Typedefs | |
using | irsol::protocol::BinaryDataBuffer = internal::BinaryData< 2, 1 > |
1-dimensional binary data buffer with 2 bytes per element. | |
using | irsol::protocol::ImageBinaryData = internal::BinaryData< 2, 2 > |
2-dimensional binary data buffer with 2 bytes per element (e.g., grayscale images). | |
using | irsol::protocol::ColorImageBinaryData = internal::BinaryData< 2, 3 > |
3-dimensional binary data buffer with 2 bytes per element (e.g., color images). | |
using | irsol::protocol::InMessage = std::variant< Assignment, Inquiry, Command > |
Variant type representing any incoming message. | |
using | irsol::protocol::OutMessage = std::variant< Success, BinaryDataBuffer, ImageBinaryData, ColorImageBinaryData, Error > |
Variant type representing any outgoing message. | |
Enumerations | |
enum class | irsol::protocol::InMessageKind { irsol::protocol::InMessageKind::ASSIGNMENT , irsol::protocol::InMessageKind::INQUIRY , irsol::protocol::InMessageKind::COMMAND } |
Represents the type of an incoming message. More... | |
enum class | irsol::protocol::OutMessageKind { irsol::protocol::OutMessageKind::SUCCESS , irsol::protocol::OutMessageKind::BINARY_BUFFER , irsol::protocol::OutMessageKind::BW_IMAGE , irsol::protocol::OutMessageKind::COLOR_IMAGE , irsol::protocol::OutMessageKind::ERROR } |
Represents the type of an outgoing message. More... | |
Functions | |
constexpr const char * | irsol::protocol::InMessageKindToString (InMessageKind kind) |
Converts an InMessageKind enum to a human-readable string. | |
constexpr const char * | irsol::protocol::OutMessageKindToString (OutMessageKind kind) |
Converts an OutMessageKind enum to a human-readable string. | |
std::string | irsol::protocol::toString (const InMessage &msg) |
Converts an incoming message variant to a human-readable string. | |
std::string | irsol::protocol::toString (const OutMessage &msg) |
Converts an outgoing message variant to a human-readable string. | |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, InMessage >, int > = 0> | |
constexpr InMessageKind | irsol::protocol::getInMessageKind (IRSOL_MAYBE_UNUSED const T &msg) |
Returns the InMessageKind enum value corresponding to a given incoming message type. | |
InMessageKind | irsol::protocol::getInMessageKind (const InMessage &msg) |
Returns the InMessageKind enum value for a given incoming message variant. | |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, InMessage >, int > = 0> | |
constexpr bool | irsol::protocol::isAssignment (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given incoming message type is an Assignment. | |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, InMessage >, int > = 0> | |
constexpr bool | irsol::protocol::isInquiry (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given incoming message type is an Inquiry. | |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, InMessage >, int > = 0> | |
constexpr bool | irsol::protocol::isCommand (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given incoming message type is a Command. | |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr OutMessageKind | irsol::protocol::getOutMessageKind (IRSOL_MAYBE_UNUSED const T &msg) |
Returns the OutMessageKind enum value corresponding to a given outgoing message type. | |
OutMessageKind | irsol::protocol::getOutMessageKind (const OutMessage &msg) |
Returns the OutMessageKind enum value for a given outgoing message variant. | |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr bool | irsol::protocol::isSuccess (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given outgoing message type is Success. | |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr bool | irsol::protocol::isBinaryDataBuffer (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given outgoing message type is BinaryDataBuffer. | |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr bool | irsol::protocol::isImageBinaryData (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given outgoing message type is ImageBinaryData (black & white). | |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr bool | irsol::protocol::isColorImageBinaryData (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given outgoing message type is ColorImageBinaryData. | |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr bool | irsol::protocol::isError (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given outgoing message type is Error. | |
Comprehensive structured types, utilities, and mechanisms for irsol protocol message exchange.
The Protocol module encompasses the core abstractions and tools that define, handle, and facilitate client-server communication in the irsol framework.
This includes:
std::variant
-based discriminated unions to safely encapsulate and dispatch different message types.This module is designed with maintainability and extensibility in mind, enabling the protocol to evolve without breaking existing communication contracts.
using irsol::protocol::BinaryDataBuffer = typedef internal::BinaryData<2, 1> |
1-dimensional binary data buffer with 2 bytes per element.
Definition at line 196 of file binary.hpp.
using irsol::protocol::ColorImageBinaryData = typedef internal::BinaryData<2, 3> |
3-dimensional binary data buffer with 2 bytes per element (e.g., color images).
Definition at line 208 of file binary.hpp.
using irsol::protocol::ImageBinaryData = typedef internal::BinaryData<2, 2> |
2-dimensional binary data buffer with 2 bytes per element (e.g., grayscale images).
Definition at line 202 of file binary.hpp.
using irsol::protocol::InMessage = typedef std::variant<Assignment, Inquiry, Command> |
Variant type representing any incoming message.
This variant holds one of the possible incoming message types:
Definition at line 86 of file variants.hpp.
using irsol::protocol::OutMessage = typedef std::variant<Success, BinaryDataBuffer, ImageBinaryData, ColorImageBinaryData, Error> |
Variant type representing any outgoing message.
This variant holds one of the possible outgoing message types:
Definition at line 148 of file variants.hpp.
|
strong |
Represents the type of an incoming message.
Incoming messages are categorized into three kinds:
Enumerator | |
---|---|
ASSIGNMENT | |
INQUIRY | |
COMMAND |
Definition at line 44 of file variants.hpp.
|
strong |
Represents the type of an outgoing message.
Outgoing messages are categorized into:
Enumerator | |
---|---|
SUCCESS | |
BINARY_BUFFER | |
BW_IMAGE | |
COLOR_IMAGE | |
ERROR |
Definition at line 99 of file variants.hpp.
InMessageKind irsol::protocol::getInMessageKind | ( | const InMessage & | msg | ) |
Returns the InMessageKind enum value for a given incoming message variant.
msg | The incoming message variant. |
Definition at line 53 of file variants.cpp.
|
constexpr |
Returns the InMessageKind enum value corresponding to a given incoming message type.
T | The concrete incoming message type. |
msg | The incoming message instance (unused). |
Definition at line 178 of file variants.hpp.
OutMessageKind irsol::protocol::getOutMessageKind | ( | const OutMessage & | msg | ) |
Returns the OutMessageKind enum value for a given outgoing message variant.
msg | The outgoing message variant. |
Definition at line 82 of file variants.cpp.
|
constexpr |
Returns the OutMessageKind enum value corresponding to a given outgoing message type.
T | The concrete outgoing message type. |
msg | The outgoing message instance (unused). |
Definition at line 254 of file variants.hpp.
|
constexpr |
Converts an InMessageKind enum to a human-readable string.
kind | The InMessageKind value to convert. |
Definition at line 59 of file variants.hpp.
|
constexpr |
Checks if a given incoming message type is an Assignment.
T | The concrete incoming message type. |
msg | The incoming message instance. |
Definition at line 207 of file variants.hpp.
|
constexpr |
Checks if a given outgoing message type is BinaryDataBuffer.
T | The concrete outgoing message type. |
msg | The outgoing message instance. |
Definition at line 302 of file variants.hpp.
|
constexpr |
Checks if a given outgoing message type is ColorImageBinaryData.
T | The concrete outgoing message type. |
msg | The outgoing message instance. |
Definition at line 332 of file variants.hpp.
|
constexpr |
Checks if a given incoming message type is a Command.
T | The concrete incoming message type. |
msg | The incoming message instance. |
Definition at line 237 of file variants.hpp.
|
constexpr |
Checks if a given outgoing message type is Error.
T | The concrete outgoing message type. |
msg | The outgoing message instance. |
Definition at line 347 of file variants.hpp.
|
constexpr |
Checks if a given outgoing message type is ImageBinaryData (black & white).
T | The concrete outgoing message type. |
msg | The outgoing message instance. |
Definition at line 317 of file variants.hpp.
|
constexpr |
Checks if a given incoming message type is an Inquiry.
T | The concrete incoming message type. |
msg | The incoming message instance. |
Definition at line 222 of file variants.hpp.
|
constexpr |
Checks if a given outgoing message type is Success.
T | The concrete outgoing message type. |
msg | The outgoing message instance. |
Definition at line 287 of file variants.hpp.
|
constexpr |
Converts an OutMessageKind enum to a human-readable string.
kind | The OutMessageKind value to convert. |
Definition at line 116 of file variants.hpp.
std::string irsol::protocol::toString | ( | const InMessage & | msg | ) |
Converts an incoming message variant to a human-readable string.
msg | The incoming message variant. |
Definition at line 19 of file variants.cpp.
std::string irsol::protocol::toString | ( | const OutMessage & | msg | ) |
Converts an outgoing message variant to a human-readable string.
msg | The outgoing message variant. |
Definition at line 34 of file variants.cpp.