20static constexpr FieldId MaxFieldId = (1 << 29) - 1;
46static constexpr std::size_t StandardHeaderSize =
96 FieldId id,
const char (&msg)[N])
noexcept {
105 std::string_view msg =
"deserialization error") noexcept {
132 FieldId id,
const char (&msg)[N])
noexcept {
136 [[nodiscard]]
constexpr bool operator==(
const Error& other)
const noexcept =
The public API for Crunch.
Definition: crunch_endian.hpp:10
uint8_t CrunchVersionId
Version identifier for the Crunch library.
Definition: crunch_types.hpp:40
int32_t FieldId
Unique identifier for a field within a Crunch message.
Definition: crunch_types.hpp:11
int32_t MessageId
Unique identifier for a message type.
Definition: crunch_types.hpp:25
Format
Serialization format identifier stored in the message header.
Definition: crunch_types.hpp:30
@ TLV
Tag-Length-Value encoding.
@ Aligned4
4-byte alignment padding.
@ Packed
No alignment padding (Alignment = 1).
@ Aligned8
8-byte alignment padding.
ErrorCode
Error codes representing various failure conditions in Crunch.
Definition: crunch_types.hpp:54
@ ValidationFailed
Field or message logical validation failed.
@ InvalidMessageId
Message ID in header does not match expected ID.
@ DeserializationError
Error parsing or decoding message data.
Represents an error occurred during Crunch operations.
Definition: crunch_types.hpp:73
static constexpr Error validation(FieldId id, const char(&msg)[N]) noexcept
Creates an error representing a validation failure.
Definition: crunch_types.hpp:95
static constexpr Error deserialization(std::string_view msg="deserialization error") noexcept
Creates an error representing a deserialization failure.
Definition: crunch_types.hpp:104
ErrorCode code
The error code.
Definition: crunch_types.hpp:74
FieldId field_id
Definition: crunch_types.hpp:76
static constexpr Error invalid_message_id() noexcept
Creates an error representing an invalid message ID.
Definition: crunch_types.hpp:112
static constexpr Error invalid_format() noexcept
Creates an error representing an invalid serialization format.
Definition: crunch_types.hpp:119
std::string_view message
Static error message string.
Definition: crunch_types.hpp:79
constexpr bool operator==(ErrorCode c) const noexcept
Checks if the error matches a specific error code.
Definition: crunch_types.hpp:142
static constexpr Error capacity_exceeded(FieldId id, const char(&msg)[N]) noexcept
Creates an error representing capacity exceeded. Used for strings and aggregated fields.
Definition: crunch_types.hpp:131
static constexpr Error integrity() noexcept
Creates an error representing an integrity check failure.
Definition: crunch_types.hpp:84