SimGrid
3.12
Versatile Simulation of Distributed Systems
|
Changing the configuration of SimGrid components (grounding feature) More...
Modules | |
User interface: changing values | |
Configuration type declaration and memory management | |
Registering stuff | |
Getting the stored values | |
Changing the configuration of SimGrid components (grounding feature)
All modules of the SimGrid toolkit can be configured with this API. User modules and libraries can also use these facilities to handle their own configuration.
A configuration set contain several variables which have a unique name in the set and can take a given type of value. For example, it may contain a size variable, accepting int values.
It is impossible to set a value to a variable which has not been registered before. Usually, the module registers all the options it accepts in the configuration set, during its initialization and user code then set and unset values.
The easiest way to register a variable is to use the xbt_str_register_str function, which accepts a string representation of the config element descriptor. The syntax is the following:
<name>:<min nb>_to_<max nb>_<type>
For example, size:1_to_1_int
describes a variable called size which must take exactly one value, and the value being an integer. Set the maximum to 0 to disable the upper bound on data count.
Another example could be outputfiles:0_to_10_string
which describes a variable called outputfiles and which can take between 0 and 10 strings as value.
To some extend, configuration sets can be seen as typed hash structures.
First, let's create a configuration set with some registered variables. This must be done by the configurable library before the user interactions.
Now, set and get a single value
And now, set and get a multiple value
All those functions throws mismatch_error if asked to deal with an unregistered variable.