Logo AND Algorithmique Numérique Distribuée

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