ores.cpp.presentation.history_field_mapper_header

Table of Contents

Declares render_{entity}_fields(): a codegen'd, plain per-entity function rendering a domain value to an ordered ores::diff::domain::field_value list, per History Diff Architecture layer 1 — one call per field, in mapper order, no runtime reflection. presentation profile.

See the Template variable reference for the complete list of available variables and their semantics.

1. Template

The full template source. Edit here and re-tangle with compass build --direct tangle_codegen_templates to regenerate library/templates/cpp_history_field_mapper.hpp.mustache.

{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/cpp_presentation.org. Edit the org source. }}
{{{cpp_license}}}
{{#domain_entity}}
#ifndef ORES_{{component_core_upper}}_PRESENTATION_{{entity_singular_upper}}_HISTORY_FIELD_MAPPER_HPP
#define ORES_{{component_core_upper}}_PRESENTATION_{{entity_singular_upper}}_HISTORY_FIELD_MAPPER_HPP

#include "ores.diff/domain/field_value.hpp"
#include "ores.{{component_core}}/export.hpp"
#include "ores.{{component_include}}/domain/{{entity_singular}}.hpp"
#include <vector>

namespace ores::{{component}}::presentation {

/**
 * @brief Renders a {{entity_singular}} to an ordered field list for
 * history-diff display. One line per field, in mapper order; no
 * runtime reflection.
 */
[[nodiscard]] ORES_{{component_core_upper}}_EXPORT std::vector<ores::diff::domain::field_value>
render_{{entity_singular}}_fields(const domain::{{entity_singular}}& v);

}

#endif
{{/domain_entity}}
{{#junction}}
#ifndef ORES_{{component_core_upper}}_PRESENTATION_{{name_singular_upper}}_HISTORY_FIELD_MAPPER_HPP
#define ORES_{{component_core_upper}}_PRESENTATION_{{name_singular_upper}}_HISTORY_FIELD_MAPPER_HPP

#include "ores.diff/domain/field_value.hpp"
#include "ores.{{component_core}}/export.hpp"
#include "ores.{{component_core}}/repository/{{name_singular}}_repository.hpp"
#include <vector>

namespace ores::{{component}}::presentation {

/**
 * @brief Renders one version of a {{name_singular_words}} to an ordered field
 * list for history-diff display.
 *
 * The first field, @c ID, names the link by both of its keys, so the versions
 * of one link pair up in a stream that holds many links. The last field before
 * the provenance is @c Closed At, empty while the link is open.
 */
[[nodiscard]] ORES_{{component_core_upper}}_EXPORT std::vector<ores::diff::domain::field_value>
render_{{name_singular}}_fields(const repository::{{name_singular}}_history_row& v);

}

#endif
{{/junction}}

2. See also

Emacs 29.3 (Org mode 9.6.15)