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/kernel/resource/SplitDuplexLinkImpl.hpp"
8 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
18 SplitDuplexLinkImpl::SplitDuplexLinkImpl(const std::string& name, StandardLinkImpl* link_up,
19 StandardLinkImpl* link_down)
20 : LinkImpl(name), piface_(this), link_up_(link_up), link_down_(link_down)
24 bool SplitDuplexLinkImpl::is_used() const
26 return link_up_->is_used() || link_down_->is_used();
29 void SplitDuplexLinkImpl::set_sharing_policy(s4u::Link::SharingPolicy policy, const s4u::NonLinearResourceCb& cb)
31 xbt_assert(policy != s4u::Link::SharingPolicy::SPLITDUPLEX && policy != s4u::Link::SharingPolicy::WIFI,
32 "Invalid sharing policy for split-duplex links");
33 link_up_->set_sharing_policy(policy, cb);
34 link_down_->set_sharing_policy(policy, cb);
37 void SplitDuplexLinkImpl::set_bandwidth(double value)
39 link_up_->set_bandwidth(value);
40 link_down_->set_bandwidth(value);
43 void SplitDuplexLinkImpl::set_latency(double value)
45 link_up_->set_latency(value);
46 link_down_->set_latency(value);
49 void SplitDuplexLinkImpl::turn_on()
52 link_down_->turn_on();
55 void SplitDuplexLinkImpl::turn_off()
58 link_down_->turn_off();
61 void SplitDuplexLinkImpl::apply_event(profile::Event* event, double value)
63 link_up_->apply_event(event, value);
64 link_down_->apply_event(event, value);
67 void SplitDuplexLinkImpl::seal()
78 void SplitDuplexLinkImpl::set_bandwidth_profile(profile::Profile* profile)
80 link_up_->set_bandwidth_profile(profile);
81 link_down_->set_bandwidth_profile(profile);
84 void SplitDuplexLinkImpl::set_latency_profile(profile::Profile* profile)
86 link_up_->set_latency_profile(profile);
87 link_down_->set_latency_profile(profile);
90 void SplitDuplexLinkImpl::set_concurrency_limit(int limit) const
92 link_up_->set_concurrency_limit(limit);
93 link_down_->set_concurrency_limit(limit);
96 } // namespace resource
98 } // namespace simgrid