Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Use member hooks for CpuTi
[simgrid.git] / src / surf / network_constant.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 NETWORK_CONSTANT_HPP_
8 #define NETWORK_CONSTANT_HPP_
9
10 #include "network_interface.hpp"
11
12 /***********
13  * Classes *
14  ***********/
15 class NetworkConstantModel;
16 class NetworkConstantAction;
17
18 /*********
19  * Model *
20  *********/
21 class NetworkConstantModel : public NetworkModel {
22 public:
23   NetworkConstantModel()  : NetworkModel() { };
24   ~NetworkConstantModel() { }
25
26   Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
27   double shareResources(double now);
28   void updateActionsState(double now, double delta);
29   bool shareResourcesIsIdempotent() {return true;}
30
31   Link* createLink(const char *name,
32                            double bw_initial,
33                                    tmgr_trace_t bw_trace,
34                                    double lat_initial,
35                                    tmgr_trace_t lat_trace,
36                                    e_surf_resource_state_t state_initial,
37                                    tmgr_trace_t state_trace,
38                                    e_surf_link_sharing_policy_t policy,
39                                    xbt_dict_t properties)                  { DIE_IMPOSSIBLE; }
40   void addTraces()                                         { DIE_IMPOSSIBLE; }
41   xbt_dynar_t getRoute(RoutingEdge *src, RoutingEdge *dst) { DIE_IMPOSSIBLE; }
42 };
43
44 /**********
45  * Action *
46  **********/
47 class NetworkConstantAction : public NetworkAction {
48 public:
49   NetworkConstantAction(NetworkConstantModel *model_, double size, double latency)
50   : NetworkAction(model_, size, false)
51   , m_latInit(latency)
52   {
53         m_latency = latency;
54         if (m_latency <= 0.0) {
55           p_stateSet = getModel()->getDoneActionSet();
56           p_stateSet->push_back(*this);
57         }
58         p_variable = NULL;
59   };
60   int unref();
61   void cancel();
62   void setCategory(const char *category);
63   void suspend();
64   void resume();
65   bool isSuspended();
66   double m_latInit;
67   int m_suspended;
68 };
69
70 #endif /* NETWORK_CONSTANT_HPP_ */