Skip to content

Framework Overview

Julien SOYSOUVANH edited this page Aug 6, 2021 · 7 revisions

Kodgen is architectured around 5 main classes:

Each of those classes intervenes in the generation flow as follow:

  1. First of all, the CodeGenManager scans and gathers all eligible files (based on the CodeGenManager settings) and determines for each file whether the generated code is up-to-date or not.
  2. The content of each non-up-to-date file is parsed by a FileParser (multithreaded by default), and marked C++ entities are stored in a data structure.
  3. Each data structure is then forwarded to a CodeGenUnit, that will dispatch code generation to each registered CodeGenModule:
    • During the pre-generation step, each CodeGenModule and their associated PropertyCodeGen are initialized. The initialization can fail, in which case the generation process is aborted for this unit.
    • Then, the CodeGenUnit will ask each registered CodeGenModule to generate code for each parsed C++ entity. It's up to the CodeGenModule to generate or not code for the forwarded entity. PropertyCodeGen might also generate code for the entity. The code generation for an entity might fail, in which case the generation process is aborted for this unit.
    • During the post-generation step, the CodeGenUnit can manipulate the generated code. In most cases, it will generate one or multiple files and fill them with the generated code, but it is completely up to the CodeGenUnit implementation you are using.