![]() |
IRSOL
C++ code implementing socket server for interacting with Baumer camera.
|
Core protocol message types, serialization, parsing, and communication utilities for the irsol framework. More...
Namespaces | |
namespace | internal |
namespace | utils |
Utility functions for string manipulation and validation. | |
Classes | |
struct | Assignment |
Represents an assignment operation in the protocol. More... | |
struct | BinaryDataAttribute |
Represents a single binary data attribute within the protocol. More... | |
struct | Command |
Represents a command invocation in the protocol. More... | |
struct | Error |
Represents an error response message from the server. More... | |
struct | Inquiry |
Represents a value inquiry in the protocol. More... | |
class | Parser |
Parses raw input strings into structured InMessage instances. More... | |
class | Serializer |
Serializes outgoing protocol messages and primitive values. More... | |
struct | Success |
Represents a success response message from the server. More... | |
Typedefs | |
using | BinaryDataBuffer = internal::BinaryData< 2, 1 > |
1-dimensional binary data buffer with 2 bytes per element. | |
using | ImageBinaryData = internal::BinaryData< 2, 2 > |
2-dimensional binary data buffer with 2 bytes per element (e.g., grayscale images). | |
using | ColorImageBinaryData = internal::BinaryData< 2, 3 > |
3-dimensional binary data buffer with 2 bytes per element (e.g., color images). | |
using | InMessage = std::variant< Assignment, Inquiry, Command > |
Variant type representing any incoming message. | |
using | OutMessage = std::variant< Success, BinaryDataBuffer, ImageBinaryData, ColorImageBinaryData, Error > |
Variant type representing any outgoing message. | |
Enumerations | |
enum class | InMessageKind { InMessageKind::ASSIGNMENT , InMessageKind::INQUIRY , InMessageKind::COMMAND } |
Represents the type of an incoming message. More... | |
enum class | OutMessageKind { OutMessageKind::SUCCESS , OutMessageKind::BINARY_BUFFER , OutMessageKind::BW_IMAGE , OutMessageKind::COLOR_IMAGE , OutMessageKind::ERROR } |
Represents the type of an outgoing message. More... | |
Functions | |
constexpr const char * | InMessageKindToString (InMessageKind kind) |
Converts an InMessageKind enum to a human-readable string. | |
constexpr const char * | OutMessageKindToString (OutMessageKind kind) |
Converts an OutMessageKind enum to a human-readable string. | |
std::string | toString (const InMessage &msg) |
Converts an incoming message variant to a human-readable string. | |
std::string | 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 | getInMessageKind (IRSOL_MAYBE_UNUSED const T &msg) |
Returns the InMessageKind enum value corresponding to a given incoming message type. | |
InMessageKind | 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 | isAssignment (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given incoming message type is an Assignment. | |
bool | isAssignment (const InMessage &msg) |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, InMessage >, int > = 0> | |
constexpr bool | isInquiry (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given incoming message type is an Inquiry. | |
bool | isInquiry (const InMessage &msg) |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, InMessage >, int > = 0> | |
constexpr bool | isCommand (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given incoming message type is a Command. | |
bool | isCommand (const InMessage &msg) |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr OutMessageKind | getOutMessageKind (IRSOL_MAYBE_UNUSED const T &msg) |
Returns the OutMessageKind enum value corresponding to a given outgoing message type. | |
OutMessageKind | 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 | isSuccess (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given outgoing message type is Success. | |
bool | isSuccess (const OutMessage &msg) |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr bool | isBinaryDataBuffer (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given outgoing message type is BinaryDataBuffer. | |
bool | isBinaryDataBuffer (const OutMessage &msg) |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr bool | isImageBinaryData (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given outgoing message type is ImageBinaryData (black & white). | |
bool | isImageBinaryData (const OutMessage &msg) |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr bool | isColorImageBinaryData (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given outgoing message type is ColorImageBinaryData. | |
bool | isColorImageBinaryData (const OutMessage &msg) |
template<typename T , std::enable_if_t< irsol::traits::is_type_in_variant_v< T, OutMessage >, int > = 0> | |
constexpr bool | isError (IRSOL_MAYBE_UNUSED T &msg) |
Checks if a given outgoing message type is Error. | |
bool | isError (const OutMessage &msg) |
Core protocol message types, serialization, parsing, and communication utilities for the irsol framework.
The irsol::protocol
namespace encapsulates all components related to the structured communication protocol between clients and servers within the irsol ecosystem.
Key responsibilities and features include:
std::variant
or similar tagged unions to enable type-safe polymorphism for incoming and outgoing messages.Together, these features enable robust, efficient, and maintainable communication handling in client-server interactions, ensuring interoperability and clear semantics across the irsol system.
internal
for implementation details, and traits
for type traits. bool irsol::protocol::isAssignment | ( | const InMessage & | msg | ) |
Definition at line 64 of file variants.cpp.
bool irsol::protocol::isBinaryDataBuffer | ( | const OutMessage & | msg | ) |
Definition at line 99 of file variants.cpp.
bool irsol::protocol::isColorImageBinaryData | ( | const OutMessage & | msg | ) |
Definition at line 111 of file variants.cpp.
bool irsol::protocol::isCommand | ( | const InMessage & | msg | ) |
Definition at line 76 of file variants.cpp.
bool irsol::protocol::isError | ( | const OutMessage & | msg | ) |
Definition at line 116 of file variants.cpp.
bool irsol::protocol::isImageBinaryData | ( | const OutMessage & | msg | ) |
Definition at line 105 of file variants.cpp.
bool irsol::protocol::isInquiry | ( | const InMessage & | msg | ) |
Definition at line 70 of file variants.cpp.
bool irsol::protocol::isSuccess | ( | const OutMessage & | msg | ) |
Definition at line 93 of file variants.cpp.