1 /* Copyright (c) 2013-2021. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "src/surf/SplitDuplexLinkImpl.hpp"
8 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
18 SplitDuplexLinkImpl::SplitDuplexLinkImpl(const std::string& name, LinkImpl* link_up, LinkImpl* link_down)
19 : LinkImplIntf(name), piface_(this), link_up_(link_up), link_down_(link_down)
23 bool SplitDuplexLinkImpl::is_used() const
25 xbt_die("Impossible to call is_used() in split-duplex links. Call it for each individual link.");
28 void SplitDuplexLinkImpl::set_sharing_policy(s4u::Link::SharingPolicy policy, const s4u::NonLinearResourceCb& cb)
30 xbt_assert(policy != s4u::Link::SharingPolicy::SPLITDUPLEX && policy != s4u::Link::SharingPolicy::WIFI,
31 "Invalid sharing policy for split-duplex links");
32 link_up_->set_sharing_policy(policy, cb);
33 link_down_->set_sharing_policy(policy, cb);
36 void SplitDuplexLinkImpl::set_bandwidth(double value)
38 link_up_->set_bandwidth(value);
39 link_down_->set_bandwidth(value);
42 void SplitDuplexLinkImpl::set_latency(double value)
44 link_up_->set_latency(value);
45 link_down_->set_latency(value);
48 void SplitDuplexLinkImpl::turn_on()
51 link_down_->turn_on();
54 void SplitDuplexLinkImpl::turn_off()
57 link_down_->turn_off();
60 void SplitDuplexLinkImpl::apply_event(profile::Event* event, double value)
62 link_up_->apply_event(event, value);
63 link_down_->apply_event(event, value);
66 void SplitDuplexLinkImpl::seal()
77 void SplitDuplexLinkImpl::set_bandwidth_profile(profile::Profile* profile)
79 link_up_->set_bandwidth_profile(profile);
80 link_down_->set_bandwidth_profile(profile);
83 void SplitDuplexLinkImpl::set_latency_profile(profile::Profile* profile)
85 link_up_->set_latency_profile(profile);
86 link_down_->set_latency_profile(profile);
89 void SplitDuplexLinkImpl::set_concurrency_limit(int limit) const
91 link_up_->set_concurrency_limit(limit);
92 link_down_->set_concurrency_limit(limit);
95 } // namespace resource
97 } // namespace simgrid