C++ domain templates

Table of Contents

This page is the literate source for the cpp_domain facet of the codegen template library. Each section documents one template and holds its source in a mustache block tangled to the sibling .mustache file consumed by generator.py. The .mustache files are generated artefacts — edit this document, then run the tangle (compass build --direct tangle_codegen_templates or projects/ores.lisp/src/ores-build-codegen-templates.el directly). Output paths and profile membership come from facet_catalogue.org.

Summary

Six templates around the entity's value type: the domain class in temporal and non-temporal variants (domain / non-temporal-domain profiles), reflect-cpp JSON IO (both domain profiles), and the faker-based test-data generator pair (generator profile).

The cpp_domain facet

The top of the entity's C++ projection (entity lifecycle): the value type every other layer converts to and from, its serialised form, and synthetic instances for tests. Column loops dispatch on per-field type flags to choose C++ types, defaults and faker calls.

Archetypes

Archetype Description
cpp_domain_type_class.hpp.mustache The entity's value type: members from the model's columns plus valid_from / valid_to. domain profile.
cpp_domain_type_class_non_temporal.hpp.mustache Value type without temporal columns. non-temporal-domain profile.
cpp_domain_type_generator.cpp.mustache faker-cxx generation per column type. generator profile.
cpp_domain_type_generator.hpp.mustache Generator class declaration. generator profile.
cpp_domain_type_json_io.cpp.mustache reflect-cpp JSON round-trip implementation. domain and non-temporal-domain profiles.
cpp_domain_type_json_io.hpp.mustache JSON IO declarations. domain and non-temporal-domain profiles.

See also

Emacs 29.1 (Org mode 9.6.6)