|
moddef-cpp
Idiomatic C++ runtime for ModDef
|
Idiomatic C++ runtime for ModDef (spec v0.4) — a thin, header-only wrapper over the moddef-c core (vendored as a submodule). The C engine does the in-place binary parsing and codec; C++ adds RAII, std::expected error handling, a typed Value, and a virtual Transport. Requires C++23; exception-free (builds under -fno-exceptions).
moddef::Transport is an abstract base with six std::span-based methods — implement them over your Modbus stack:
An unavailable reading (§8.4 sentinel) is a Value state, not an error:
CMake is the supported consumer path:
Development:
Tests convert small fixtures to binary with moddef-py (a sibling checkout with a .venv), the same host tooling the C runtime uses.
Point and string reads/writes, constrained writes, and SunSpec discovery — mirroring moddef-c. See DESIGN.md for the wrapper's design and the move-safety notes. For older toolchains without C++23, use moddef-c directly.
Code generated from a ModDef document (for example by moddef gen) is not a derivative work of the ModDef tooling or runtime. You may license the generated output under any terms you choose. The runtime it imports (this library) is Apache-2.0 licensed; see the LICENSE file for its terms, which apply only to the runtime, not to your generated code.
Apache-2.0. See [LICENSE](LICENSE), [NOTICE](NOTICE), and CONTRIBUTING.md.