Function utils::parseSetRegistry
Defined in File TOMLUtils.hpp
Function Documentation
-
inline auto utils::parseSetRegistry(const std::string ®istryName, const std::string &setsKey, const std::string &itemNoun, const std::string &context, const bool requireFeH = true) -> std::tuple<toml::table, std::filesystem::path, std::vector<std::string>>
Locate, parse, and validate a track/spectra-style registry file.
On top of parseTOMLFile’s own validation, this further checks that the registry has a non-empty setsKey array, and that every set it names has its own table entry with a “file” field (and, if requireFeH, a “Fe_H” field too).
- Parameters:
registryName – Name of the registry file
setsKey – The top-level key naming the array of set names (e.g. “track_sets” or “spectra_sets”)
itemNoun – Plural noun for a set entry, used in error messages (e.g. “tracks” or “spectra”)
context – Prefix used in thrown error messages (typically the name of the calling function)
requireFeH – Whether every set entry must also have a “Fe_H” field, on top of the always-required “file” field; true by default, since every track set and most spectra sets are parameterized by metallicity, but false for a spectra set with no [Fe/H] axis at all (e.g. a white dwarf atmosphere grid, read by SpecsynLibWD) – see SpecsynUtils.cpp’s own parseRegistry()
- Throws:
std::runtime_error – if any of the above conditions are not met
- Returns:
The parsed table, the path it was read from, and the list of set names read from its setsKey field