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)
30 xbt_die("Impossible to change sharing policy of split-duplex links");
33 s4u::Link::SharingPolicy SplitDuplexLinkImpl::get_sharing_policy() const
35 return sharing_policy_;
38 void SplitDuplexLinkImpl::set_bandwidth(double value)
40 link_up_->set_bandwidth(value);
41 link_down_->set_bandwidth(value);
44 void SplitDuplexLinkImpl::set_latency(double value)
46 link_up_->set_latency(value);
47 link_down_->set_latency(value);
50 void SplitDuplexLinkImpl::turn_on()
53 link_down_->turn_on();
56 void SplitDuplexLinkImpl::turn_off()
59 link_down_->turn_off();
62 void SplitDuplexLinkImpl::apply_event(profile::Event* event, double value)
64 link_up_->apply_event(event, value);
65 link_down_->apply_event(event, value);
68 void SplitDuplexLinkImpl::seal()
79 void SplitDuplexLinkImpl::set_bandwidth_profile(profile::Profile* profile)
81 link_up_->set_bandwidth_profile(profile);
82 link_down_->set_bandwidth_profile(profile);
85 void SplitDuplexLinkImpl::set_latency_profile(profile::Profile* profile)
87 link_up_->set_latency_profile(profile);
88 link_down_->set_latency_profile(profile);
91 void SplitDuplexLinkImpl::set_concurrency_limit(int limit) const
93 link_up_->set_concurrency_limit(limit);
94 link_down_->set_concurrency_limit(limit);
97 } // namespace resource
99 } // namespace simgrid