Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill models getName() call sites.
[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 class NetworkCm02Action;
19
20 /*********
21  * Tools *
22  *********/
23
24 void net_define_callbacks(void);
25
26 /*********
27  * Model *
28  *********/
29 class NetworkCm02Model : public NetworkModel {
30 private:
31   void initialize();
32 public:
33   NetworkCm02Model(int /*i*/) : NetworkModel("network") {
34         f_networkSolve = lmm_solve;
35         m_haveGap = false;
36   };//FIXME: add network clean interface
37   NetworkCm02Model(const char *name) : NetworkModel(name) {
38     this->initialize();
39   }
40   NetworkCm02Model() : NetworkModel("network") {
41     this->initialize();
42   }
43   ~NetworkCm02Model() {
44   }
45   Link* createLink(const char *name,
46                   double bw_initial,
47                   tmgr_trace_t bw_trace,
48                   double lat_initial,
49                   tmgr_trace_t lat_trace,
50                   e_surf_resource_state_t state_initial,
51                   tmgr_trace_t state_trace,
52                   e_surf_link_sharing_policy_t policy,
53                   xbt_dict_t properties);
54   void addTraces();
55   void updateActionsStateLazy(double now, double delta);
56   void updateActionsStateFull(double now, double delta);
57   Action *communicate(RoutingEdge *src, RoutingEdge *dst,
58                                            double size, double rate);
59   bool shareResourcesIsIdempotent() {return true;}
60 };
61
62 /************
63  * Resource *
64  ************/
65
66 class NetworkCm02Link : public Link {
67 public:
68   NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
69                                    lmm_system_t system,
70                                    double constraint_value,
71                                    tmgr_history_t history,
72                                    e_surf_resource_state_t state_init,
73                                    tmgr_trace_t state_trace,
74                                    double metric_peak,
75                                    tmgr_trace_t metric_trace,
76                                    double lat_initial,
77                                    tmgr_trace_t lat_trace,
78                                e_surf_link_sharing_policy_t policy);
79   void updateState(tmgr_trace_event_t event_type, double value, double date);
80   void updateBandwidth(double value, double date=surf_get_clock());
81   void updateLatency(double value, double date=surf_get_clock());
82 };
83
84
85 /**********
86  * Action *
87  **********/
88
89 class NetworkCm02Action : public NetworkAction {
90   friend Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
91
92 public:
93   NetworkCm02Action(Model *model, double cost, bool failed)
94  : NetworkAction(model, cost, failed) {};
95   void updateRemainingLazy(double now);
96 };
97
98 #endif /* SURF_NETWORK_CM02_HPP_ */