|
microfmt
Zero-allocation C++ formatting for constrained environments
|
Stateful streaming decoder for incoming GDB Remote Serial Protocol packets. More...
#include <gdb_stream.hpp>
Public Types | |
| enum class | status : uint8_t { in_progress , ready , error_overflow , error_checksum , error_format } |
| Status returned after feeding a byte into the decoder. More... | |
Public Member Functions | |
| constexpr | gdb_streaming_decoder (span< char > payload_scratch RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS) noexcept |
| Constructs a streaming decoder over a caller-provided scratch span. | |
| constexpr void | reset () noexcept |
| Resets the decoder state machine back to waiting for a new packet start ('$'). | |
| RELOCO_BEGIN_UNSAFE_CODE constexpr status | feed (char c) noexcept |
| Feeds a single incoming character into the stateful decoder. | |
| RELOCO_END_UNSAFE_CODE constexpr string_view | payload () const noexcept RELOCO_LIFETIMEBOUND |
| Returns a non-owning string view over the fully unescaped packet payload. Valid only when feed() returns status::ready. | |
Stateful streaming decoder for incoming GDB Remote Serial Protocol packets.
Designed for byte-by-byte ingestion (e.g., from UART RX ring buffers or interrupts) with zero heap allocation and strict stack safety.
|
strong |
|
inlineexplicitconstexprnoexcept |
Constructs a streaming decoder over a caller-provided scratch span.
| payload_scratch | Caller-owned memory buffer to unescape and store the decoded payload. |
|
inlineconstexprnoexcept |
Feeds a single incoming character into the stateful decoder.
| c | Incoming character from serial/UART stream. |
|
inlineconstexprnoexcept |
Returns a non-owning string view over the fully unescaped packet payload. Valid only when feed() returns status::ready.
|
inlineconstexprnoexcept |
Resets the decoder state machine back to waiting for a new packet start ('$').