C++ component templates
Table of Contents
This page is the literate source for the cpp_component 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 forming a new component's C++ skeleton: the component
header and export macros (all four component profiles), the stub
header/impl/test trio that gives an empty component something to
compile and test (component, component-api, component-core),
and the Catch2 test_main (all four profiles).
The cpp_component facet
The minimal C++ presence of a component: enough generated source that CMake targets build and the test runner passes before any real code exists. Stubs are deleted as real entities arrive; the component header and test main remain.
Archetypes
| Archetype | Description |
|---|---|
| cpp_component_header.hpp.mustache | Umbrella header with the component's namespace docs. |
| cpp_component_stub_header.hpp.mustache | Placeholder declaration so the library target has a header. |
| cpp_component_stub_impl.cpp.mustache | Placeholder implementation so the library target has a TU. |
| cpp_component_stub_test.cpp.mustache | Placeholder Catch2 test so the tests target runs. |
| cpp_component_test_main.cpp.mustache | Catch2 main with the project's logging/test-env setup. |
| cpp_export.hpp.mustache | Per-component shared-library export/import macros. All component profiles. |
See also
- (Parent template group doc:
<group>_group.org.) - Codegen template library — the groups overview.
- Facet — the MASD concept these templates project.
- Type definition facet — the facet's modeling reference.
- Applied MASD — the facet catalogue and codegen routes.
- facet_catalogue.org — profile → template/output mapping.