SimGrid: User interface: changing values

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
Typedefs | Functions
User interface: changing values
Configuration support

## Typedefs
typedef void * | xbt_cfg_t
| Configuration set's data type is opaque.

## Functions
void | xbt_cfg_set (xbt_cfg_t cfg, const char *name,...)
| Add a NULL-terminated list of pairs {(char*)key, value} to the set.
void | xbt_cfg_set_vargs (xbt_cfg_t cfg, const char *name, va_list pa)
| va_args version of xbt_cfg_set
void | xbt_cfg_set_parse (xbt_cfg_t cfg, const char *options)
| Add values parsed from a string into a config set.
void | xbt_cfg_set_int (xbt_cfg_t cfg, const char *name, int val)
| Set or add an integer value to name within cfg.
void | xbt_cfg_set_double (xbt_cfg_t cfg, const char *name, double val)
| Set or add a double value to name within cfg.
void | xbt_cfg_set_string (xbt_cfg_t cfg, const char *name, const char *val)
| Set or add a string value to name within cfg.
void | xbt_cfg_set_boolean (xbt_cfg_t cfg, const char *name, const char *val)
| Set or add a boolean value to name within cfg.
void | xbt_cfg_set_peer (xbt_cfg_t cfg, const char *name, const char *peer, int port)
| Set or add an peer value to name within cfg.
void * | xbt_cfg_set_as_string (xbt_cfg_t cfg, const char *name, const char *val)
| Set the value of a variable, using the string representation of that value.
void | xbt_cfg_setdefault_int (xbt_cfg_t cfg, const char *name, int val)
| Set an integer value to name within cfg if it wasn't changed yet.
void | xbt_cfg_setdefault_double (xbt_cfg_t cfg, const char *name, double val)
| Set an integer value to name within cfg if it wasn't changed yet.
void | xbt_cfg_setdefault_string (xbt_cfg_t cfg, const char *name, const char *val)
| Set a string value to name within cfg if it wasn't changed yet.
void | xbt_cfg_setdefault_boolean (xbt_cfg_t cfg, const char *name, const char *val)
| Set an boolean value to name within cfg if it wasn't changed yet.
void | xbt_cfg_setdefault_peer (xbt_cfg_t cfg, const char *name, const char *host, int port)
| Set a peer value to name within cfg if it wasn't changed yet.
void | xbt_cfg_rm_int (xbt_cfg_t cfg, const char *name, int val)
| Remove the provided val integer value from a variable.
void | xbt_cfg_rm_double (xbt_cfg_t cfg, const char *name, double val)
| Remove the provided val double value from a variable.
void | xbt_cfg_rm_string (xbt_cfg_t cfg, const char *name, const char *val)
| Remove the provided val string value from a variable.
void | xbt_cfg_rm_boolean (xbt_cfg_t cfg, const char *name, int val)
| Remove the provided val boolean value from a variable.
void | xbt_cfg_rm_peer (xbt_cfg_t cfg, const char *name, const char *peer, int port)
| Remove the provided val peer value from a variable.
void | xbt_cfg_rm_at (xbt_cfg_t cfg, const char *name, int pos)
| Remove the pos th value from the provided variable.
void | xbt_cfg_empty (xbt_cfg_t cfg, const char *name)
| Remove all the values from a variable.

## Detailed Description

This is the only interface you should use unless you want to let your own code become configurable with this.

If the variable accept at most one value, those functions replace the current value with the provided one. If max>1, the provided value is appended to the list.

string values are strdup'ed before use, so you can (and should) free your copy

## Function Documentation

void xbt_cfg_set | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  |  | ...
| ) |  |

Add a NULL-terminated list of pairs {(char*)key, value} to the set.

Parameters

  cfg | config set to fill
  name | variable name
  ... | variable value

void xbt_cfg_set_vargs | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | va_list | pa
| ) |  |

va_args version of xbt_cfg_set

Parameters

  cfg | config set to fill
  name | variable name
  pa | variable value

Add some values to the config set.

void xbt_cfg_set_parse | ( | xbt_cfg_t | cfg,
|  | const char * | options
| ) |  |

Add values parsed from a string into a config set.

Parameters

  cfg | config set to fill
  options | a string containing the content to add to the config set. This is a '\t',' ' or '\n' or ',' separated list of variables. Each individual variable is like "[name]:[value]" where [name] is the name of an already registred variable, and [value] conforms to the data type under which this variable was registred.

void xbt_cfg_set_int | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | int | val
| ) |  |

Set or add an integer value to name within cfg.

Parameters

  cfg | the config set
  name | the name of the variable
  val | the value of the variable

void xbt_cfg_set_double | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | double | val
| ) |  |

Set or add a double value to name within cfg.

Parameters

  cfg | the config set
  name | the name of the variable
  val | the doule to set

void xbt_cfg_set_string | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | const char * | val
| ) |  |

Set or add a string value to name within cfg.

Parameters

  cfg | the config set
  name | the name of the variable
  val | the value to be added

void xbt_cfg_set_boolean | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | const char * | val
| ) |  |

Set or add a boolean value to name within cfg.

Parameters

  cfg | the config set
  name | the name of the variable
  val | the value of the variable

void xbt_cfg_set_peer | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | const char * | peer,
|  | int | port
| ) |  |

Set or add an peer value to name within cfg.

Parameters

  cfg | the config set
  name | the name of the variable
  peer | the peer
  port | the port number

peer values are composed of a string (peername) and an integer (port)

void* xbt_cfg_set_as_string | ( | xbt_cfg_t | cfg,
|  | const char * | key,
|  | const char * | value
| ) |  |

Set the value of a variable, using the string representation of that value.

Parameters

  cfg | config set to modify
  key | name of the variable to modify
  value | string representation of the value to set

Returns
  the first char after the parsed value in val

void xbt_cfg_setdefault_int | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | int | val
| ) |  |

Set an integer value to name within cfg if it wasn't changed yet.

This is useful to change the default value of a variable while allowing users to override it with command line arguments

void xbt_cfg_setdefault_double | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | double | val
| ) |  |

Set an integer value to name within cfg if it wasn't changed yet.

This is useful to change the default value of a variable while allowing users to override it with command line arguments

void xbt_cfg_setdefault_string | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | const char * | val
| ) |  |

Set a string value to name within cfg if it wasn't changed yet.

This is useful to change the default value of a variable while allowing users to override it with command line arguments

void xbt_cfg_setdefault_boolean | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | const char * | val
| ) |  |

Set an boolean value to name within cfg if it wasn't changed yet.

This is useful to change the default value of a variable while allowing users to override it with command line arguments

void xbt_cfg_setdefault_peer | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | const char * | host,
|  | int | port
| ) |  |

Set a peer value to name within cfg if it wasn't changed yet.

This is useful to change the default value of a variable while allowing users to override it with command line arguments

void xbt_cfg_rm_int | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | int | val
| ) |  |

Remove the provided val integer value from a variable.

Parameters

  cfg | the config set
  name | the name of the variable
  val | the value to be removed

void xbt_cfg_rm_double | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | double | val
| ) |  |

Remove the provided val double value from a variable.

Parameters

  cfg | the config set
  name | the name of the variable
  val | the value to be removed

void xbt_cfg_rm_string | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | const char * | val
| ) |  |

Remove the provided val string value from a variable.

Parameters

  cfg | the config set
  name | the name of the variable
  val | the value of the string which will be removed

void xbt_cfg_rm_boolean | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | int | val
| ) |  |

Remove the provided val boolean value from a variable.

Parameters

  cfg | the config set
  name | the name of the variable
  val | the value to be removed

void xbt_cfg_rm_peer | ( | xbt_cfg_t | cfg,
|  | const char * | name,
|  | const char * | peer,
|  | int | port
| ) |  |

Remove the provided val peer value from a variable.

Parameters

  cfg | the config set
  name | the name of the variable
  peer | the peername
  port | the port number

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

Remove all the values from a variable.

Parameters

  cfg | the config set
  name | the name of the variable