IRSOL
C++ code implementing socket server for interacting with Baumer camera.
serialized_message.hpp
Go to the documentation of this file.
1
16#pragma once
17
18#include "irsol/types.hpp"
19
20#include <string>
21#include <vector>
22
23namespace irsol {
24namespace protocol {
25namespace internal {
26
43{
49 std::string header;
50
56 std::vector<irsol::types::byte_t> payload{};
57
66 SerializedMessage(const std::string& header, std::vector<irsol::types::byte_t>&& payload);
67
69 SerializedMessage(SerializedMessage&&) noexcept = default;
70
72 SerializedMessage& operator=(SerializedMessage&&) noexcept = default;
73
76
78 SerializedMessage& operator=(const SerializedMessage&) = delete;
79
84 bool hasHeader() const;
85
90 bool hasPayload() const;
91
96 size_t payloadSize() const;
97
106 std::string toString() const;
107};
108
109} // namespace internal
110} // namespace protocol
111} // namespace irsol
Represents a serialized protocol message with header and payload.
std::vector< irsol::types::byte_t > payload
The binary payload of the serialized message.
std::string header
The textual header of the serialized message.
bool hasHeader() const
Checks whether the serialized message contains a non-empty header.
std::string toString() const
Converts the serialized message to a string representation.
SerializedMessage(SerializedMessage &&) noexcept=default
Move constructor (defaulted).
size_t payloadSize() const
Returns the size of the payload in bytes.
bool hasPayload() const
Checks whether the serialized message contains a non-empty payload.
Core type definitions for networking, time handling, and protocol values used throughout the irsol li...