Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill LinkPtr type and make Link* explicit
[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 typedef NetworkConstantModel *NetworkConstantModelPtr;
17
18 class NetworkConstantAction;
19 typedef NetworkConstantAction *NetworkConstantActionPtr;
20
21 /*********
22  * Model *
23  *********/
24 class NetworkConstantModel : public NetworkCm02Model {
25 public:
26   NetworkConstantModel()
27   : NetworkCm02Model("constant time network")
28   {
29     p_updateMechanism = UM_UNDEFINED;
30   };
31   double shareResources(double now);
32   void updateActionsState(double now, double delta);
33   ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
34                                            double size, double rate);
35   void gapRemove(ActionPtr action);
36 };
37
38 /************
39  * Resource *
40  ************/
41 class NetworkConstantLink : public NetworkCm02Link {
42 public:
43   NetworkConstantLink(NetworkCm02ModelPtr model, const char* name, xbt_dict_t properties);
44   bool isUsed();
45   void updateState(tmgr_trace_event_t event_type, double value, double date);
46   double getBandwidth();
47   double getLatency();
48   bool isShared();
49 };
50
51 /**********
52  * Action *
53  **********/
54 class NetworkConstantAction : public NetworkCm02Action {
55 public:
56   NetworkConstantAction(NetworkConstantModelPtr model_, double size, double latency)
57   : NetworkCm02Action(model_, size, false)
58   , m_latInit(latency)
59   {
60         m_latency = latency;
61         if (m_latency <= 0.0) {
62           p_stateSet = getModel()->getDoneActionSet();
63           p_stateSet->push_back(*this);
64         }
65         p_variable = NULL;
66   };
67   int unref();
68   void recycle();
69   void cancel();
70   void setCategory(const char *category);
71   void suspend();
72   void resume();
73   bool isSuspended();
74   double m_latInit;
75   int m_suspended;
76 };
77
78 #endif /* NETWORK_CONSTANT_HPP_ */