Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move all network models to the kernel::resource namespace
[simgrid.git] / src / surf / network_cm02.hpp
1 /* Copyright (c) 2013-2018. 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* createLink(const std::string& name, double bandwidth, double latency,
36                        e_surf_link_sharing_policy_t 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                   e_surf_link_sharing_policy_t policy, lmm::System* system);
50   virtual ~NetworkCm02Link() = default;
51   void apply_event(tmgr_trace_event_t event, double value) override;
52   void setBandwidth(double value) override;
53   void setLatency(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   friend NetworkSmpiModel;
62
63 public:
64   NetworkCm02Action(Model* model, double cost, bool failed) : NetworkAction(model, cost, failed){};
65   virtual ~NetworkCm02Action() = default;
66   void update_remains_lazy(double now) override;
67 };
68 }
69 }
70 } // namespace simgrid
71 #endif /* SURF_NETWORK_CM02_HPP_ */