simgrid::kernel::routing::NetPoint* netpoint_by_name_or_null(std::string name);
simgrid::s4u::NetZone* get_netzone_root();
+ void set_netzone_root(s4u::NetZone* netzone);
simgrid::s4u::NetZone* netzone_by_name_or_null(const char* name);
*/
void set_config(std::string str);
- simgrid::kernel::EngineImpl* pimpl;
-
private:
+ simgrid::kernel::EngineImpl* pimpl;
static s4u::Engine* instance_;
//////////////// Deprecated functions
{
return pimpl->netzone_root_;
}
+/** @brief Set the root netzone, containing all others. Once set, it cannot be changed. */
+void Engine::set_netzone_root(s4u::NetZone* netzone)
+{
+ xbt_assert(pimpl->netzone_root_ == nullptr, "The root NetZone cannot be changed once set");
+ pimpl->netzone_root_ = static_cast<kernel::routing::NetZoneImpl*>(netzone);
+}
static s4u::NetZone* netzone_by_name_recursive(s4u::NetZone* current, const char* name)
{
}
if (current_routing == nullptr) { /* it is the first one */
- xbt_assert(simgrid::s4u::Engine::get_instance()->pimpl->netzone_root_ == nullptr,
- "All defined components must belong to a networking zone.");
- simgrid::s4u::Engine::get_instance()->pimpl->netzone_root_ = new_zone;
-
+ simgrid::s4u::Engine::get_instance()->set_netzone_root(new_zone);
} else {
/* set the father behavior */
if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)