Changing TDRP parameters from within a program

Changing non-string parameters

You may set any of the following parameter types directly from within a program: Also, any struct fields of these types may be set directly.

Changing string parameters

To change the vale of a string parameter, use TDRP_str_replace().

For example, if params points to the struct of parameters defined in paramdef.example, you could do:

  TDRP_str_replace(¶ms.input_file_ext, "dob");
  TDRP_str_replace(¶ms._input_file_paths[1],
		   "New_file_path");
  TDRP_str_replace(¶ms._data_field[1].name, "Spectral width");
  TDRP_str_replace(¶ms._data_field[2].name, "Signal-to-noise");
  TDRP_str_replace(¶ms._data_field[2].units, "dB");

Changing array sizes

You should not realloc TDRP array pointers directly. Rather, you should use the realloc functions provided in the API:
Using C API:
_tdrp_array_realloc()
_tdrp_array2D_realloc()

Using C++ API:
Params::arrayRealloc()
Params::array2DRealloc()

Using Old C API:
TDRP_array_realloc()
TDRP_array2D_realloc()

For example, if params points to the struct of parameters defined in paramdef.example, you could, using the C API, do:

  _tdrp_array_realloc("our_ages", 7);
  _tdrp_array_realloc("data_field", 3);
  _tdrp_array2D_realloc("rain_accumulation", 6, 8);
  _tdrp_array2D_realloc("output_file_paths", 4, 3);
After changing parameters inside a program, it is possible to save that parameter state out to a file.