94 std::enable_if_t<irsol::traits::is_type_in_variant_v<T, OutMessage>,
int> = 0>
97 if constexpr(std::is_same_v<T, Success>) {
99 }
else if constexpr(std::is_same_v<T, BinaryDataBuffer>) {
101 }
else if constexpr(std::is_same_v<T, ImageBinaryData>) {
103 }
else if constexpr(std::is_same_v<T, ColorImageBinaryData>) {
105 }
else if constexpr(std::is_same_v<T, Error>) {
138 if constexpr(std::is_same_v<T, int>) {
139 return std::to_string(
value);
140 }
else if constexpr(std::is_same_v<T, double>) {
141 return std::to_string(
value);
142 }
else if constexpr(std::is_same_v<T, std::string>) {
143 return "{" +
value +
"}";
Serializes outgoing protocol messages and primitive values.
static internal::SerializedMessage serialize(T &&msg)
Serialize a specific irsol::protocol::OutMessage type into a serialized protocol message.
static std::string serializeValue(T &&value)
Serialize a specific primitive type to a string.
static std::string serializeBinaryDataAttribute(irsol::protocol::BinaryDataAttribute &&att)
Serialize a irsol::protocol::BinaryDataAttribute to a string.
static internal::SerializedMessage serializeBinaryDataBuffer(BinaryDataBuffer &&msg)
Serializes a irsol::protocol::BinaryDataBuffer message to a binary protocol message.
static internal::SerializedMessage serializeImageBinaryData(ImageBinaryData &&msg)
Serializes a irsol::protocol::ImageBinaryData message to a binary protocol message.
static constexpr const char * message_termination
Message line termination sequence (newline character) used to "close" a serialized message.
static std::string serializeValue(irsol::types::protocol_value_t &&value)
Serialize a protocol primitive value to a string.
static internal::SerializedMessage serializeColorImageBinaryData(ColorImageBinaryData &&msg)
Serializes a irsol::protocol::ColorImageBinaryData message to a binary protocol message.
static internal::SerializedMessage serialize(OutMessage &&msg)
Serialize an irsol::protocol::OutMessage variant into a serialized protocol message.
Serializer()=delete
This class cannot be instantiated.
static internal::SerializedMessage serializeError(Error &&msg)
Serializes a irsol::protocol::Error message to a binary protocol message.
static internal::SerializedMessage serializeSuccess(Success &&msg)
Serializes a irsol::protocol::Success message to a binary protocol message.
std::variant< Success, BinaryDataBuffer, ImageBinaryData, ColorImageBinaryData, Error > OutMessage
Variant type representing any outgoing message.
Common portability and diagnostic macros for the irsol library.
#define IRSOL_MISSING_TEMPLATE_SPECIALIZATION(T, funcNameLiteral)
Emits a compile-time error when no template specialization is available.
std::variant< int, double, std::string > protocol_value_t
Variant type representing protocol values that can be one of several types.
std::byte byte_t
Alias for a single byte used in serialization or binary data handling.
Defines the SerializedMessage structure representing serialized protocol messages.
Represents a single binary data attribute within the protocol.
Represents an error response message from the server.
Special byte constants used in the Simple Communication Protocol.
static constexpr irsol::types::byte_t SOH
Start of Header (SOH) byte: 0x01.
static constexpr irsol::types::byte_t STX
Start of Text (STX) byte: 0x02.
static constexpr irsol::types::byte_t ETX
End of Text (ETX) byte: 0x03.
Represents a success response message from the server.
Represents a binary data object within the protocol.
Represents a serialized protocol message with header and payload.
Checks whether a type T is one of the types in a std::variant.
Template metaprogramming traits for type introspection in the irsol library.