Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Separate NetworkModel from LinkImpl.
[simgrid.git] / src / kernel / resource / LinkImpl.hpp
1 /* Copyright (c) 2004-2022. 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 #ifndef SIMGRID_KERNEL_RESOURCE_LINKIMPL_HPP
7 #define SIMGRID_KERNEL_RESOURCE_LINKIMPL_HPP
8
9 #include "simgrid/s4u/Link.hpp"
10 #include "src/kernel/resource/Resource.hpp"
11 #include "xbt/PropertyHolder.hpp"
12
13 namespace simgrid {
14 namespace kernel {
15 namespace resource {
16
17 /************
18  * Resource *
19  ************/
20 class LinkImpl : public Resource_T<LinkImpl>, public xbt::PropertyHolder {
21 public:
22   using Resource_T::Resource_T;
23   /** @brief Get the bandwidth in bytes per second of current Link */
24   virtual double get_bandwidth() const = 0;
25   /** @brief Update the bandwidth in bytes per second of current Link */
26   virtual void set_bandwidth(double value) = 0;
27
28   /** @brief Get the latency in seconds of current Link */
29   virtual double get_latency() const = 0;
30   /** @brief Update the latency in seconds of current Link */
31   virtual void set_latency(double value) = 0;
32
33   /** @brief The sharing policy */
34   virtual void set_sharing_policy(s4u::Link::SharingPolicy policy, const s4u::NonLinearResourceCb& cb) = 0;
35   virtual s4u::Link::SharingPolicy get_sharing_policy() const                                          = 0;
36
37   /* setup the profile file with bandwidth events (peak speed changes due to external load).
38    * Profile must contain percentages (value between 0 and 1). */
39   virtual void set_bandwidth_profile(kernel::profile::Profile* profile) = 0;
40   /* setup the profile file with latency events (peak latency changes due to external load).
41    * Profile must contain absolute values */
42   virtual void set_latency_profile(kernel::profile::Profile* profile) = 0;
43   /** @brief Set the concurrency limit for this link */
44   virtual void set_concurrency_limit(int limit) const = 0;
45 };
46
47 } // namespace resource
48 } // namespace kernel
49 } // namespace simgrid
50
51 #endif /* SIMGRID_KERNEL_RESOURCE_LINKIMPL_HPP */