One binary codec interface; a wire encoding is an instance of it. More...
Go to the source code of this file.
Classes | |
| struct | protocore_codec |
| A wire encoding: the ten writes, the peek, and the nine reads. More... | |
Functions | |
| EMBED_BEGIN_DECLS | EMBED_ENUM_BYTE (protocore_codec_type, PROTOCORE_CODEC_UINT=0, PROTOCORE_CODEC_INT, PROTOCORE_CODEC_BYTES, PROTOCORE_CODEC_STR, PROTOCORE_CODEC_ARRAY, PROTOCORE_CODEC_MAP, PROTOCORE_CODEC_BOOL, PROTOCORE_CODEC_NULL, PROTOCORE_CODEC_FLOAT, PROTOCORE_CODEC_INVALID) |
| The next item's type, reported by protocore_codec::peek without consuming it. | |
One binary codec interface; a wire encoding is an instance of it.
The interface fixes the operations, their order, and their signatures; a format supplies the function pointers. The order is the field order of the table, so a format whose operations drift out of order fails to compile.
Dispatch is a static const table of function pointers in rodata.
The region types come from spatium.h and the byte verbs from octetus_introitus_exitus.h. A codec allocates nothing and owns no buffer: it writes into a mmgr_span the caller bound and reads from a mmgr_cspan.
Definition in file codec.h.
| EMBED_BEGIN_DECLS EMBED_ENUM_BYTE | ( | protocore_codec_type | , |
| PROTOCORE_CODEC_UINT | = 0, | ||
| PROTOCORE_CODEC_INT | , | ||
| PROTOCORE_CODEC_BYTES | , | ||
| PROTOCORE_CODEC_STR | , | ||
| PROTOCORE_CODEC_ARRAY | , | ||
| PROTOCORE_CODEC_MAP | , | ||
| PROTOCORE_CODEC_BOOL | , | ||
| PROTOCORE_CODEC_NULL | , | ||
| PROTOCORE_CODEC_FLOAT | , | ||
| PROTOCORE_CODEC_INVALID | ) |
The next item's type, reported by protocore_codec::peek without consuming it.
One set of names across every format: CBOR calls a byte string "bytes" and MessagePack calls it "bin"; CBOR has "null" and MessagePack "nil". They are the same item, so they get one name here and the format maps its own tag onto it.