Logo AND Algorithmique Numérique Distribuée

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