ores.cpp.convention-registry

Table of Contents

This page is the node for the ores.cpp.convention-registry facet of the codegen template library, part of the ores.cpp technical space. Each archetype below is documented, and holds its mustache source, in its own linked page — this page is the facet-level summary and the routing table to them.

1. Summary

A convention family is an entity model that declares #+convention_family:. The family list is derived from those declarations, and three C++ artefacts are rendered from it: a registry header that enumerates every family, its write mode and its key, a header that declares one apply function and one payload-read function per family, and a dispatch unit that looks the family up in a table of those functions. The per-family functions themselves are rendered by the ores.cpp.convention-family facet, one translation unit for each family. A family added to the modelling tree arrives in the service on the next regeneration, and a family with no unit fails the dispatch's assertions at compile time.

The facet is opt-in and renders nothing by default. It is addressed to a component model rather than to a family, because the artefacts are one set per component and not one file per entity: the header lands in the component's API and the units header and dispatch in its core service. The archetypes therefore carry literal #+output: paths, which is the one place in the library a path names its component rather than spelling it from the model.

The rendering reads the refdata modelling tree, so only ores.refdata opts in. A second component that enables this facet would render refdata's registry into its own tree, which no component wants.

2. Mustache incantations

The archetypes read one context, convention_registry, which the generator builds only for the three templates of this facet. It exposes component, the families list in family-key order, and the three party, by_id and world groupings of the same entries. Each family states key, entity, domain_type, subject_stem, party_scoped, write_mode and the is_party, is_by_id, is_world one-hot flags the staged branch switches on.

3. Archetypes

Archetype Description
ores.cpp.convention-registry.dispatch The staged-apply and payload-read dispatch over the per-family units, one table row per convention family.
ores.cpp.convention-registry.registry_header The constexpr table of every convention family and its write mode, rendered from the refdata entity models that declare #+convention_family:.
ores.cpp.convention-registry.unit_declarations The declarations of the per-family apply and payload-read functions, one pair per convention family, so the dispatch unit names no family type.

4. See also

  • ores.cpp — the parent technical space's generated facet/archetype catalogue and shared Mustache conventions.
  • Codegen template library — the groups overview.

Emacs 29.3 (Org mode 9.6.15)