TextGen developer guide
April 16, 2026 · View on GitHub
For developers who want to read or extend the library itself.
Reading order
- Architecture overview — how the patterns fit together
and how a call flows from
TextGenerator::generate()to final text - Class index — one-line purpose for every class, grouped by role (Glyph, Dictionary, TextFormatter, Story, …)
- Glyphs —
Document/Paragraph/Sentence/PhraseComposite hierarchy - Dictionaries —
Dictionaryinterface and backends - Text formatters — Visitor hierarchy (plain / HTML / CSS / speech / debug)
- Stories —
Storybase class,StoryFactory, and how per-parameter stories dispatch to generators - Narrative helpers —
CloudinessForecast,PrecipitationForecast,FogForecast,ThunderForecast,WindForecast,WeatherForecastStory - Mask sources — geographic filtering (coast / inland / halves)
- Acceptors — value filtering for analyser reductions
- Analysis functions —
Mean,Maximum,Trend, … - Testing — how to write and run a generator unit test
Conventions used in the code
- Capital-letter file = a class (
Document.cpp,WeatherFact.cpp,HeaderFactory.cpp). Class-file layout follows the SmartMet convention:Foo.h/Foo.cppholdclass TextGen::Foo. - Lowercase file = a generator entry point — one per named story
(
wind_overview.cpp,temperature_max36hours.cpp). These implement a single method of the owning Story class (usuallyWindStory::overview(),TemperatureStory::max36hours(), …) and are split out purely because they are too large to share a translation unit. - Everything lives in
namespace TextGen. - Internal headers are
#include "X.h". SmartMet library headers use angle brackets:#include <calculator/Settings.h>.
Dependencies
calculator— forecast analysis primitives (AnalysisSources,Settings,WeatherPeriod,HourPeriodGenerator, …)macgyver— utilities (Exception, caching, charset, datetime)newbase— QueryData / NFmi* types- Boost (locale, thread), fmt, libpqxx, mysqlpp, ICU, GDAL
See also
- User guide — configuration layout, per-story reference, and status tags