|
BCNP 3.2.1
Batched Command Network Protocol
|
Functions | |
| int | compute_crc32 (bytes data) |
| str | canonical_json (dict schema) |
| int | compute_schema_hash (dict schema) |
| int | compute_message_size (dict msg) |
| None | generate_cpp_header (dict schema, Path output_dir) |
| None | generate_python_bindings (dict schema, Path output_dir) |
| main () | |
Variables | |
| dict | TYPE_INFO |
BCNP Schema Compiler
Compiles BCNP message schema (JSON) to C++ header and Python bindings.
Generates serialization/deserialization code and computes schema hash (CRC32).
Usage:
python bcnp_codegen.py schema/messages.json --cpp src/bcnp/generated/
python bcnp_codegen.py schema/messages.json --python examples/
| str bcnp_codegen.canonical_json | ( | dict | schema | ) |
Produce a canonical JSON string for schema hashing. Only includes structurally significant fields (id, name, type, scale).
Definition at line 44 of file bcnp_codegen.py.
| int bcnp_codegen.compute_crc32 | ( | bytes | data | ) |
IEEE CRC32 matching BCNP's existing implementation.
Definition at line 31 of file bcnp_codegen.py.
| int bcnp_codegen.compute_message_size | ( | dict | msg | ) |
Compute wire size of a message in bytes.
Definition at line 77 of file bcnp_codegen.py.
| int bcnp_codegen.compute_schema_hash | ( | dict | schema | ) |
Compute CRC32 of canonical JSON schema.
Definition at line 71 of file bcnp_codegen.py.
| None bcnp_codegen.generate_cpp_header | ( | dict | schema, |
| Path | output_dir ) |
Generate C++ header with message types and serialization.
The file is written to output_dir/bcnp/message_types.h so that
users can add output_dir to their include path and use:
#include <bcnp/message_types.h>
Definition at line 85 of file bcnp_codegen.py.
| None bcnp_codegen.generate_python_bindings | ( | dict | schema, |
| Path | output_dir ) |
Generate Python module with message classes and serialization.
Definition at line 395 of file bcnp_codegen.py.
| bcnp_codegen.main | ( | ) |
Definition at line 556 of file bcnp_codegen.py.
| dict bcnp_codegen.TYPE_INFO |
Definition at line 20 of file bcnp_codegen.py.