X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/caa0dfe63257d1d3b880d0c78ac2b0a7c4c2e7c8..c8f375f14b9e04a4dd1767cb70c70b6dfc173f9c:/src/bindings/lua/lua_platf.cpp diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index ca19e544df..2316b7b321 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -7,25 +7,27 @@ #include "lua_private.hpp" #include "simgrid/kernel/routing/NetPoint.hpp" +#include "src/kernel/resource/profile/Profile.hpp" #include "src/surf/network_interface.hpp" +#include "src/surf/surf_private.hpp" #include "src/surf/xml/platf_private.hpp" -#include -#include -#include - -#include "src/surf/surf_private.hpp" #include #include #include #include + +#include +#include #include #include -XBT_LOG_NEW_DEFAULT_CATEGORY(lua_platf, "Lua bindings (platform module)"); +#include + +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua_platf, lua, "Lua bindings (platform module)"); -#define PLATF_MODULE_NAME "simgrid.engine" -#define AS_FIELDNAME "__simgrid_as" +constexpr char PLATF_MODULE_NAME[] = "simgrid.engine"; +constexpr char AS_FIELDNAME[] = "__simgrid_as"; /* ********************************************************************************* */ /* simgrid.platf API */ @@ -63,14 +65,14 @@ static simgrid::s4u::Link::SharingPolicy link_policy_get_by_name(const char* pol int console_open(lua_State*) { sg_platf_init(); - simgrid::s4u::on_platform_creation(); + simgrid::s4u::Engine::on_platform_creation(); return 0; } int console_close(lua_State*) { - simgrid::s4u::on_platform_created(); + simgrid::s4u::Engine::on_platform_created(); sg_platf_exit(); return 0; } @@ -92,7 +94,7 @@ int console_add_backbone(lua_State *L) { type = lua_gettable(L, -2); lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER, "Attribute 'bandwidth' must be specified for backbone and must either be a string (in the right format; see docs) or a number."); - link.bandwidth = surf_parse_get_bandwidth(lua_tostring(L, -1), "bandwidth of backbone", link.id.c_str()); + link.bandwidths.push_back(surf_parse_get_bandwidth(lua_tostring(L, -1), "bandwidth of backbone", link.id.c_str())); lua_pop(L, 1); lua_pushstring(L, "lat"); @@ -226,9 +228,9 @@ int console_add_link(lua_State *L) { lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER, "Attribute 'bandwidth' must be specified for any link and must either be either a string (in the right format; see docs) or a number."); if (type == LUA_TNUMBER) - link.bandwidth = lua_tonumber(L, -1); + link.bandwidths.push_back(lua_tonumber(L, -1)); else // LUA_TSTRING - link.bandwidth = surf_parse_get_bandwidth(lua_tostring(L, -1), "bandwidth of link", link.id.c_str()); + link.bandwidths.push_back(surf_parse_get_bandwidth(lua_tostring(L, -1), "bandwidth of link", link.id.c_str())); lua_pop(L, 1); //get latency value