s4u::Engine::on_platform_created_cb([]() {
/* Create the ns3 topology based on routing strategy */
- ns3::GlobalRouteManager::DeleteGlobalRoutes(); // just in case this callback is called twice
+ xbt_assert(not ns3_is_initialized, "ns-3 initialized twice.");
ns3::GlobalRouteManager::BuildGlobalRoutingDatabase();
ns3::GlobalRouteManager::InitializeRoutes();
ns3_is_initialized = true;
XBT_PUBLIC double simgrid_parse_get_double(const std::string& s);
XBT_PUBLIC int simgrid_parse_get_int(const std::string& s);
-XBT_PUBLIC void simgrid_parse(); /* Entry-point to the parser */
+XBT_PUBLIC void simgrid_parse(bool fire_on_platform_created_callback); /* Entry-point to the parser */
XBT_PUBLIC void parse_platform_file(const std::string& file);
#endif
std::string simgrid_parsed_filename; // Currently parsed file (for the error messages)
static std::vector<simgrid::s4u::LinkInRoute> parsed_link_list; /* temporary store of current link list of a route */
+static bool fire_on_platform_created_callback;
+
/* Helping functions */
void simgrid_parse_assert(bool cond, const std::string& msg)
{
}
void ETag_simgrid_parse_platform()
{
- simgrid::s4u::Engine::on_platform_created();
+ if (fire_on_platform_created_callback)
+ simgrid::s4u::Engine::on_platform_created();
}
void STag_simgrid_parse_prop()
}
/* Call the lexer to parse the currently opened file */
-void simgrid_parse()
+void simgrid_parse(bool fire_on_platform_created_callback_param)
{
+ fire_on_platform_created_callback = fire_on_platform_created_callback_param;
bool err = simgrid_parse_lex();
simgrid_parse_assert(not err, "Flex returned an error code");