kernel::resource::LinkImpl* Link::get_impl() const
{
- xbt_assert(
- get_sharing_policy() != SharingPolicy::SPLITDUPLEX,
- "Impossible to get a LinkImpl* from a Split-Duplex link. You should call this method to each UP/DOWN member");
auto* link_impl = dynamic_cast<kernel::resource::LinkImpl*>(pimpl_);
- xbt_assert(link_impl != nullptr);
+ xbt_assert(link_impl != nullptr, "Impossible to get a LinkImpl* from link. %s.",
+ (get_sharing_policy() == SharingPolicy::SPLITDUPLEX
+ ? "For a Split-Duplex link, you should call this method to each UP/DOWN member"
+ : "Please report this bug"));
return link_impl;
}
return this;
}
-Link* Link::set_sharing_policy(Link::SharingPolicy policy)
+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."));
- kernel::actor::simcall([this, policy] { pimpl_->set_sharing_policy(policy); });
+ kernel::actor::simcall([this, policy, &cb] { pimpl_->set_sharing_policy(policy, cb); });
return this;
}
Link::SharingPolicy Link::get_sharing_policy() const