Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
actually kill models' names
[simgrid.git] / src / surf / network_constant.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_cm02.hpp"
8
9 #ifndef NETWORK_CONSTANT_HPP_
10 #define NETWORK_CONSTANT_HPP_
11
12 /***********
13  * Classes *
14  ***********/
15 class NetworkConstantModel;
16 class NetworkConstantAction;
17
18 /*********
19  * Model *
20  *********/
21 class NetworkConstantModel : public NetworkCm02Model {
22 public:
23   NetworkConstantModel()
24   : NetworkCm02Model()
25   {
26     p_updateMechanism = UM_UNDEFINED;
27   };
28   double shareResources(double now);
29   void updateActionsState(double now, double delta);
30   Action *communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
31   void gapRemove(Action *action);
32 };
33
34 /************
35  * Resource *
36  ************/
37 class NetworkConstantLink : public NetworkCm02Link {
38 public:
39   NetworkConstantLink(NetworkCm02Model *model, const char* name, xbt_dict_t properties);
40   bool isUsed();
41   void updateState(tmgr_trace_event_t event_type, double value, double date);
42   double getBandwidth();
43   double getLatency();
44   bool isShared();
45 };
46
47 /**********
48  * Action *
49  **********/
50 class NetworkConstantAction : public NetworkCm02Action {
51 public:
52   NetworkConstantAction(NetworkConstantModel *model_, double size, double latency)
53   : NetworkCm02Action(model_, size, false)
54   , m_latInit(latency)
55   {
56         m_latency = latency;
57         if (m_latency <= 0.0) {
58           p_stateSet = getModel()->getDoneActionSet();
59           p_stateSet->push_back(*this);
60         }
61         p_variable = NULL;
62   };
63   int unref();
64   void cancel();
65   void setCategory(const char *category);
66   void suspend();
67   void resume();
68   bool isSuspended();
69   double m_latInit;
70   int m_suspended;
71 };
72
73 #endif /* NETWORK_CONSTANT_HPP_ */