SimGrid  3.13
Versatile Simulation of Distributed Systems
config.cpp File Reference
#include <stdio.h>
#include <cerrno>
#include <cstring>
#include <climits>
#include <functional>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <xbt/config.h>
#include <xbt/config.hpp>
#include "xbt/misc.h"
#include "xbt/sysdep.h"
#include "xbt/log.h"
#include "xbt/ex.h"
#include "xbt/dynar.h"
#include "xbt/dict.h"

Classes

struct  s_xbt_cfgelm_t
 

Namespaces

 simgrid
 
 simgrid::config
 

Typedefs

typedef struct s_xbt_cfgelm_t s_xbt_cfgelm_t
 
typedef struct s_xbt_cfgelm_txbt_cfgelm_t
 

Functions

 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (xbt_cfg, xbt,"configuration support")
 
static void xbt_cfgelm_free (void *data)
 
static xbt_cfgelm_t xbt_cfgelm_get (xbt_cfg_t cfg, const char *name, e_xbt_cfgelm_type_t type)
 
xbt_cfg_t xbt_cfg_new (void)
 Constructor. More...
 
void xbt_cfg_free (xbt_cfg_t *cfg)
 Destructor. More...
 
void xbt_cfg_dump (const char *name, const char *indent, xbt_cfg_t cfg)
 Dump a config set for debuging purpose. More...
 
static void xbt_cfg_register (xbt_cfg_t *cfg, const char *name, const char *desc, e_xbt_cfgelm_type_t type, xbt_cfg_cb_t cb_set, std::function< void(const char *value)> callback=std::function< void(const char *value)>())
 Register an element within a config set. More...
 
void xbt_cfg_register_double (const char *name, double default_value, xbt_cfg_cb_t cb_set, const char *desc)
 
void xbt_cfg_register_int (const char *name, int default_value, xbt_cfg_cb_t cb_set, const char *desc)
 
void xbt_cfg_register_string (const char *name, const char *default_value, xbt_cfg_cb_t cb_set, const char *desc)
 
void xbt_cfg_register_boolean (const char *name, const char *default_value, xbt_cfg_cb_t cb_set, const char *desc)
 
void xbt_cfg_register_alias (const char *newname, const char *oldname)
 
void xbt_cfg_register_str (xbt_cfg_t *cfg, const char *entry)
 Parse a string and register the stuff described. More...
 
void xbt_cfg_aliases (void)
 Displays the declared aliases and their description. More...
 
void xbt_cfg_help (void)
 Displays the declared options and their description. More...
 
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. More...
 
void xbt_cfg_set_vargs (xbt_cfg_t cfg, const char *name, va_list pa)
 va_args version of xbt_cfg_set More...
 
void xbt_cfg_set (xbt_cfg_t cfg, const char *name,...)
 Add a NULL-terminated list of pairs {(char*)key, value} to the set. More...
 
void xbt_cfg_set_parse (const char *options)
 Add values parsed from a string into a config set. More...
 
voidxbt_cfg_set_as_string (const char *key, const char *value)
 Set the value of a variable, using the string representation of that value. More...
 
void xbt_cfg_setdefault_int (const char *name, int val)
 Set an integer value to name within cfg if it wasn't changed yet. More...
 
void xbt_cfg_setdefault_double (const char *name, double val)
 Set an integer value to name within cfg if it wasn't changed yet. More...
 
void xbt_cfg_setdefault_string (const char *name, const char *val)
 Set a string value to name within cfg if it wasn't changed yet. More...
 
void xbt_cfg_setdefault_boolean (const char *name, const char *val)
 Set an boolean value to name within cfg if it wasn't changed yet. More...
 
void xbt_cfg_set_int (const char *name, int val)
 Set an integer value to name within cfg. More...
 
void xbt_cfg_set_double (const char *name, double val)
 Set or add a double value to name within cfg. More...
 
void xbt_cfg_set_string (const char *name, const char *val)
 Set or add a string value to name within cfg. More...
 
void xbt_cfg_set_boolean (const char *name, const char *val)
 Set or add a boolean value to name within cfg. More...
 
int xbt_cfg_is_default_value (const char *name)
 Return if configuration is set by default. More...
 
int xbt_cfg_get_int (const char *name)
 Retrieve an integer value of a variable (get a warning if not uniq) More...
 
double xbt_cfg_get_double (const char *name)
 Retrieve a double value of a variable (get a warning if not uniq) More...
 
char * xbt_cfg_get_string (const char *name)
 Retrieve a string value of a variable (get a warning if not uniq) More...
 
int xbt_cfg_get_boolean (const char *name)
 Retrieve a boolean value of a variable (get a warning if not uniq) More...
 
bool simgrid::config::parseBool (const char *value)
 
double simgrid::config::parseDouble (const char *value)
 
long int simgrid::config::parseLong (const char *value)
 
void simgrid::config::declareFlag (const char *name, const char *description, std::function< void(const char *value)> callback)
 Register a configuration flag. More...
 

Variables

xbt_cfg_t simgrid_config = NULL
 
static const char * xbt_cfgelm_type_name [xbt_cfgelm_type_count] = { "int", "double", "string", "boolean", "any", "outofbound" }
 
const struct xbt_boolean_couple xbt_cfgelm_boolean_values []
 

Typedef Documentation

typedef struct s_xbt_cfgelm_t * xbt_cfgelm_t

Function Documentation

XBT_LOG_NEW_DEFAULT_SUBCATEGORY ( xbt_cfg  ,
xbt  ,
"configuration support"   
)
static void xbt_cfgelm_free ( void data)
static
static xbt_cfgelm_t xbt_cfgelm_get ( xbt_cfg_t  cfg,
const char *  name,
e_xbt_cfgelm_type_t  type 
)
static
static void xbt_cfg_register ( xbt_cfg_t cfg,
const char *  name,
const char *  desc,
e_xbt_cfgelm_type_t  type,
xbt_cfg_cb_t  cb_set,
std::function< void(const char *value)>  callback = std::function<void(const char* value)>() 
)
static

Register an element within a config set.

Parameters
cfgthe config set
namethe name of the config element
desca description for this item (used by xbt_cfg_help())
typethe type of the config element
cb_setcallback function called when a value is set

Variable Documentation

xbt_cfg_t simgrid_config = NULL
const char* xbt_cfgelm_type_name[xbt_cfgelm_type_count] = { "int", "double", "string", "boolean", "any", "outofbound" }
static
const struct xbt_boolean_couple xbt_cfgelm_boolean_values[]
Initial value:
= {
{ "yes", "no"},
{ "on", "off"},
{"true", "false"},
{ "1", "0"},
{ NULL, NULL}
}