Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill dead code: Action::recycle never got implemented
[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("constant time network")
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,
31                                            double size, double rate);
32   void gapRemove(Action *action);
33 };
34
35 /************
36  * Resource *
37  ************/
38 class NetworkConstantLink : public NetworkCm02Link {
39 public:
40   NetworkConstantLink(NetworkCm02Model *model, const char* name, xbt_dict_t properties);
41   bool isUsed();
42   void updateState(tmgr_trace_event_t event_type, double value, double date);
43   double getBandwidth();
44   double getLatency();
45   bool isShared();
46 };
47
48 /**********
49  * Action *
50  **********/
51 class NetworkConstantAction : public NetworkCm02Action {
52 public:
53   NetworkConstantAction(NetworkConstantModel *model_, double size, double latency)
54   : NetworkCm02Action(model_, size, false)
55   , m_latInit(latency)
56   {
57         m_latency = latency;
58         if (m_latency <= 0.0) {
59           p_stateSet = getModel()->getDoneActionSet();
60           p_stateSet->push_back(*this);
61         }
62         p_variable = NULL;
63   };
64   int unref();
65   void cancel();
66   void setCategory(const char *category);
67   void suspend();
68   void resume();
69   bool isSuspended();
70   double m_latInit;
71   int m_suspended;
72 };
73
74 #endif /* NETWORK_CONSTANT_HPP_ */