Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
b4d40482d9a7e9d9f941c53c9e7d313629ecc3b8
[simgrid.git] / src / surf / network_cm02.hpp
1 /* Copyright (c) 2013-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "network_interface.hpp"
8 #include "xbt/fifo.h"
9 #include "xbt/graph.h"
10
11 #ifndef SURF_NETWORK_CM02_HPP_
12 #define SURF_NETWORK_CM02_HPP_
13
14 /***********
15  * Classes *
16  ***********/
17 class NetworkCm02Model;
18 typedef NetworkCm02Model *NetworkCm02ModelPtr;
19
20 class NetworkCm02Link;
21 typedef NetworkCm02Link *NetworkCm02LinkPtr;
22
23 class NetworkCm02Action;
24 typedef NetworkCm02Action *NetworkCm02ActionPtr;
25
26 /*********
27  * Tools *
28  *********/
29
30 void net_define_callbacks(void);
31
32 /*********
33  * Model *
34  *********/
35 class NetworkCm02Model : public NetworkModel {
36 private:
37   void initialize();
38 public:
39   NetworkCm02Model(int /*i*/) : NetworkModel("network") {
40         f_networkSolve = lmm_solve;
41         m_haveGap = false;
42   };//FIXME: add network clean interface
43   NetworkCm02Model(const char *name) : NetworkModel(name) {
44     this->initialize();
45   }
46   NetworkCm02Model() : NetworkModel("network") {
47     this->initialize();
48   }
49   ~NetworkCm02Model() {
50   }
51   NetworkLinkPtr createResource(const char *name,
52                                    double bw_initial,
53                                    tmgr_trace_t bw_trace,
54                                    double lat_initial,
55                                    tmgr_trace_t lat_trace,
56                                    e_surf_resource_state_t state_initial,
57                                    tmgr_trace_t state_trace,
58                                    e_surf_link_sharing_policy_t policy,
59                                    xbt_dict_t properties);
60   void updateActionsStateLazy(double now, double delta);
61   ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
62                                            double size, double rate);
63 };
64
65 /************
66  * Resource *
67  ************/
68
69 class NetworkCm02Link : public NetworkLink {
70 public:
71   NetworkCm02Link(NetworkCm02ModelPtr model, const char *name, xbt_dict_t props,
72                                    lmm_system_t system,
73                                    double constraint_value,
74                                    tmgr_history_t history,
75                                    e_surf_resource_state_t state_init,
76                                    tmgr_trace_t state_trace,
77                                    double metric_peak,
78                                    tmgr_trace_t metric_trace,
79                                    double lat_initial,
80                                    tmgr_trace_t lat_trace,
81                                e_surf_link_sharing_policy_t policy);
82   void updateState(tmgr_trace_event_t event_type, double value, double date);
83 };
84
85
86 /**********
87  * Action *
88  **********/
89
90 class NetworkCm02Action : public NetworkAction {
91   friend ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate);
92
93 public:
94   NetworkCm02Action(ModelPtr model, double cost, bool failed)
95  : NetworkAction(model, cost, failed) {};
96   void updateRemainingLazy(double now);
97   void recycle();
98 };
99
100 #endif /* SURF_NETWORK_CM02_HPP_ */