Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce the amount of implicit include directories
[simgrid.git] / src / surf / network_cm02.hpp
1 /* Copyright (c) 2013-2015. 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 #ifndef SURF_NETWORK_CM02_HPP_
8 #define SURF_NETWORK_CM02_HPP_
9
10 #include <xbt/base.h>
11
12 #include "network_interface.hpp"
13 #include "xbt/fifo.h"
14 #include "xbt/graph.h"
15
16 /***********
17  * Classes *
18  ***********/
19 class XBT_PRIVATE NetworkCm02Model;
20 class XBT_PRIVATE NetworkCm02Action;
21
22 /*********
23  * Tools *
24  *********/
25
26 XBT_PRIVATE void net_define_callbacks(void);
27
28 /*********
29  * Model *
30  *********/
31 class NetworkCm02Model : public NetworkModel {
32 private:
33   void initialize();
34 public:
35   NetworkCm02Model(int /*i*/) : NetworkModel() {};
36   NetworkCm02Model();
37   ~NetworkCm02Model() {
38   }
39   Link* createLink(const char *name,
40                   double bw_initial,
41                   tmgr_trace_t bw_trace,
42                   double lat_initial,
43                   tmgr_trace_t lat_trace,
44                   e_surf_resource_state_t state_initial,
45                   tmgr_trace_t state_trace,
46                   e_surf_link_sharing_policy_t policy,
47                   xbt_dict_t properties) override;
48   void addTraces();
49   void updateActionsStateLazy(double now, double delta);
50   void updateActionsStateFull(double now, double delta);
51   Action *communicate(RoutingEdge *src, RoutingEdge *dst,
52                                            double size, double rate);
53   bool shareResourcesIsIdempotent() {return true;}
54 };
55
56 /************
57  * Resource *
58  ************/
59
60 class NetworkCm02Link : public Link {
61 public:
62   NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
63                                    lmm_system_t system,
64                                    double constraint_value,
65                                    tmgr_history_t history,
66                                    e_surf_resource_state_t state_init,
67                                    tmgr_trace_t state_trace,
68                                    double metric_peak,
69                                    tmgr_trace_t metric_trace,
70                                    double lat_initial,
71                                    tmgr_trace_t lat_trace,
72                                e_surf_link_sharing_policy_t policy);
73   void updateState(tmgr_trace_event_t event_type, double value, double date);
74   void updateBandwidth(double value, double date=surf_get_clock());
75   void updateLatency(double value, double date=surf_get_clock());
76 };
77
78
79 /**********
80  * Action *
81  **********/
82
83 class NetworkCm02Action : public NetworkAction {
84   friend Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
85
86 public:
87   NetworkCm02Action(Model *model, double cost, bool failed)
88      : NetworkAction(model, cost, failed) {};
89   void updateRemainingLazy(double now);
90 };
91
92 #endif /* SURF_NETWORK_CM02_HPP_ */