Class ModelConfig
JSON-backed model configuration that stores controller mode and constants under a dotted-key hierarchy (e.g., "calib.mode", "constants.PModeProportional"). Provides typed access helpers via DictConfigBase.
Inherited Members
Namespace: Wss.ModelModule
Assembly: WSS_Core_Interface.dll
Syntax
public sealed class ModelConfig : DictConfigBase
Constructors
ModelConfig(string)
Initializes a model configuration backed by the JSON file at path.
Creates the file with defaults when missing.
Declaration
public ModelConfig(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | Destination file path. |
Methods
GetModeRequired()
Gets the required calibration mode from key "calib.mode". Throws if missing.
Declaration
public string GetModeRequired()
Returns
| Type | Description |
|---|---|
| string |
GetOrDefault<T>(string, T)
Returns the value at key or a default when missing.
Declaration
public T GetOrDefault<T>(string key, T dflt = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | Dotted key path. |
| T | dflt | Fallback value when the key is absent. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | Target type. |
GetRequired<T>(string)
Gets a required value at key. Throws if missing or invalid.
Declaration
public T GetRequired<T>(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | Dotted key path. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | Target type. |
Exceptions
| Type | Condition |
|---|---|
| KeyNotFoundException | When the key is not present. |
TryGet<T>(string, out T)
Attempts to read a value at key and convert it to T.
Declaration
public bool TryGet<T>(string key, out T value) where T : notnull
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | Dotted key path. |
| T | value | Result when conversion succeeds. |
Returns
| Type | Description |
|---|---|
| bool |
|
Type Parameters
| Name | Description |
|---|---|
| T | Target type (non-nullable). |