Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cd576d6e9472fd0872b2a34ee9a0e819f1de35db
[simgrid.git] / src / surf / network_cm02.hpp
1 /* Copyright (c) 2013-2019. 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 SURF_NETWORK_CM02_HPP_
7 #define SURF_NETWORK_CM02_HPP_
8
9 #include <xbt/base.h>
10
11 #include "network_interface.hpp"
12 #include "xbt/graph.h"
13
14
15 /***********
16  * Classes *
17  ***********/
18
19 namespace simgrid {
20 namespace kernel {
21 namespace resource {
22
23 class XBT_PRIVATE NetworkCm02Model;
24 class XBT_PRIVATE NetworkCm02Action;
25 class XBT_PRIVATE NetworkSmpiModel;
26
27 /*********
28  * Model *
29  *********/
30
31 class NetworkCm02Model : public NetworkModel {
32 public:
33   explicit NetworkCm02Model(lmm::System* (*make_new_sys)(bool) = &lmm::make_new_maxmin_system);
34   virtual ~NetworkCm02Model() = default;
35   LinkImpl* create_link(const std::string& name, double bandwidth, double latency,
36                         s4u::Link::SharingPolicy policy) override;
37   void update_actions_state_lazy(double now, double delta) override;
38   void update_actions_state_full(double now, double delta) override;
39   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
40 };
41
42 /************
43  * Resource *
44  ************/
45
46 class NetworkCm02Link : public LinkImpl {
47 public:
48   NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
49                   s4u::Link::SharingPolicy policy, lmm::System* system);
50   virtual ~NetworkCm02Link() = default;
51   void apply_event(kernel::profile::Event* event, double value) override;
52   void set_bandwidth(double value) override;
53   void set_latency(double value) override;
54 };
55
56 /**********
57  * Action *
58  **********/
59 class NetworkCm02Action : public NetworkAction {
60   friend Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate);
61
62 public:
63   NetworkCm02Action(Model* model, double cost, bool failed) : NetworkAction(model, cost, failed){};
64   virtual ~NetworkCm02Action() = default;
65   void update_remains_lazy(double now) override;
66 };
67 }
68 }
69 } // namespace simgrid
70 #endif /* SURF_NETWORK_CM02_HPP_ */