Logo AND Algorithmique Numérique Distribuée

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