|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Key types that wrap a RawModelKey — the ladder's strong ids. More...
#include <model_key.hpp>
Key types that wrap a RawModelKey — the ladder's strong ids.
examples/IMPLEMENTATION.md rule 3 requires entity identity to be a per-entity strong id type (struct PasteId, struct OptionId) exposing hasValue(), so that it joins the forms palette as an empty-capable field. Such a type is not integral and is not std::string, so before this it satisfied no arm of ModelKey at all — and a rung obeying rule 3 could not use BRIDGE_MODEL_KEY/BRIDGE_KEY_FROM, the very macros the framework provides for keying. Three rungs hand-wrote the traits instead, each re-stating the *id unwrapping convention the macro exists to hide.
The shape is deduced structurally rather than declared, matching how a keyed model is detected: any type with hasValue() and an operator* yielding a RawModelKey, and constructible back from that raw value so the key round-trips from the wire. Both ladder spellings qualify — an std::optional-backed id whose operator* returns a reference, and a sentinel-backed one (0 means empty) whose operator* returns by value.
Definition at line 62 of file model_key.hpp.