SimGrid: Registering stuff

SimGrid 3.10 Versatile Simulation of Distributed Systems

- Home page
- Online documentation
- Dev's Corner

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Registering stuff
Configuration support

## Functions
void | xbt_cfg_register (xbt_cfg_t *cfg, const char *name, const char *description, e_xbt_cfgelm_type_t type, int min, int max, xbt_cfg_cb_t cb_set, xbt_cfg_cb_t cb_rm)
| Register an element within a config set.
void | xbt_cfg_unregister (xbt_cfg_t cfg, const char *name)
| Unregister an element from a config set.
void | xbt_cfg_register_str (xbt_cfg_t *cfg, const char *entry)
| Parse a string and register the stuff described.
void | xbt_cfg_help (xbt_cfg_t cfg)
| Displays the declared options and their description.
void | xbt_cfg_check (xbt_cfg_t cfg)
| Check that each variable have the right amount of values.
e_xbt_cfgelm_type_t | xbt_cfg_get_type (xbt_cfg_t cfg, const char *name)
| Get the type of this variable in that configuration set.

## Detailed Description

This how to add new variables to an existing configuration set. Use it to make your code configurable.

## Function Documentation

void xbt_cfg_register | ( | xbt_cfg_t * | cfg,
|  | const char * | name,
|  | const char * | desc,
|  | e_xbt_cfgelm_type_t | type,
|  | int | min,
|  | int | max,
|  | xbt_cfg_cb_t | cb_set,
|  | xbt_cfg_cb_t | cb_rm
| ) |  |

Register an element within a config set.

Parameters

  cfg | the config set
  name | the name of the config element
  desc | a description for this item (used by xbt_cfg_help())
  type | the type of the config element
  min | the minimum number of values for this config element
  max | the maximum number of values for this config element
  cb_set | callback function called when a value is set
  cb_rm | callback function called when a value is removed

void xbt_cfg_unregister | ( | xbt_cfg_t | cfg,
|  | const char * | name
| ) |  |

Unregister an element from a config set.

Parameters

  cfg | the config set
  name | the name of the elem to be freed

Note that it removes both the description and the actual content. Throws not_found when no such element exists.

void xbt_cfg_register_str | ( | xbt_cfg_t * | cfg,
|  | const char * | entry
| ) |  |

Parse a string and register the stuff described.

Parameters

  cfg | the config set
  entry | a string describing the element to register

The string may consist in several variable descriptions separated by a space. Each of them must use the following syntax: <name>:<min nb>_to_<max nb>_<type> with type being one of 'string','int', 'peer' or 'double'.

FIXME: this does not allow to set the description

e_xbt_cfgelm_type_t xbt_cfg_get_type | ( | xbt_cfg_t | cfg,
|  | const char * | name
| ) |  |

Get the type of this variable in that configuration set.

Parameters

  cfg | the config set
  name | the name of the element

Returns
  the type of the given element