namespace
SushiAI::Config
- Declared in
include/SushiAI/config/model_config.hpp
Contains
Enumerations
enum class KindWhat a Value holds.
NULJSON null.
BOOLtrue or false.
INTA whole number.
REALA number with a fractional part or an exponent.
STRINGA string.
ARRAYAn ordered list of values.
OBJECTA set of key/value pairs, in the order the file spelled them.
Variables
constexpr std::int64_t MODEL_VERSION = 1The model-file version this build reads.
constexpr std::int64_t TRAIN_VERSION = 1The train-file version this build reads.
constexpr std::int64_t DATA_VERSION = 1The standalone data-file version this build reads.
Functions
ModelSpec parse_model(const Value &root, std::string_view origin)Parses a model configuration value into a ModelSpec.
Parameters
rootParsed configuration value tree.
originContext description for diagnostics.
Returns
Parsed model specification.
Exceptions
ErrorIf schema constraints or version requirements fail.
ModelSpec load_model(const std::filesystem::path &path)Reads, parses and validates the model file at path.
Parameters
pathThe file to read.
Returns
The spec.
Exceptions
ErrorIf the file cannot be read, is not valid JSON, or is not a valid model document.
template <typename Entry, std::size_t N>
const Entry & find_entry(const std::array< Entry, N > &table, std::string_view type, std::string_view what)Finds the entry named type, or throws listing what exists.
Parameters
tableRegistry constant table.
typeDiscriminator string to locate.
whatDiagnostic label describing entry category.
Returns
Reference to matching registry entry.
Exceptions
ErrorIf
typeis not found intable.
TrainSpec parse_train(const Value &root, std::string_view origin, const std::filesystem::path &base)Parses a train document into a TrainSpec.
Parameters
rootParsed document value tree.
originContext description for diagnostics.
baseDirectory relative paths resolve against.
Returns
Parsed training specification.
Exceptions
ErrorIf required keys are missing or values invalid.
TrainSpec load_train(const std::filesystem::path &path)Reads, parses, and validates the train configuration file.
Parameters
pathPath to train configuration file.
Returns
Parsed training specification.
Exceptions
ErrorIf the file cannot be read or parsed.
DataSpec parse_data(const Value &root, std::string_view origin)Turns a parsed data document into a DataSpec.
Parameters
rootThe parsed document.
originWhat to call it in a diagnostic, usually a path.
Returns
The spec.
Exceptions
ErrorIf the version is absent or wrong, or a key is unknown.
DataSpec load_data(const std::filesystem::path &path)Reads, parses and validates the data file at path.
Parameters
pathThe file to read.
Returns
The spec.
Exceptions
ErrorIf the file cannot be read, is not valid JSON, or is not a valid data document.
std::string_view kind_name(Kind kind) noexceptA printable name for kind, for a diagnostic.
Parameters
kindThe kind to name.
Returns
A null-terminated literal owned by the library; never null.
void require_version(const Value &root, std::string_view key, std::int64_t expected, std::string_view origin)Validates document version field against expected version.
Parameters
rootDocument root configuration object.
keyVersion property key name.
expectedExpected integer version identifier.
originOrigin context description for diagnostics.
Exceptions
ErrorIf version property is missing or mismatched.
Value parse_json(std::string_view text, std::string_view origin)Parses text as a JSON document.
Parameters
textThe document.
originWhat to call it in a diagnostic, usually a path.
Returns
The parsed tree.
Exceptions
ErrorIf
textis not valid JSON; namesoriginand the parser's own complaint.
Value parse_json_file(const std::filesystem::path &path)Reads and parses the file at path.
Parameters
pathThe file to read.
Returns
The parsed tree.
Exceptions
ErrorIf the file cannot be read, or is not valid JSON.

