Codegen entity meta-model — C++ generator

Table of Contents

This page is a segment of the Codegen org-entity meta-model hub, covering the ores.cpp.generator facet.

Physical model mapping

Facet Description
ores.cpp.generator Fake-data generators for testing.

What gets generated, unconditionally

A single-record and an N-record synthetic generator, built by combining every column's generator babel block from Keys and columns — nothing extra to configure here beyond authoring those per-column generator expressions.

Generates, in book_generator.hpp:

namespace ores::refdata::generators {

ORES_REFDATA_API_EXPORT domain::book
generate_synthetic_book(utility::generation::generation_context& ctx);

ORES_REFDATA_API_EXPORT std::vector<domain::book>
generate_synthetic_books(std::size_t n, utility::generation::generation_context& ctx);

}

Paste blocks

The ores.cpp.generator facet defines the following paste block kinds, one per sub-heading below — see Paste blocks for the general mechanism they assume.

Custom declarations

Additional free-function declarations after the standard synthetic generator declarations, before the closing namespace brace, expecting a declaration block. Use for entity-specific generator functions not expressible through the standard generate_synthetic_<entity> template — a fictional/hardcoded generator for a test entity with an authoritative fixed data set.

To use this paste block on an entity, declare it under ** Paste blocks > *** Custom declarations. See the following example:

** Paste blocks
*** Custom declarations

#+begin_src cpp :name declaration :implements E32E358B-56EC-4642-911E-A2EA1D95E3B4
ORES_REFDATA_API_EXPORT std::vector<domain::country>
generate_fictional_countries(std::size_t n,
    utility::generation::generation_context& ctx);
#+end_src

Custom implementations

Out-of-class function definitions after the standard generate_synthetic_<plural> function, before the closing namespace brace, expecting a body block — the implementations for the custom declarations above.

See also

Emacs 29.3 (Org mode 9.6.15)