Parameter file
Just to summarize the discussion we had on Thursday. Here are some basic specs for the parameter file:
- Use YAML (https://fr.wikipedia.org/wiki/YAML) as a format
- Should handle categories for clarity
- Should handle comments
- Should handle different types (int, float, strings)
In a second step, we would like to be able to handle
- Small arrays of numbers (e.g. coefficients of a kernel)
- Units
An example interface would be:
swift_param* param_file;
/* Read the file and check for formatting errors */
/* Constructs a list key-value-type in memory that */
/* can later be queried */
param_file = file_read("C:/MyDocuments/eagle_param.yml");
/* Returns the value 'n_threads' from the category */
/* 'engine' that should be an integer */
/* Dies if the value read wasn't an integer */
/* Dies if compulsory parameters are absent */
int num_threads = file_get(param_file, "engine/n_threads", param_type_int);
Any other ideas or suggestions ?