|
SofaBuffers C/C++ 0.12.0
API Documentation
|
Collects a struct/union or nested-array wrapper sequence into inline storage. More...
#include <seq.hpp>
Public Types | |
| using | Elem = typename Container::value_type |
| Element type: an IStreamMessage, or a row container. | |
Public Member Functions | |
| void | deserialize (IStreamImpl &is, sofab_id_t id, size_t, size_t count) noexcept override |
| Dispatch one decoded field to the appropriate read. | |
Data Fields | |
| Container * | out = nullptr |
| Destination, bound by IStreamImpl::readSequence. | |
Static Public Attributes | |
| static constexpr int | elemWire = seq_elem_wire_v<Elem> |
| Declared element wire type, or -1 (seq_elem_wire_v). | |
| static constexpr int | elemFix = seq_elem_fix_v<Elem> |
| Declared element fixlen sub-type, or -1 (seq_elem_fix_v). | |
Collects a struct/union or nested-array wrapper sequence into inline storage.
The object counterpart of FixedStringSeq: same placement rule, same bound, filling elements that are messages (a struct or union) or rows of native scalars (a matrix) rather than FixedString slots. Bind it the way its four siblings are bound, through IStreamImpl::readSequence.
An element is placed at its index id, never appended. MESSAGE_SPEC §5.1 makes the element's child id the array index, and the ids may have gaps: an interior element equal to the element default is left off the wire by a conformant encoder (§2), so the container is grown with default elements up to the id and the value stored there. Appending instead would silently shorten the array by every gap — elements at id 0 and id 2 are the 3-element array [a, default, c], not [a, c] — and would turn a reopened element id into a second element instead of continuing the first (§7.4). The array's last element is always on the wire, so the decoded length (highest present id + 1) is exact; the schema count is a capacity and never adds an element the wire did not carry.
An index at or past the fixed capacity N is a schema-bound violation (§5.1/§7) and is rejected with IStreamImpl::invalidate, before the fill loop. That also bounds an over-index amplification: InlineVector reuses its last slot once full, so an unguarded fill loop would spin forever on such an index (issue #126), and no announced index can make the receiver reserve anything.
An element whose wire type contradicts the declared one is skipped exactly like an unknown id (§7.3), which means it must leave the container untouched — so that decision, too, comes before the fill.
Inline storage never reallocates, so an element bound earlier stays address-stable while later slots grow, which the deferred C decoder relies on.
| Container | Inline vector of messages, or of rows. |
| using sofab::FixedMessageSeq< Container >::Elem = typename Container::value_type |
Element type: an IStreamMessage, or a row container.
|
inlineoverridevirtualnoexcept |
Dispatch one decoded field to the appropriate read.
Called for each field of this message; implementations typically switch on _id and call _istream.read(member).
| _istream | Stream to bind the field's destination on. |
| _id | Field identifier. |
| _size | Field value size in bytes (e.g. string/blob length). |
| _count | Number of array elements (for array fields). |
Implements sofab::IStreamMessage.
Definition at line 186 of file seq.hpp.
|
staticconstexpr |
Declared element fixlen sub-type, or -1 (seq_elem_fix_v).
|
staticconstexpr |
Declared element wire type, or -1 (seq_elem_wire_v).
Destination, bound by IStreamImpl::readSequence.