The blob counterpart of StringSeq; see it for the placement and bound rules.
More...
#include <sofab.hpp>
|
| | BlobSeq (C &o, long capacity, long elemMax, long indexCap, long elemLenCap) noexcept |
| |
| void | prepare () noexcept |
| | §7.4: the sequence IS the array's value, so a repeated field id replaces it whole.
|
| |
| void | deserialize (IStreamImpl &is, sofab::id id, size_t size, size_t) noexcept override |
| | Consume one of this message's fields from istream.
|
| |
| virtual | ~IStreamMessage ()=default |
| |
|
| C & | out |
| |
| long | cap |
| |
| long | emax |
| |
| long | dynCap |
| | The configured receiver cap on the element index (max_dyn_array_count, §6.2.1); negative means none.
|
| |
| long | elemDynCap |
| | The §6.2.1 receiver cap on one ELEMENT's length, or -1 when the caller supplied none.
|
| |
template<typename C = std::vector<std::vector<uint8_t>>>
struct sofab::BlobSeq< C >
The blob counterpart of StringSeq; see it for the placement and bound rules.
- Template Parameters
-
| C | Destination container — std::vector<std::vector<uint8_t>> or InlineVector<FixedBytes<M>, N>; deduced from the constructor. |
Definition at line 6841 of file sofab.hpp.
◆ BlobSeq()
template<typename C = std::vector<std::vector<uint8_t>>>
| sofab::BlobSeq< C >::BlobSeq |
( |
C & |
o, |
|
|
long |
capacity, |
|
|
long |
elemMax, |
|
|
long |
indexCap, |
|
|
long |
elemLenCap |
|
) |
| |
|
inlineexplicitnoexcept |
- Parameters
-
| o | Destination vector; elements are placed at their index id. |
| capacity | Schema count N, or -1 for an unbounded array. An element id at or past N is INVALID (§5.1/§7) once the element has passed the §7.3 type test, rejected before the container grows — which also bounds an over-index allocation. |
| elemMax | Element maxlen, or -1. A longer element is INVALID (§7.1), never truncated. |
| indexCap | The caller's max_dyn_array_count (dynCap), or -1 when none was supplied — there is no fallback, so no index cap then applies. An element id at or past it is Error::LimitExceeded, decided before the container grows. |
| elemLenCap | The caller's max_dyn_string_len / max_dyn_blob_len for one element (elemDynCap), or -1 when none was supplied. Consulted only where elemMax is -1. |
Definition at line 6860 of file sofab.hpp.
◆ deserialize()
template<typename C = std::vector<std::vector<uint8_t>>>
|
|
inlineoverridevirtualnoexcept |
Consume one of this message's fields from istream.
Invoked once per field of the message; use id to dispatch and IStreamImpl::read to pull the value.
- Parameters
-
| istream | Stream positioned at the field's value. |
| id | Identifier of the field being delivered. |
| size | Payload length (fixlen) or element size (fixlen array), in bytes. |
| count | Element count for array fields, otherwise 0. |
Implements sofab::IStreamMessage.
Definition at line 6868 of file sofab.hpp.
◆ prepare()
template<typename C = std::vector<std::vector<uint8_t>>>
§7.4: the sequence IS the array's value, so a repeated field id replaces it whole.
IStreamImpl::read calls this once the SequenceStart tag matched, so a §7.3-skipped occurrence cannot wipe a valid earlier one.
- Warning
- It runs only when the wrapper sequence is present. Since MESSAGE_SPEC §2 omits an all-default array field, an absent field reaches no collector at all and
out is left exactly as it was — so a destination reused across messages must be reset by its owner first (IStreamObject::reset, §5.1 "supplying a
cleanly initialised destination is the application's
responsibility"). This is not the collector's call to make: it never learns that the field was absent.
Definition at line 6866 of file sofab.hpp.
◆ cap
template<typename C = std::vector<std::vector<uint8_t>>>
◆ dynCap
template<typename C = std::vector<std::vector<uint8_t>>>
The configured receiver cap on the element index (max_dyn_array_count, §6.2.1); negative means none.
A wrapper array carries no count header, so there is no count word for a cap to bind: "for a <strong>sequence array</strong> it surfaces the <strong>index</strong> of the
element in hand — a wrapper array's length is <em>highest present id + 1</em>
(MESSAGE_SPEC §5.1), so the index is what has to be checked, there being
no count header to check." An id at or past this is Error::LimitExceeded, decided before out is extended, so an announced index never becomes an allocation.
Deliberately not StringSeq::cap — cap is the schema count and its breach is InvalidMessage — the bytes contradict the schema both peers agreed on — while this is a policy rejection the same bytes survive under a looser cap, and §6.2.1 forbids folding the two. It is also ignored while cap is armed, since a receiver limit "MUST NOT be
applied to a field the schema already bounds". The number itself is generated code's to supply (§6.2.1: "The numbers and the allocation are
not the codec's"). There is no default: the constructor takes it, and a collector built without one does not compile. (corelib-cpp#124)
Definition at line 6847 of file sofab.hpp.
◆ elemDestCap
template<typename C = std::vector<std::vector<uint8_t>>>
The destination's own capacity, or -1 for a growable container.
§6.3's third tier: an index the container cannot hold, with neither the schema nor the deployment objecting, is Error::InvalidArgument. For a fixed-capacity container this is also what keeps the placement loop below terminating — InlineVector::emplace_back reuses the last slot once full, so out.size() would never pass a large id.
Definition at line 6849 of file sofab.hpp.
◆ elemDynCap
template<typename C = std::vector<std::vector<uint8_t>>>
The §6.2.1 receiver cap on one ELEMENT's length, or -1 when the caller supplied none.
dynCap bounds how many elements the array may have; this bounds how long each may be. Both are needed: an array of two elements a gigabyte each is under any index cap. It is consulted only where emax is -1 — a receiver limit "MUST NOT be applied to a field the schema already
bounds" — and, like every cap here, it is passed in and never held. There is no default: a negative value means the caller stated no cap, and an element read under one answers Error::InvalidArgument rather than being read unbounded.
Definition at line 6857 of file sofab.hpp.
◆ elemFix
template<typename C = std::vector<std::vector<uint8_t>>>
The declared element type, published to the stream (§7.3).
The §5.1/§7 over-index reject applies only to an element whose header agrees with this — one that contradicts it is not this array's element at all and is skipped like an unknown id, bound or no bound. The stream picks these up exactly as it picks up cap; they are compile-time constants, so no constructor signature changes.
Definition at line 6854 of file sofab.hpp.
◆ elemWire
template<typename C = std::vector<std::vector<uint8_t>>>
The declared element type, published to the stream (§7.3).
The §5.1/§7 over-index reject applies only to an element whose header agrees with this — one that contradicts it is not this array's element at all and is skipped like an unknown id, bound or no bound. The stream picks these up exactly as it picks up cap; they are compile-time constants, so no constructor signature changes.
Definition at line 6852 of file sofab.hpp.
◆ emax
template<typename C = std::vector<std::vector<uint8_t>>>
◆ out
template<typename C = std::vector<std::vector<uint8_t>>>
The documentation for this struct was generated from the following file: