/* 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 <algorithm>
+#include <simgrid/Exception.hpp>
+#include <simgrid/s4u/Engine.hpp>
+#include <simgrid/s4u/Link.hpp>
+#include <simgrid/sg_config.hpp>
+#include <simgrid/simix.hpp>
+#include <xbt/parse_units.hpp>
-#include "simgrid/Exception.hpp"
-#include "simgrid/s4u/Engine.hpp"
-#include "simgrid/s4u/Link.hpp"
-#include "simgrid/sg_config.hpp"
-#include "simgrid/simix.hpp"
#include "src/surf/SplitDuplexLinkImpl.hpp"
#include "src/surf/network_interface.hpp"
#include "src/surf/network_wifi.hpp"
-#include "xbt/log.h"
-#include "xbt/parse_units.hpp"
namespace simgrid {
Link* Link::set_sharing_policy(Link::SharingPolicy policy, const NonLinearResourceCb& cb)
{
- if (policy == SharingPolicy::SPLITDUPLEX)
- throw std::invalid_argument(std::string("Impossible to set split-duplex for the link: ") + get_name() +
- std::string(". Use NetZone::create_split_duplex_link."));
+ if (policy == SharingPolicy::SPLITDUPLEX || policy == SharingPolicy::WIFI)
+ throw std::invalid_argument(std::string("Impossible to set wifi or split-duplex for the link: ") + get_name() +
+ std::string(". Use appropriate create function in NetZone."));
kernel::actor::simcall([this, policy, &cb] { pimpl_->set_sharing_policy(policy, cb); });
return this;
Link* Link::seal()
{
kernel::actor::simcall([this]() { this->pimpl_->seal(); });
+ s4u::Link::on_creation(*this); // notify the signal
return this;
}