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;
}
xbt_die("Impossible to change sharing policy of split-duplex links");
}
-s4u::Link::SharingPolicy SplitDuplexLinkImpl::get_sharing_policy() const
-{
- return sharing_policy_;
-}
-
void SplitDuplexLinkImpl::set_bandwidth(double value)
{
link_up_->set_bandwidth(value);
} // namespace resource
} // namespace kernel
-} // namespace simgrid
\ No newline at end of file
+} // namespace simgrid
*/
class SplitDuplexLinkImpl : public LinkImplIntf {
s4u::SplitDuplexLink piface_;
- s4u::Link::SharingPolicy sharing_policy_ = s4u::Link::SharingPolicy::SPLITDUPLEX;
LinkImpl* link_up_;
LinkImpl* link_down_;
/** @brief The sharing policy */
void set_sharing_policy(s4u::Link::SharingPolicy policy) override;
- s4u::Link::SharingPolicy get_sharing_policy() const override;
+ s4u::Link::SharingPolicy get_sharing_policy() const override { return s4u::Link::SharingPolicy::SPLITDUPLEX; }
/** @brief Get link composing this split-duplex link */
s4u::Link* get_link_up() const { return link_up_->get_iface(); }