ConfigParser

class Kilosim::ConfigParser

A ConfigParser is used to parse and process JSON configuration files for user-provided simulation management. It also provides an option to directly save all parameters to the Logger HDF5 file (for consolidation).

Public Functions

ConfigParser(std::string config_file)

Create a parser to handle the values in the given JSON file.

This will automatically load the contents into the parser

Parameters

config_file – Name/location of JSON file for config.

json get(const std::string val_name) const

Get a value from the configuration by name.

This can be automatically cast to the native type by defining the type on the returned value. For example, int my_val = config.get("key_to_int_val"); will cast the output to an integer. If you use auto, I think you’ll get back the json type. Alternatively, you can directly pass the output to a function taking the relevant type without needing to explicitly specify the type.

Parameters

val_name – Name/key to get the value for

Returns

Wrapped output value. Use .type_name() to get the type