-/* Copyright (c) 2006-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2006-2021. 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/sg_config.hpp"
#include "src/surf/surf_interface.hpp"
+#include <array>
+
XBT_LOG_NEW_CATEGORY(sd, "Logging specific to SimDag");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_kernel, sd, "Logging specific to SimDag (kernel)");
SD_task_set_state(task, SD_DONE);
/* the state has changed. Add it only if it's the first change */
- if (sd_global->return_set.find(task) == sd_global->return_set.end())
- sd_global->return_set.insert(task);
+ sd_global->return_set.emplace(task);
/* remove the dependencies after this task */
for (auto const& succ : *task->successors) {
* @return the equivalent as a readable string
*/
const char *__get_state_name(e_SD_task_state_t state){
- static std::string state_names[7] =
- { "not scheduled", "schedulable", "scheduled", "runnable","running", "done", "failed" };
- return state_names[static_cast<int>(log2(static_cast<double>(state)))].data();
+ static constexpr std::array<const char*, 7> state_names{
+ {"not scheduled", "schedulable", "scheduled", "runnable", "running", "done", "failed"}};
+ return state_names.at(static_cast<int>(log2(static_cast<double>(state))));
}
/**