|
SofaBuffers C/C++ 0.12.0
API Documentation
|
SofaBuffers C++ - Input and output stream decoder for Sofab messages. More...
#include <array>#include <concepts>#include <cstdint>#include <cstring>#include <functional>#include <memory>#include <span>#include <string_view>#include <type_traits>#include "sofab/istream.h"#include "sofab/ostream.h"#include "sofab/seq.hpp"#include "sofab/floats.hpp"Go to the source code of this file.
Data Structures | |
| struct | sofab::wire_int< E, bool > |
| The integer type an element travels as on the wire: identity for an integer, the declared underlying type for an enumeration. More... | |
| struct | sofab::wire_int< E, true > |
| Enumeration case of wire_int: the declared underlying type. More... | |
| class | sofab::FixedString< N > |
Fixed-capacity, heap-free string of up to N characters. More... | |
| struct | sofab::is_fixed_string< typename > |
| Trait: true only for FixedString specializations. More... | |
| struct | sofab::is_fixed_string< FixedString< N > > |
| class | sofab::FixedBytes< N > |
Fixed-capacity, heap-free byte blob of up to N bytes. More... | |
| struct | sofab::is_fixed_bytes< typename > |
| Trait: true only for FixedBytes specializations. More... | |
| struct | sofab::is_fixed_bytes< FixedBytes< N > > |
| class | sofab::InlineVector< T, N > |
Fixed-capacity, heap-free sequence of up to N elements of type T. More... | |
| class | sofab::OStreamImpl |
| Base output stream: encodes fields into a caller-provided buffer. More... | |
| class | sofab::OStreamImpl::Result |
| Outcome of an encode operation, supporting fluent chaining. More... | |
| class | sofab::OStreamInline< N, Offset > |
| Output stream backed by an inline, fixed-size buffer. More... | |
| class | sofab::OStreamView |
| Output stream over a buffer the caller already owns. More... | |
| class | sofab::OStreamMessage |
| Base class for serializable message objects. More... | |
| class | sofab::OStreamObject< MessageType, N, Offset > |
| Self-contained encoder that owns a message and an inline buffer. More... | |
| class | sofab::OStreamObjectOffset< MessageType, Offset > |
| OStreamObject variant parameterized by offset only. More... | |
| class | sofab::DynCap |
| A CORELIB_PLAN §6.2.1 receiver cap, exactly as the caller states it. More... | |
| class | sofab::IStreamImpl |
| Base input stream: incrementally decodes fed bytes into bound targets. More... | |
| class | sofab::IStreamImpl::Result |
| Outcome of a feed call. More... | |
| class | sofab::IStreamInline |
| Input stream driven by a user-supplied per-field callback. More... | |
| class | sofab::IStreamMessage |
| Base class for decodable message objects. More... | |
| struct | sofab::Message |
| A message that both encodes and decodes: exactly OStreamMessage + IStreamMessage. More... | |
| class | sofab::IStreamObject< MessageType > |
| Self-contained decoder that owns a message instance. More... | |
| class | sofab::IStreamInto< MessageType > |
| Decoder that decodes into a message instance the CALLER owns. More... | |
| struct | sofab::FixedStringSeq< Container > |
Collects a string wrapper sequence into inline storage. More... | |
| struct | sofab::FixedBlobSeq< Container > |
Namespaces | |
| namespace | sofab |
| namespace | sofab::detail |
Concepts | |
| concept | sofab::HasMaxSize |
| Detects the CORELIB_PLAN §6.1.1 spelling of the worst-case size. | |
| concept | sofab::HasLegacyMaxSize |
| Detects the pre-0.11 spelling. Deprecated; see OutputMessage. | |
| concept | sofab::OutputMessage |
| Concept: a serializable message type usable with OStreamObject. | |
| concept | sofab::InputMessage |
Concept: a decodable message type usable with IStreamObject and the nested-message IStreamImpl::read() overload. | |
| concept | sofab::HasFixedCapacity |
Detects a container that states its own fixed capacity: the condition behind fixed_capacity_v. | |
Macros | |
| #define | SOFAB_CPP_HAVE_HOSTED __STDC_HOSTED__ |
| 1 if the hosted standard library is available, else 0. | |
| #define | SOFAB_CPP_HAVE_FP64 1 |
1 if the wrapper exposes 64-bit float (double) fields, else 0 (mirrors SOFAB_DISABLE_FP64_SUPPORT in the C core). | |
| #define | SOFAB_CPP_HAVE_INT64 1 |
1 if the wrapper exposes 64-bit integer fields, else 0 (mirrors SOFAB_DISABLE_INT64_SUPPORT in the C core). | |
| #define | SOFAB_CPP_HAVE_ARRAY 1 |
1 if the wrapper exposes array/span fields, else 0 (mirrors SOFAB_DISABLE_ARRAY_SUPPORT in the C core). | |
| #define | SOFAB_CPP_HAVE_ENCODE_BOUNDS 1 |
| 1 if generated code refuses an over-bound value at encode, else 0. | |
Typedefs | |
| template<typename E > | |
| using | sofab::wire_int_t = typename wire_int< E >::type |
| Alias for wire_int. | |
| using | sofab::id = sofab_id_t |
| Field identifier type (alias of sofab_id_t). | |
Enumerations | |
| enum class | sofab::Error { sofab::None = SOFAB_RET_OK , sofab::Incomplete = SOFAB_RET_INCOMPLETE , sofab::BufferFull = SOFAB_RET_E_BUFFER_FULL , sofab::InvalidArgument = SOFAB_RET_E_ARGUMENT , sofab::InvalidMessage = SOFAB_RET_E_INVALID_MSG , sofab::LimitExceeded = SOFAB_RET_E_LIMIT_EXCEEDED } |
| Result/error code returned by the stream APIs (wraps sofab_ret_t). More... | |
| enum class | sofab::Wire : uint8_t { sofab::Unsigned = SOFAB_TYPE_VARINT_UNSIGNED , sofab::Signed = SOFAB_TYPE_VARINT_SIGNED , sofab::Fixlen = SOFAB_TYPE_FIXLEN , sofab::ArrayUnsigned = SOFAB_TYPE_VARINTARRAY_UNSIGNED , sofab::ArraySigned = SOFAB_TYPE_VARINTARRAY_SIGNED , sofab::ArrayFixlen = SOFAB_TYPE_FIXLENARRAY , sofab::SequenceStart = SOFAB_TYPE_SEQUENCE_START , sofab::SequenceEnd = SOFAB_TYPE_SEQUENCE_END } |
| Wire type of a decoded field (the 3-bit type tag of its header). More... | |
| enum class | sofab::Fix : uint8_t { sofab::Fp32 = SOFAB_FIXLENTYPE_FP32 , sofab::Fp64 = SOFAB_FIXLENTYPE_FP64 , sofab::String = SOFAB_FIXLENTYPE_STRING , sofab::Blob = SOFAB_FIXLENTYPE_BLOB } |
| Sub-type of a length-prefixed (Wire::Fixlen) payload. More... | |
Functions | |
| std::size_t | sofab::detail::utf8Prefix (std::string_view sv, std::size_t n) noexcept |
Length of the longest prefix of sv that is at most n bytes and does not end inside a UTF-8 character; sv is longer than n. | |
| bool | sofab::seqRefuse (IStreamImpl &is, size_t n, long schemaBound, DynCap dynCap) noexcept |
| Apply a collector's message-side bounds and report the verdict. | |
| template<typename C > | |
| std::span< const typename C::value_type > | sofab::trimTail (const C &a) noexcept |
| Narrow a fixed-count array to its non-default prefix, for encode. | |
Variables | |
| constexpr int | sofab::API_VERSION = 1 |
| SofaBuffers C++ API version (mirrors SOFAB_API_VERSION). | |
| constexpr bool | sofab::ENCODE_BOUNDS = SOFAB_CPP_HAVE_ENCODE_BOUNDS != 0 |
Whether generated encode refuses an over-bound value (SOFAB_CPP_HAVE_ENCODE_BOUNDS; off with SOFAB_DISABLE_ENCODE_BOUNDS). | |
| template<typename > | |
| constexpr bool | sofab::always_false_v = false |
Always-false trait used to trigger a dependent static_assert in a discarded if constexpr branch (so it only fires when instantiated). | |
| template<typename T > | |
| constexpr bool | sofab::is_fixed_string_v |
| Convenience value for is_fixed_string. | |
| template<typename T > | |
| constexpr bool | sofab::is_fixed_bytes_v |
| Convenience value for is_fixed_bytes. | |
| template<class T > | |
| constexpr size_t | sofab::max_size_v |
The worst-case encoded size of a generated message, whichever spelling it declares. Prefers MAX_SIZE. | |
| template<typename C > | |
| constexpr long | sofab::fixed_capacity_v = -1 |
| Compile-time capacity a heap-free container publishes, or -1. | |
| template<HasFixedCapacity C> | |
| constexpr long | sofab::fixed_capacity_v< C > = static_cast<long>(C::capacity()) |
SofaBuffers C++ - Input and output stream decoder for Sofab messages.
SPDX-License-Identifier: MIT
Definition in file sofab.hpp.