X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e22da6010c6499813ff88c76041cf499ffbf2b67..64e7e8c55cb98ef667ebe13284e1a215fe1a8862:/src/surf/surf_interface.cpp diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index ba953e9221..06d25b6612 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -3,17 +3,16 @@ /* 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 "surf_interface.hpp" +#include +#include + #include "mc/mc.h" -#include "simgrid/s4u/Engine.hpp" #include "simgrid/sg_config.hpp" #include "src/kernel/resource/profile/FutureEvtSet.hpp" #include "src/kernel/resource/profile/Profile.hpp" #include "src/surf/HostImpl.hpp" -#include "src/surf/xml/platf.hpp" -#include "src/xbt_modinter.h" /* whether initialization was already done */ +#include "src/surf/surf_interface.hpp" #include "surf/surf.hpp" -#include "xbt/module.h" #include #include @@ -32,21 +31,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf, "Logging specific to SURF (ke simgrid::kernel::profile::FutureEvtSet future_evt_set; std::vector surf_path; -std::vector* surf_plugin_description = nullptr; - -static void XBT_ATTRIB_DESTRUCTOR(800) simgrid_free_plugin_description() -{ - delete surf_plugin_description; - surf_plugin_description = nullptr; -} - -XBT_PUBLIC void simgrid_add_plugin_description(const char* name, const char* description, void_f_void_t init_fun) -{ - if (not surf_plugin_description) - surf_plugin_description = new std::vector(); - surf_plugin_description->emplace_back(surf_model_description_t{name, description, init_fun}); -} - /* Don't forget to update the option description in smx_config when you change this */ const std::vector surf_network_model_description = { {"LV08", @@ -187,15 +171,13 @@ void model_help(const char* category, const std::vector& table, const std::string& name) +const surf_model_description_t* find_model_description(const std::vector& table, + const std::string& name) { auto pos = std::find_if(table.begin(), table.end(), [&name](const surf_model_description_t& item) { return item.name == name; }); if (pos != table.end()) - return static_cast(std::distance(table.begin(), pos)); - - if (table.empty()) - xbt_die("No model is valid! This is a bug."); + return &*pos; std::string sep; std::string name_list; @@ -203,27 +185,5 @@ int find_model_description(const std::vector& table, c name_list += sep + item.name; sep = ", "; } - xbt_die("Model '%s' is invalid! Valid models are: %s.", name.c_str(), name_list.c_str()); - return -1; -} - -void surf_init(int* argc, char** argv) -{ - if (xbt_initialized > 0) - return; - - xbt_init(argc, argv); - - sg_config_init(argc, argv); -} - -void surf_exit() -{ - simgrid::s4u::Engine::shutdown(); - - tmgr_finalize(); - sg_platf_exit(); - - NOW = 0; /* Just in case the user plans to restart the simulation afterward */ }