Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
doc is whining +indent
[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 };
40
41 /************
42  * Resource *
43  ************/
44 class NetworkConstantLink : public NetworkCm02Link {
45 public:
46   NetworkConstantLink(NetworkCm02ModelPtr model, const char* name, xbt_dict_t properties);
47   bool isUsed();
48   void updateState(tmgr_trace_event_t event_type, double value, double date);
49   double getBandwidth();
50   double getLatency();
51   bool isShared();
52 };
53
54 /**********
55  * Action *
56  **********/
57 class NetworkConstantAction : public NetworkCm02Action {
58 public:
59   NetworkConstantAction(NetworkConstantModelPtr model_, double size, double latency)
60   : NetworkCm02Action(model_, size, false)
61   , m_latInit(latency)
62   {
63         m_latency = latency;
64         if (m_latency <= 0.0) {
65           p_stateSet = getModel()->getDoneActionSet();
66           p_stateSet->push_back(*this);
67         }
68         p_variable = NULL;
69   };
70   int unref();
71   void recycle();
72   void cancel();
73   void setCategory(const char *category);
74   void suspend();
75   void resume();
76   bool isSuspended();
77   double m_latInit;
78   int m_suspended;
79 };
80
81 #endif /* NETWORK_CONSTANT_HPP_ */