Logo AND Algorithmique Numérique Distribuée

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