Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
directly store the ns3Node, don't rely on a num ID to find it later on
[simgrid.git] / src / surf / network_cm02.hpp
1 /* Copyright (c) 2013-2017. 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 surf {
21
22     class XBT_PRIVATE NetworkCm02Model;
23     class XBT_PRIVATE NetworkCm02Action;
24     class XBT_PRIVATE NetworkSmpiModel;
25
26   }
27 }
28
29 /*********
30  * Model *
31  *********/
32
33 namespace simgrid {
34 namespace surf {
35
36 class NetworkCm02Model : public NetworkModel {
37 public:
38   NetworkCm02Model();
39   explicit NetworkCm02Model(void (*solve_fun)(lmm_system_t self));
40   virtual ~NetworkCm02Model() = default;
41   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
42                        e_surf_link_sharing_policy_t policy) override;
43   void updateActionsStateLazy(double now, double delta) override;
44   void updateActionsStateFull(double now, double delta) override;
45   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
46 };
47
48 /************
49  * Resource *
50  ************/
51
52 class NetworkCm02Link : public LinkImpl {
53 public:
54   NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
55                   e_surf_link_sharing_policy_t policy, lmm_system_t system);
56   virtual ~NetworkCm02Link() = default;
57   void apply_event(tmgr_trace_event_t event, double value) override;
58   void setBandwidth(double value) override;
59   void setLatency(double value) override;
60 };
61
62 /**********
63  * Action *
64  **********/
65 class NetworkCm02Action : public NetworkAction {
66   friend Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate);
67   friend NetworkSmpiModel;
68
69 public:
70   NetworkCm02Action(Model* model, double cost, bool failed) : NetworkAction(model, cost, failed){};
71   virtual ~NetworkCm02Action() = default;
72   void updateRemainingLazy(double now) override;
73 };
74 }
75 }
76
77 #endif /* SURF_NETWORK_CM02_HPP_ */