Closed
Conversation
Add an encode mode that writes CBOR bytes directly to a caller-provided callback instead of an intermediate output buffer. This enables low-RAM producers (e.g. UART streaming) to emit CBOR without needing to precompute container sizes. The encode implementation routes all byte writes through helper macros that either append to the payload buffer (existing behavior) or call the streaming callback (streaming mode). When streaming is enabled, list/map containers are terminated using indefinite-length encoding (break 0xFF) to avoid backtracking and header resizing. Also add helper APIs for iterator-driven repeated-field encoding and chunked indefinite-length text string encoding, plus error reporting for streaming write/provider failures. Backward compatible: NULL callback retains existing buffered encoding.
Add optional generation of streaming encode entrypoints (cbor_stream_encode_<type>) and provider structs for repeated fields (iterator) and tstr chunking. Keep default generated output unchanged unless --stream-encode-functions is enabled, and keep repeated fields as fixed arrays unless --repeated-as-pointers is enabled.
Document the optional streaming encode entrypoints and the --stream-encode-functions codegen option. Update the architecture overview to mention the generated provider structs and streaming entrypoints.
- Add STREAMING=1 variants for test1_suit, test2_simple, test3_corner_cases, and test4_senml. - Exercise streaming encode paths via stream_write helpers and cbor_stream_encode_* entrypoints.
8477ca5 to
0948a1e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Justification
Testing