namespace simgrid {
namespace config {
-missing_key_error::~missing_key_error() = default;
-
namespace {
const char* true_values[] = {
Config& operator=(Config const&) = delete;
ConfigurationElement& operator[](const char* name);
- template<class T>
- TypedConfigurationElement<T>& getTyped(const char* name);
void alias(const char* realname, const char* aliasname);
template<class T, class... A>
fflush(stdout);
}
-/** @brief Displays the declared aliases and their description */
+/** @brief Displays the declared aliases and their replacement */
void Config::showAliases()
{
- bool old_warn_for_aliases = false;
- std::swap(warn_for_aliases, old_warn_for_aliases);
for (auto const& elm : aliases)
- printf(" %s: %s\n", elm.first.c_str(), (*this)[elm.first.c_str()].getDescription().c_str());
- std::swap(warn_for_aliases, old_warn_for_aliases);
+ printf(" %-40s %s\n", elm.first.c_str(), elm.second->getKey().c_str());
}
/** @brief Displays the declared options and their description */
// ***** alias *****
-void alias(const char* realname, const char* aliasname)
+void alias(const char* realname, std::initializer_list<const char*> aliases)
{
- simgrid_config->alias(realname, aliasname);
+ for (auto const& aliasname : aliases)
+ simgrid_config->alias(realname, aliasname);
}
// ***** declareFlag *****
{
simgrid_config = nullptr;
xbt_log_threshold_set(&_XBT_LOGV(xbt_cfg), xbt_log_priority_critical);
- xbt_cfg_register_int("speed", 0, nullptr, "");
- xbt_cfg_register_string("peername", "", nullptr, "");
- xbt_cfg_register_string("user", "", nullptr, "");
+ simgrid::config::declareFlag<int>("speed", "description", 0);
+ simgrid::config::declareFlag<std::string>("peername", "description", "");
+ simgrid::config::declareFlag<std::string>("user", "description", "");
} /* end_of_make_set */
XBT_TEST_UNIT("memuse", test_config_memuse, "Alloc and free a config set")