SimGrid  3.18
Versatile Simulation of Distributed Systems
config.cpp File Reference
#include <cstdio>
#include <algorithm>
#include <cerrno>
#include <cstring>
#include <climits>
#include <functional>
#include <map>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <typeinfo>
#include <vector>
#include <xbt/ex.hpp>
#include <xbt/config.h>
#include <xbt/config.hpp>
#include "xbt/misc.h"
#include "xbt/sysdep.h"
#include "xbt/log.h"
#include "xbt/dynar.h"

Classes

class  simgrid::config::Config
 

Namespaces

 simgrid
 Alltoall Bruck.
 
 simgrid::config
 

Macros

#define TRANSLATE_EXCEPTIONS(...)
 

Functions

 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (xbt_cfg, xbt, "configuration support")
 
void sg_config_finalize ()
 
template<class T >
T const & simgrid::config::getConfig (const char *name)
 
template int const & simgrid::config::getConfig< int > (const char *name)
 
template double const & simgrid::config::getConfig< double > (const char *name)
 
template bool const & simgrid::config::getConfig< bool > (const char *name)
 
template std::string const & simgrid::config::getConfig< std::string > (const char *name)
 
void simgrid::config::alias (const char *realname, const char *aliasname)
 
template<class T >
void simgrid::config::declareFlag (const char *name, const char *description, T value, std::function< void(const T &)> callback=std::function< void(const T &)>())
 Register a configuration flag. More...
 
template void simgrid::config::declareFlag (const char *name, const char *description, int value, std::function< void(int const &)> callback)
 
template void simgrid::config::declareFlag (const char *name, const char *description, double value, std::function< void(double const &)> callback)
 
template void simgrid::config::declareFlag (const char *name, const char *description, bool value, std::function< void(bool const &)> callback)
 
template void simgrid::config::declareFlag (const char *name, const char *description, std::string value, std::function< void(std::string const &)> callback)
 
xbt_cfg_t xbt_cfg_new ()
 
void xbt_cfg_free (xbt_cfg_t *cfg)
 
void xbt_cfg_dump (const char *name, const char *indent, xbt_cfg_t cfg)
 
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 *realname, const char *aliasname)
 
void xbt_cfg_aliases ()
 
void xbt_cfg_help ()
 
void xbt_cfg_set_parse (const char *options)
 Add values parsed from a string into a config set. More...
 
void xbt_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 *key, int value)
 Set an integer value to name within cfg if it wasn't changed yet. More...
 
void xbt_cfg_setdefault_double (const char *key, double value)
 Set an integer value to name within cfg if it wasn't changed yet. More...
 
void xbt_cfg_setdefault_string (const char *key, const char *value)
 Set a string value to name within cfg if it wasn't changed yet. More...
 
void xbt_cfg_setdefault_boolean (const char *key, const char *value)
 Set an boolean value to name within cfg if it wasn't changed yet. More...
 
void xbt_cfg_set_int (const char *key, int value)
 Set an integer value to name within cfg. More...
 
void xbt_cfg_set_double (const char *key, double value)
 Set or add a double value to name within cfg. More...
 
void xbt_cfg_set_string (const char *key, const char *value)
 Set or add a string value to name within cfg. More...
 
void xbt_cfg_set_boolean (const char *key, const char *value)
 Set or add a boolean value to name within cfg. More...
 
int xbt_cfg_is_default_value (const char *key)
 Return if configuration is set by default. More...
 
int xbt_cfg_get_int (const char *key)
 Retrieve an integer value of a variable (get a warning if not uniq) More...
 
double xbt_cfg_get_double (const char *key)
 Retrieve a double value of a variable (get a warning if not uniq) More...
 
std::string xbt_cfg_get_string (const char *key)
 Retrieve a string value of a variable (get a warning if not uniq) More...
 
int xbt_cfg_get_boolean (const char *key)
 Retrieve a boolean value of a variable (get a warning if not uniq) More...
 

Variables

xbt_cfg_t simgrid_config = nullptr
 

Macro Definition Documentation

◆ TRANSLATE_EXCEPTIONS

#define TRANSLATE_EXCEPTIONS (   ...)
Value:
catch(simgrid::config::missing_key_error& e) { THROWF(not_found_error, 0, __VA_ARGS__); abort(); } \
catch(...) { THROWF(not_found_error, 0, __VA_ARGS__); abort(); }
Definition: config.hpp:26
#define THROWF(c, v,...)
Builds and throws an exception with a printf-like formatted message.
Definition: ex.h:108
The searched element was not found.
Definition: ex.h:73

Function Documentation

◆ XBT_LOG_NEW_DEFAULT_SUBCATEGORY()

XBT_LOG_NEW_DEFAULT_SUBCATEGORY ( xbt_cfg  ,
xbt  ,
"configuration support"   
)

◆ sg_config_finalize()

void sg_config_finalize ( )

◆ xbt_cfg_get_string()

std::string xbt_cfg_get_string ( const char *  key)

Retrieve a string value of a variable (get a warning if not uniq)

Parameters
keythe name of the variable

Returns the first value from the config set under the given name. If there is more than one value, it will issue a warning. Returns nullptr if there is no value.

Warning
the returned value is the actual content of the config set

Variable Documentation

◆ simgrid_config

xbt_cfg_t simgrid_config = nullptr

◆ type_name

constexpr const char* type_name = "int"
static

◆ old_callback

xbt_cfg_cb_t old_callback = nullptr