gtopt/names_registry.hpp file

Runtime-loadable dictionary of gtopt JSON key aliases.

Loads share/gtopt/naming_dialects.json (or an embedded fallback) and exposes a flat alias -> canonical map used by json_canonicalize.hpp to rewrite alternative JSON key names to the canonical gtopt names accepted by from_json<Planning> under StrictParsePolicy.

Resolution order (deterministic and version-safe):

  1. $GTOPT_NAMING_DIALECTS_FILE — explicit override file (logged at info level; a warning flags an override that lacks aliases of the compiled-in dictionary, i.e. a probably stale copy)
  2. Compiled-in dictionary — share/gtopt/naming_dialects.json embedded at configure time, so it always matches the binary
  3. Empty registry (graceful degradation, only if 1-2 fail to parse)

Install / user share dirs (<prefix>/share/gtopt/, ~/.local/share/gtopt/) are never probed: a stale installed copy must not shadow the dictionary of the running binary.

The registry is loaded once on first access (singleton); subsequent lookups are O(log n) via gtopt::flat_map (vector-backed; the dictionary is small — ~50-200 entries — so cache-friendly linear memory wins over hash-table indirection).

Namespaces

namespace gtopt

Classes

class gtopt::NamesRegistry