|
SofaBuffers C++ 0.12.0
Pure-C++20 SofaBuffers — API Documentation
|
Decode fields at the current nesting level, firing cb for each.
More...
#include <sofab.hpp>
Public Member Functions | |
| void | operator() (sofab::id id, size_t size, size_t count) const noexcept |
Public Attributes | |
| void * | ctx |
| void(* | fn )(void *, sofab::id, size_t, size_t) |
Decode fields at the current nesting level, firing cb for each.
For every field the metadata members (type_, fixLen_, count_, ...) are set before cb runs; a field whose value the callback does not read is skipped automatically.
| Cb | The callable's own type, so the call is direct. A std::function parameter here cost a construction, a manager-driven destruction and two indirect hops per sub-message read, and the std::function machinery around it accounted for ~13 % of the decode: typical message profile. The two call sites pass a stateless no-op (skipPayload) and a two-pointer lambda (read), so the instantiation count is bounded and the body inlines into both. |
| cb | Callback invoked as (fieldId, size, count) per field. |
| stopAtEnd | If true, return at a Wire::SequenceEnd marker (nested level); if false, such a marker is a decode error. |
A non-owning reference to a level's per-field callback.
The parse loops call their callback through a template parameter, so the call is direct and inlines (that is deliberate — a std::function parameter there cost ~13 % of decode: typical message). The resume helpers below want the opposite: they run once per chunk boundary, never in the loop, and compiling a copy of each of them into every one of the dozens of dispatchLevel instantiations buys nothing but code size and uncoverable lines. They take this instead — two pointers, one indirect call on a cold path.
|
inlinenoexcept |
| void(* sofab::IStreamImpl::FieldCb::fn) (void *, sofab::id, size_t, size_t) |