Class index

April 16, 2026 · View on GitHub

One-line purpose for every class in smartmet-library-textgen. Grouped by role. For deeper explanations of a hierarchy, follow the link at the top of each section.

Some classes are abstract bases; their subclasses live immediately underneath in the tables. Namespaces (like AreaTools, WeekdayTools) are listed with classes where it aids navigation.


Entry point

ClassPurpose
TextGeneratorTop-level driver. Reads textgen::sections from the config, builds the Document section by section, and returns it.

Composite: Glyph and friends

See glyphs.md.

ClassPurpose
GlyphAbstract base. Any unit of composed text. Supports realize(Dictionary) and realize(TextFormatter) via double dispatch.
GlyphContainerGlyph that owns a list of child glyphs.
DocumentTop-level container. Result of TextGenerator::generate().
HeaderContainer holding one section header (from HeaderFactory).
ParagraphContainer for a sequence of sentences.
SentenceContainer that auto-capitalises the first word and appends a period.
TimePhraseContainer wrapping a Sentence that describes a period ("tänään", "huomisaamusta alkaen").
PhraseLeaf. A dictionary-key token that resolves at format time.
LocationPhraseLeaf. Place name, auto-capitalised, with dictionary override.
IntegerLeaf. An int with optional formatting policy.
RealLeaf. A float/double with optional formatting policy.
IntegerRangeLeaf. "X...Y" integer range.
RealRangeLeaf. "X...Y" floating-point range.
PositiveRangeLeaf. Range clamped to positive values (wind, precipitation).
DelimiterLeaf. Punctuation that attaches to the preceding token without a space.
WeatherTimeLeaf. Clock-time rendering.
TimePeriodLeaf. Period start/end rendering.
TextLeaf. Literal text that bypasses the dictionary.
SectionTagMarker. Paired tags inserted around each section so formatters can wrap markup around it.
StoryTagMarker. Paired tags inserted around each story.

Dictionaries

See dictionaries.md.

ClassPurpose
DictionaryAbstract base. init(language), find(key), contains(key), insert(key, phrase).
BasicDictionaryIn-memory dictionary populated by code. Useful for programmatic setups and tests.
FileDictionaryReads a pipe-delimited `key
DebugDictionaryReturns the key unchanged. Useful for inspecting generator output without translation noise.
NullDictionaryAlways returns the empty string (suppresses output).
DatabaseDictionaryAbstract SQL-backed single-language dictionary.
MySQLDictionaryMySQL/MariaDB backend for DatabaseDictionary.
PostgreSQLDictionaryPostgreSQL backend.
FileDictionariesFronts several FileDictionary instances, one per language.
DatabaseDictionariesSame idea for SQL backends.
DictionaryFactoryCreates a Dictionary* by name string ("mysql", "file", "multimysqlplusgeneric", …).

Text formatters (Visitor)

See text-formatters.md.

ClassPurpose
TextFormatterAbstract base. Visits each Glyph subtype and produces a formatted string.
PlainTextFormatterSpace-separated plain text.
PlainLinesTextFormatterPlain text with one sentence per line.
SingleLineTextFormatterPlain text, all on one line.
HtmlTextFormatterHTML output with classed paragraphs.
CssTextFormatterHTML with embedded CSS hooks around stories/sections.
SpeechTextFormatterText-to-speech oriented format.
SoneraTextFormatterCustomer-specific format for Sonera SMS products.
WmlTextFormatterWireless Markup Language output (legacy mobile).
DebugTextFormatterShows dictionary keys in square brackets.
ExtendedDebugTextFormatterSame idea but more verbose; includes section/story tags.
TextFormatterFactoryCreates a TextFormatter* by name.
TextFormatterToolsHelpers shared by several formatters.

Stories

See stories.md.

ClassPurpose
StoryAbstract base. hasStory(name) and makeStory(name).
StoryFactoryNamespace. create(name) walks every parameter story class in turn and dispatches.
TemperatureStoryOwns all temperature_* generators.
PrecipitationStoryOwns pop_* and precipitation_*.
CloudinessStoryOwns cloudiness_overview.
WeatherStoryOwns weather_overview, weather_forecast, weather_shortoverview, weather_thunderprobability*.
WindStoryOwns wind_overview, wind_anomaly, wind_range, wind_daily_ranges, wind_simple_overview.
FrostStoryOwns frost_onenight, frost_twonights, frost_day, frost_mean/maximum/range.
RelativeHumidityStoryOwns the three relativehumidity_* stories.
RoadStoryOwns roadwarning_*, roadcondition_*, roadtemperature_*.
ForestStoryOwns forestfireindex_twodays, forestfirewarning_county, evaporation_day.
DewPointStoryOwns dewpoint_range.
PressureStoryOwns pressure_mean.
WaveStoryOwns wave_range.
SpecialStoryOwns non-weather stories: none, date, text, table.
WeatherForecastStoryComposition scaffolding used by weather_forecast.cpp to compose multi-part weather narratives.

Story-tools helpers

Shared code extracted from individual generators in the same family.

Class / namespacePurpose
TemperatureStoryToolsDay/night range helpers, comparative phrasing, coast sub-clause.
PrecipitationStoryTools"Paikoin / monin paikoin" classification and precipitation-class helpers.
WindStoryToolsWind speed/direction classification and phrase selection.
CloudinessStoryToolsCloudiness classification, similarity-merging.
FrostStoryToolsFrost probability classification.
RoadStoryToolsRoad condition classification and merging rules.

Narrative helpers (used by weather_forecast / weather_overview)

ClassPurpose
WeatherForecastShared types and helpers for the weather_overview / weather_forecast family.
CloudinessForecastCloudiness classifier and narrative helper with multi-period merging.
PrecipitationForecastPrecipitation classifier with "paikoin / monin paikoin" tautology avoidance.
FogForecastFog-period classification (dense fog optionally enabled via ENABLE_DENSE_FOG).
ThunderForecastThunder-probability helper.
WindForecastWind narrative composition helper.
WindForecastStructsPlain structs used by WindForecast.

Factories

Listed together for convenience. Each one is covered in the section for the hierarchy it creates.

FactoryBuildsInput
StoryFactory (namespace)ParagraphStory name string
HeaderFactory (namespace)HeaderHeader type name
WeatherPeriodFactory (namespace)WeatherPeriodReads ::period::type ("now", "until", …)
PeriodPhraseFactory (namespace)SentenceType + variable prefix ("today", "tonight", …)
DictionaryFactoryDictionary*Backend name ("file", "mysql", …)
TextFormatterFactoryTextFormatter*Formatter name ("plain", "html", …)
UnitFactory (namespace)SentenceUnit name ("celsius", "millimetres", …)

Period / time tools

Class / namespacePurpose
NightAndDayPeriodGeneratorSplits a forecast period into alternating night/day subperiods.
MorningAndEveningPeriodGeneratorSplits into morning / afternoon / evening / night subperiods.
WeekdayToolsNamespace. Weekday phrasing helpers (on_weekday, night_against_weekday).

Geographic masks

See architecture.md#hierarchy-5--masksource-area-filtering.

The MaskSource base class itself lives in calculator, not textgen.

ClassPurpose
CoastMaskSourceRestricts analysis to coastal grid points.
InlandMaskSourceRestricts to inland (non-coastal) points.
LandMaskSourceExcludes sea points.
NorthernMaskSourceNorthern half of an area.
SouthernMaskSourceSouthern half.
EasternMaskSourceEastern half.
WesternMaskSourceWestern half.
NullMaskSourceNo restriction (identity).
SubMaskExtractorNamespace. Builds an NFmiIndexMask for a location or sub-area from an AnalysisSources/WeatherArea.

Acceptors (value filters)

The Acceptor base class itself lives in calculator.

ClassPurpose
ValueAcceptorAccepts values inside a fixed [min, max] range.
ComparativeAcceptorAccepts values satisfying one comparison (>= x, < x, …).
PositiveValueAcceptorAccepts strictly positive values.
AndAcceptorLogical AND of two acceptors.
OrAcceptorLogical OR of two acceptors.
TemplateAcceptorTemplate-style acceptor parameterised by a comparison functor.

Forecast-area and climatology tools

Class / namespacePurpose
AreaToolsNamespace. Geographic helpers (forecast_area_id, coast/inland dispatch).
ClimatologyToolsNamespace. Climatological reference lookups.
GridClimatologyGridded climatology dataset.
SeasonToolsNamespace. Season detection (winter/spring/summer/autumn) for threshold overrides.
TemperatureToolsNamespace. Temperature-specific helpers (rounding, range formatting).
TemperatureRangeValue struct: minimum/maximum temperature pair.

External data

ClassPurpose
PostGISDataSourceReads area polygons from a PostGIS database.
FireWarningsReads the daily forest-fire warning file used by forestfirewarning_county.

Small utilities

Class / namespacePurpose
WeatherFactSmall container pairing a fact value with a WeatherPeriod.
WeatherObserverAbstract. Observes actual (measured) weather. Rarely used.
WeatherStatisticianAbstract. Computes statistics from observations. Rarely used.
MessageLoggerIndented scope-based debug logger.
MessageLoggerStreamOutput-stream adapter for MessageLogger.
PrecipitationPeriodToolsNamespace. Helpers for splitting a period by rain onset/end.