Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SplitDuplexLinkImpl always have SharingPolicy::SPLITDUPLEX. Use a sdingle assert...
[simgrid.git] / src / surf / SplitDuplexLinkImpl.cpp
1 /* Copyright (c) 2013-2021. The SimGrid Team. All rights reserved.          */
2
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. */
5
6 #include "src/surf/SplitDuplexLinkImpl.hpp"
7
8 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
9
10 /*********
11  * Model *
12  *********/
13
14 namespace simgrid {
15 namespace kernel {
16 namespace resource {
17
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)
20 {
21 }
22
23 bool SplitDuplexLinkImpl::is_used() const
24 {
25   xbt_die("Impossible to call is_used() in split-duplex links. Call it for each individual link.");
26 }
27
28 void SplitDuplexLinkImpl::set_sharing_policy(s4u::Link::SharingPolicy policy)
29 {
30   xbt_die("Impossible to change sharing policy of split-duplex links");
31 }
32
33 void SplitDuplexLinkImpl::set_bandwidth(double value)
34 {
35   link_up_->set_bandwidth(value);
36   link_down_->set_bandwidth(value);
37 }
38
39 void SplitDuplexLinkImpl::set_latency(double value)
40 {
41   link_up_->set_latency(value);
42   link_down_->set_latency(value);
43 }
44
45 void SplitDuplexLinkImpl::turn_on()
46 {
47   link_up_->turn_on();
48   link_down_->turn_on();
49 }
50
51 void SplitDuplexLinkImpl::turn_off()
52 {
53   link_up_->turn_off();
54   link_down_->turn_off();
55 }
56
57 void SplitDuplexLinkImpl::apply_event(profile::Event* event, double value)
58 {
59   link_up_->apply_event(event, value);
60   link_down_->apply_event(event, value);
61 }
62
63 void SplitDuplexLinkImpl::seal()
64 {
65   if (is_sealed())
66     return;
67
68   link_up_->seal();
69   link_down_->seal();
70
71   Resource::seal();
72 }
73
74 void SplitDuplexLinkImpl::set_bandwidth_profile(profile::Profile* profile)
75 {
76   link_up_->set_bandwidth_profile(profile);
77   link_down_->set_bandwidth_profile(profile);
78 }
79
80 void SplitDuplexLinkImpl::set_latency_profile(profile::Profile* profile)
81 {
82   link_up_->set_latency_profile(profile);
83   link_down_->set_latency_profile(profile);
84 }
85
86 void SplitDuplexLinkImpl::set_concurrency_limit(int limit) const
87 {
88   link_up_->set_concurrency_limit(limit);
89   link_down_->set_concurrency_limit(limit);
90 }
91
92 } // namespace resource
93 } // namespace kernel
94 } // namespace simgrid