-/* Copyright (c) 2004-2022. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004-2023. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include "simgrid/Exception.hpp"
+#include "src/simgrid/sg_config.hpp"
+#include "xbt/dynar.h"
+#include "xbt/log.h"
+#include "xbt/misc.h"
+#include "xbt/sysdep.h"
+#include <xbt/config.h>
+#include <xbt/config.hpp>
+
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
-#include "simgrid/Exception.hpp"
-#include "simgrid/sg_config.hpp"
-#include "xbt/dynar.h"
-#include "xbt/log.h"
-#include "xbt/misc.h"
-#include "xbt/sysdep.h"
-#include <xbt/config.h>
-#include <xbt/config.hpp>
-
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support");
-XBT_EXPORT_NO_IMPORT xbt_cfg_t simgrid_config = nullptr;
+xbt_cfg_t simgrid_config = nullptr;
-namespace simgrid {
-namespace config {
+namespace simgrid::config {
namespace {
template <> class ConfigType<std::string> {
public:
static constexpr const char* type_name = "string";
- static inline std::string parse(const char* value)
- {
- return std::string(value);
- }
+ static inline std::string parse(const char* value) { return value; }
};
template <> class ConfigType<bool> {
public:
std::string val = name.substr(pos + 1);
name.erase(pos);
- const std::string path("path");
- if (name.compare(0, path.length(), path) != 0)
+ if (name.rfind("path", 0) != 0)
XBT_INFO("Configuration change: Set '%s' to '%s'", name.c_str(), val.c_str());
set_as_string(name.c_str(), val);
{
simgrid_config->help();
}
-}
-}
+} // namespace simgrid::config
/*----[ Setting ]---------------------------------------------------------*/