Class anira::v2::JsonConfigLoader#
-
class JsonConfigLoader#
The 2.x JsonConfigLoader over the 3.x loaders: reads a version-2 document once and builds both objects, the ContextConfig (anira::ContextConfig::from_json, read back) and the InferenceConfig (ModelConfig::from_json, the one upgrade path). No leniency where 2.x logged and returned nullptr: a file that does not open is ANIRA_ERROR_NO_SUCH_FILE, malformed text, a wrong type or a word outside a vocabulary ANIRA_ERROR_JSON with the key path, a document that is not version 2 ANIRA_ERROR_CONFIG, all from the constructor. A relative model_path resolves against the document’s directory (the 3.x rule; 2.x left it to the working directory), and a backend this build lacks is kept as an entry a handler skips (2.x dropped it).
Public Functions
-
inline explicit JsonConfigLoader(const std::string &file_path)#
Relative model paths resolve against the file’s directory.
-
inline explicit JsonConfigLoader(std::istream &stream)#
Model paths as written.
-
inline std::unique_ptr<ContextConfig> get_context_config()#
The document’s context_config (the defaults without one); once: the second call returns nullptr, as in 2.x.
-
inline std::unique_ptr<InferenceConfig> get_inference_config()#
The document’s inference_config; once: the second call returns nullptr, as in 2.x.
- Throws:
Error{ANIRA_ERROR_CONFIG} – for a document that carries only a context_config.
-
inline explicit JsonConfigLoader(const std::string &file_path)#