C++ service application templates

Table of Contents

This page is the literate source for the cpp_service_app 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

Twelve templates scaffolding a service component: application, host, config options/parser with their exceptions, main.cpp and the stub test. All component-service profile, generated once per service component. (The per-entity service pair that used to share this prefix lives in the cpp_messaging facet.)

The cpp_service_app facet

The service projection of the component (component architecture): a generated service binary is main.cpp → host (lifecycle, signals) → application (wiring) → config parser/options (CLI + file), each with its exception type.

Mustache incantations

Component-level templates render inside {{#component}} with full_name / full_name_upper for include guards and namespaces; the entity service uses the entity's protocol/handler names. Standard constructs otherwise.

Archetypes

Archetype Description
cpp_service_app_application.cpp.mustache Service wiring: config → dependencies → run loop. component-service profile.
cpp_service_app_application_exception.hpp.mustache Exception type for application failures. component-service profile.
cpp_service_app_application.hpp.mustache Application class declarations. component-service profile.
cpp_service_app_host.cpp.mustache Process lifecycle: signals, shutdown, telemetry. component-service profile.
cpp_service_app_host.hpp.mustache Host class declarations. component-service profile.
cpp_service_config_options.cpp.mustache Typed option set for the service. component-service profile.
cpp_service_config_options.hpp.mustache Option declarations. component-service profile.
cpp_service_config_parser.cpp.mustache CLI/file parsing into options. component-service profile.
cpp_service_config_parser_exception.hpp.mustache Exception type for parse failures. component-service profile.
cpp_service_config_parser.hpp.mustache Parser declarations. component-service profile.
cpp_service_main.cpp.mustache Entry point: construct host, run, map exceptions to exit codes. component-service profile.
cpp_service_stub_test.cpp.mustache Placeholder Catch2 test keeping the tests target linking. component-service profile.

See also

Emacs 29.1 (Org mode 9.6.6)