Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change e_surf_link_sharing_policy_t into a proper enum class
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 7 Apr 2018 16:41:35 +0000 (18:41 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 7 Apr 2018 16:41:35 +0000 (18:41 +0200)
21 files changed:
include/simgrid/forward.h
include/simgrid/kernel/routing/DragonflyZone.hpp
include/simgrid/s4u/Link.hpp
src/bindings/lua/lua_platf.cpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/VivaldiZone.cpp
src/surf/network_cm02.cpp
src/surf/network_cm02.hpp
src/surf/network_constant.cpp
src/surf/network_constant.hpp
src/surf/network_interface.hpp
src/surf/network_ns3.cpp
src/surf/network_ns3.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/sg_platf.cpp
src/surf/xml/platf_private.hpp
src/surf/xml/surfxml_sax_cb.cpp

index 11b07d2..59b45c7 100644 (file)
@@ -135,12 +135,6 @@ typedef s4u_Actor* sg_actor_t;
 
 typedef struct s_smx_simcall* smx_simcall_t;
 
 
 typedef struct s_smx_simcall* smx_simcall_t;
 
-typedef enum { // FIXME: move this to s4u::Link; make it an enum class
-  SURF_LINK_SPLITDUPLEX = 2,
-  SURF_LINK_SHARED      = 1,
-  SURF_LINK_FATPIPE     = 0
-} e_surf_link_sharing_policy_t;
-
 /** @ingroup m_datatypes_management_details
  * @brief Type for any simgrid size
  */
 /** @ingroup m_datatypes_management_details
  * @brief Type for any simgrid size
  */
index bb06b63..2db8af0 100644 (file)
@@ -7,6 +7,7 @@
 #define SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_
 
 #include <simgrid/kernel/routing/ClusterZone.hpp>
 #define SURF_ROUTING_CLUSTER_DRAGONFLY_HPP_
 
 #include <simgrid/kernel/routing/ClusterZone.hpp>
+#include <simgrid/s4u/Link.hpp>
 
 namespace simgrid {
 namespace kernel {
 
 namespace simgrid {
 namespace kernel {
@@ -73,7 +74,7 @@ public:
   void rankId_to_coords(int rankId, unsigned int (*coords)[4]);
 
 private:
   void rankId_to_coords(int rankId, unsigned int (*coords)[4]);
 
 private:
-  e_surf_link_sharing_policy_t sharing_policy_;
+  simgrid::s4u::Link::SharingPolicy sharing_policy_;
   double bw_  = 0;
   double lat_ = 0;
 
   double bw_  = 0;
   double lat_ = 0;
 
index 81c3929..a51dba5 100644 (file)
@@ -30,6 +30,8 @@ class XBT_PUBLIC Link : public simgrid::xbt::Extendable<Link> {
   kernel::resource::LinkImpl* const pimpl_;
 
 public:
   kernel::resource::LinkImpl* const pimpl_;
 
 public:
+  enum class SharingPolicy { SPLITDUPLEX = 2, SHARED = 1, FATPIPE = 0 };
+
   /** @brief Retrieve a link from its name */
   static Link* by_name(const char* name);
 
   /** @brief Retrieve a link from its name */
   static Link* by_name(const char* name);
 
index 3275d94..da34ce4 100644 (file)
@@ -93,13 +93,13 @@ int console_add_backbone(lua_State *L) {
   lua_pop(L, 1);
   if (policy && not strcmp(policy, "FULLDUPLEX")) {
     XBT_WARN("Please update your platform to use SPLITDUPLEX instead of FULLDUPLEX");
   lua_pop(L, 1);
   if (policy && not strcmp(policy, "FULLDUPLEX")) {
     XBT_WARN("Please update your platform to use SPLITDUPLEX instead of FULLDUPLEX");
-    link.policy = SURF_LINK_SPLITDUPLEX;
+    link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
   } else if (policy && not strcmp(policy, "SPLITDUPLEX")) {
   } else if (policy && not strcmp(policy, "SPLITDUPLEX")) {
-    link.policy = SURF_LINK_SPLITDUPLEX;
+    link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
   } else if (policy && not strcmp(policy, "FATPIPE")) {
   } else if (policy && not strcmp(policy, "FATPIPE")) {
-    link.policy = SURF_LINK_FATPIPE;
+    link.policy = simgrid::s4u::Link::SharingPolicy::FATPIPE;
   } else {
   } else {
-    link.policy = SURF_LINK_SHARED;
+    link.policy = simgrid::s4u::Link::SharingPolicy::SHARED;
   }
 
   sg_platf_new_link(&link);
   }
 
   sg_platf_new_link(&link);
@@ -269,13 +269,13 @@ int  console_add_link(lua_State *L) {
   lua_pop(L, 1);
   if (policy && not strcmp(policy, "FULLDUPLEX")) {
     XBT_WARN("Please update your platform to use SPLITDUPLEX instead of FULLDUPLEX");
   lua_pop(L, 1);
   if (policy && not strcmp(policy, "FULLDUPLEX")) {
     XBT_WARN("Please update your platform to use SPLITDUPLEX instead of FULLDUPLEX");
-    link.policy = SURF_LINK_SPLITDUPLEX;
+    link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
   } else if (policy && not strcmp(policy, "SPLITDUPLEX")) {
   } else if (policy && not strcmp(policy, "SPLITDUPLEX")) {
-    link.policy = SURF_LINK_SPLITDUPLEX;
+    link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
   } else if (policy && not strcmp(policy, "FATPIPE")) {
   } else if (policy && not strcmp(policy, "FATPIPE")) {
-    link.policy = SURF_LINK_FATPIPE;
+    link.policy = simgrid::s4u::Link::SharingPolicy::FATPIPE;
   } else {
   } else {
-    link.policy = SURF_LINK_SHARED;
+    link.policy = simgrid::s4u::Link::SharingPolicy::SHARED;
   }
 
   sg_platf_new_link(&link);
   }
 
   sg_platf_new_link(&link);
index e3f8505..3bed217 100644 (file)
@@ -133,7 +133,7 @@ void ClusterZone::create_links_for_node(ClusterCreationArgs* cluster, int id, in
 
   resource::LinkImpl* linkUp;
   resource::LinkImpl* linkDown;
 
   resource::LinkImpl* linkUp;
   resource::LinkImpl* linkDown;
-  if (link.policy == SURF_LINK_SPLITDUPLEX) {
+  if (link.policy == simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX) {
     linkUp   = resource::LinkImpl::byName(link_id + "_UP");
     linkDown = resource::LinkImpl::byName(link_id + "_DOWN");
   } else {
     linkUp   = resource::LinkImpl::byName(link_id + "_UP");
     linkDown = resource::LinkImpl::byName(link_id + "_DOWN");
   } else {
index dbb52a3..af1f53b 100644 (file)
@@ -114,7 +114,7 @@ void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
   }
 
   this->sharing_policy_ = cluster->sharing_policy;
   }
 
   this->sharing_policy_ = cluster->sharing_policy;
-  if (cluster->sharing_policy == SURF_LINK_SPLITDUPLEX)
+  if (cluster->sharing_policy == s4u::Link::SharingPolicy::SPLITDUPLEX)
     this->num_links_per_link_ = 2;
   this->bw_  = cluster->bw;
   this->lat_ = cluster->lat;
     this->num_links_per_link_ = 2;
   this->bw_  = cluster->bw;
   this->lat_ = cluster->lat;
@@ -172,7 +172,7 @@ void DragonflyZone::createLink(const std::string& id, int numlinks, resource::Li
   sg_platf_new_link(&linkTemplate);
   XBT_DEBUG("Generating link %s", id.c_str());
   resource::LinkImpl* link;
   sg_platf_new_link(&linkTemplate);
   XBT_DEBUG("Generating link %s", id.c_str());
   resource::LinkImpl* link;
-  if (this->sharing_policy_ == SURF_LINK_SPLITDUPLEX) {
+  if (this->sharing_policy_ == s4u::Link::SharingPolicy::SPLITDUPLEX) {
     *linkup   = resource::LinkImpl::byName(linkTemplate.id + "_UP");   // check link?
     *linkdown = resource::LinkImpl::byName(linkTemplate.id + "_DOWN"); // check link ?
   } else {
     *linkup   = resource::LinkImpl::byName(linkTemplate.id + "_UP");   // check link?
     *linkdown = resource::LinkImpl::byName(linkTemplate.id + "_DOWN"); // check link ?
   } else {
@@ -203,7 +203,7 @@ void DragonflyZone::generateLinks()
       this->createLink(id, 1, &linkup, &linkdown);
 
       this->routers_[i]->my_nodes_[j] = linkup;
       this->createLink(id, 1, &linkup, &linkdown);
 
       this->routers_[i]->my_nodes_[j] = linkup;
-      if (this->sharing_policy_ == SURF_LINK_SPLITDUPLEX)
+      if (this->sharing_policy_ == s4u::Link::SharingPolicy::SPLITDUPLEX)
         this->routers_[i]->my_nodes_[j + 1] = linkdown;
 
       uniqueId++;
         this->routers_[i]->my_nodes_[j + 1] = linkdown;
 
       uniqueId++;
index f2fa5dc..e777ccf 100644 (file)
@@ -447,7 +447,7 @@ FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int po
   if (cluster->limiter_link) {
     linkTemplate.bandwidth = cluster->limiter_link;
     linkTemplate.latency   = 0;
   if (cluster->limiter_link) {
     linkTemplate.bandwidth = cluster->limiter_link;
     linkTemplate.latency   = 0;
-    linkTemplate.policy    = SURF_LINK_SHARED;
+    linkTemplate.policy    = s4u::Link::SharingPolicy::SHARED;
     linkTemplate.id        = "limiter_"+std::to_string(id);
     sg_platf_new_link(&linkTemplate);
     this->limiter_link_ = resource::LinkImpl::byName(linkTemplate.id);
     linkTemplate.id        = "limiter_"+std::to_string(id);
     sg_platf_new_link(&linkTemplate);
     this->limiter_link_ = resource::LinkImpl::byName(linkTemplate.id);
@@ -455,7 +455,7 @@ FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int po
   if (cluster->loopback_bw || cluster->loopback_lat) {
     linkTemplate.bandwidth = cluster->loopback_bw;
     linkTemplate.latency   = cluster->loopback_lat;
   if (cluster->loopback_bw || cluster->loopback_lat) {
     linkTemplate.bandwidth = cluster->loopback_bw;
     linkTemplate.latency   = cluster->loopback_lat;
-    linkTemplate.policy    = SURF_LINK_FATPIPE;
+    linkTemplate.policy    = s4u::Link::SharingPolicy::FATPIPE;
     linkTemplate.id        = "loopback_"+ std::to_string(id);
     sg_platf_new_link(&linkTemplate);
     this->loopback = resource::LinkImpl::byName(linkTemplate.id);
     linkTemplate.id        = "loopback_"+ std::to_string(id);
     sg_platf_new_link(&linkTemplate);
     this->loopback = resource::LinkImpl::byName(linkTemplate.id);
@@ -474,7 +474,7 @@ FatTreeLink::FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* downNode, Fa
       "link_from_" + std::to_string(downNode->id) + "_" + std::to_string(upNode->id) + "_" + std::to_string(uniqueId);
   sg_platf_new_link(&linkTemplate);
 
       "link_from_" + std::to_string(downNode->id) + "_" + std::to_string(upNode->id) + "_" + std::to_string(uniqueId);
   sg_platf_new_link(&linkTemplate);
 
-  if (cluster->sharing_policy == SURF_LINK_SPLITDUPLEX) {
+  if (cluster->sharing_policy == s4u::Link::SharingPolicy::SPLITDUPLEX) {
     std::string tmpID = std::string(linkTemplate.id) + "_UP";
     this->up_link_    = resource::LinkImpl::byName(tmpID); // check link?
     tmpID          = std::string(linkTemplate.id) + "_DOWN";
     std::string tmpID = std::string(linkTemplate.id) + "_UP";
     this->up_link_    = resource::LinkImpl::byName(tmpID); // check link?
     tmpID          = std::string(linkTemplate.id) + "_DOWN";
index c65d9a7..c718ac6 100644 (file)
@@ -56,7 +56,7 @@ void TorusZone::create_links_for_node(ClusterCreationArgs* cluster, int id, int
     sg_platf_new_link(&link);
     resource::LinkImpl* linkUp;
     resource::LinkImpl* linkDown;
     sg_platf_new_link(&link);
     resource::LinkImpl* linkUp;
     resource::LinkImpl* linkDown;
-    if (link.policy == SURF_LINK_SPLITDUPLEX) {
+    if (link.policy == s4u::Link::SharingPolicy::SPLITDUPLEX) {
       std::string tmp_link = link_id + "_UP";
       linkUp               = resource::LinkImpl::byName(tmp_link);
       tmp_link             = link_id + "_DOWN";
       std::string tmp_link = link_id + "_UP";
       linkUp               = resource::LinkImpl::byName(tmp_link);
       tmp_link             = link_id + "_DOWN";
index 56cc29e..b424a47 100644 (file)
@@ -72,8 +72,8 @@ void VivaldiZone::setPeerLink(NetPoint* netpoint, double bw_in, double bw_out, s
 
   std::string link_up      = "link_" + netpoint->get_name() + "_UP";
   std::string link_down    = "link_" + netpoint->get_name() + "_DOWN";
 
   std::string link_up      = "link_" + netpoint->get_name() + "_UP";
   std::string link_down    = "link_" + netpoint->get_name() + "_DOWN";
-  resource::LinkImpl* linkUp   = surf_network_model->createLink(link_up, bw_out, 0, SURF_LINK_SHARED);
-  resource::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, SURF_LINK_SHARED);
+  resource::LinkImpl* linkUp   = surf_network_model->createLink(link_up, bw_out, 0, s4u::Link::SharingPolicy::SHARED);
+  resource::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, s4u::Link::SharingPolicy::SHARED);
   private_links_.insert({netpoint->id(), {linkUp, linkDown}});
 }
 
   private_links_.insert({netpoint->id(), {linkUp, linkDown}});
 }
 
index 035ca86..f7f4a84 100644 (file)
@@ -144,11 +144,11 @@ NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(b
   }
 
   set_maxmin_system(make_new_lmm_system(select));
   }
 
   set_maxmin_system(make_new_lmm_system(select));
-  loopback_     = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
+  loopback_ = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE);
 }
 
 LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,
 }
 
 LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,
-                                       e_surf_link_sharing_policy_t policy)
+                                       s4u::Link::SharingPolicy policy)
 {
   return new NetworkCm02Link(this, name, bandwidth, latency, policy, get_maxmin_system());
 }
 {
   return new NetworkCm02Link(this, name, bandwidth, latency, policy, get_maxmin_system());
 }
@@ -335,7 +335,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
  * Resource *
  ************/
 NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
  * Resource *
  ************/
 NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
-                                 e_surf_link_sharing_policy_t policy, kernel::lmm::System* system)
+                                 s4u::Link::SharingPolicy policy, kernel::lmm::System* system)
     : LinkImpl(model, name, system->constraint_new(this, sg_bandwidth_factor * bandwidth))
 {
   bandwidth_.scale = 1.0;
     : LinkImpl(model, name, system->constraint_new(this, sg_bandwidth_factor * bandwidth))
 {
   bandwidth_.scale = 1.0;
@@ -344,7 +344,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& nam
   latency_.scale = 1.0;
   latency_.peak  = latency;
 
   latency_.scale = 1.0;
   latency_.peak  = latency;
 
-  if (policy == SURF_LINK_FATPIPE)
+  if (policy == s4u::Link::SharingPolicy::FATPIPE)
     get_constraint()->unshare();
 
   simgrid::s4u::Link::onCreation(this->piface_);
     get_constraint()->unshare();
 
   simgrid::s4u::Link::onCreation(this->piface_);
index 2860c7c..f20a8ca 100644 (file)
@@ -33,7 +33,7 @@ public:
   explicit NetworkCm02Model(lmm::System* (*make_new_sys)(bool) = &lmm::make_new_maxmin_system);
   virtual ~NetworkCm02Model() = default;
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
   explicit NetworkCm02Model(lmm::System* (*make_new_sys)(bool) = &lmm::make_new_maxmin_system);
   virtual ~NetworkCm02Model() = default;
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
-                       e_surf_link_sharing_policy_t policy) override;
+                       s4u::Link::SharingPolicy policy) override;
   void update_actions_state_lazy(double now, double delta) override;
   void update_actions_state_full(double now, double delta) override;
   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   void update_actions_state_lazy(double now, double delta) override;
   void update_actions_state_full(double now, double delta) override;
   Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
@@ -46,7 +46,7 @@ public:
 class NetworkCm02Link : public LinkImpl {
 public:
   NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
 class NetworkCm02Link : public LinkImpl {
 public:
   NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
-                  e_surf_link_sharing_policy_t policy, lmm::System* system);
+                  s4u::Link::SharingPolicy policy, lmm::System* system);
   virtual ~NetworkCm02Link() = default;
   void apply_event(tmgr_trace_event_t event, double value) override;
   void setBandwidth(double value) override;
   virtual ~NetworkCm02Link() = default;
   void apply_event(tmgr_trace_event_t event, double value) override;
   void setBandwidth(double value) override;
index be5f87c..2b7ca29 100644 (file)
@@ -23,7 +23,7 @@ namespace simgrid {
 namespace kernel {
 namespace resource {
 LinkImpl* NetworkConstantModel::createLink(const std::string& name, double bw, double lat,
 namespace kernel {
 namespace resource {
 LinkImpl* NetworkConstantModel::createLink(const std::string& name, double bw, double lat,
-                                           e_surf_link_sharing_policy_t policy)
+                                           s4u::Link::SharingPolicy policy)
 {
 
   xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
 {
 
   xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
index c2219d9..d8e37a7 100644 (file)
@@ -31,22 +31,21 @@ public:
   double next_occuring_event(double now) override;
   void update_actions_state(double now, double delta) override;
 
   double next_occuring_event(double now) override;
   void update_actions_state(double now, double delta) override;
 
-  LinkImpl* createLink(const std::string& name, double bw, double lat, e_surf_link_sharing_policy_t policy) override;
-    };
-
-    /**********
-     * Action *
-     **********/
-    class NetworkConstantAction : public NetworkAction {
-    public:
-      NetworkConstantAction(NetworkConstantModel *model_, double size, double latency);
-      ~NetworkConstantAction();
-      double initialLatency_;
-      void update_remains_lazy(double now) override;
-    };
-
-  }
+  LinkImpl* createLink(const std::string& name, double bw, double lat, s4u::Link::SharingPolicy policy) override;
+};
+
+/**********
+ * Action *
+ **********/
+class NetworkConstantAction : public NetworkAction {
+public:
+  NetworkConstantAction(NetworkConstantModel* model_, double size, double latency);
+  ~NetworkConstantAction();
+  double initialLatency_;
+  void update_remains_lazy(double now) override;
+};
 }
 }
+} // namespace kernel
 } // namespace simgrid
 
 #endif /* NETWORK_CONSTANT_HPP_ */
 } // namespace simgrid
 
 #endif /* NETWORK_CONSTANT_HPP_ */
index 8298151..0e42ab1 100644 (file)
@@ -48,7 +48,7 @@ public:
    * @param policy The sharing policy of the Link
    */
   virtual LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
    * @param policy The sharing policy of the Link
    */
   virtual LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
-                               e_surf_link_sharing_policy_t policy) = 0;
+                               s4u::Link::SharingPolicy policy) = 0;
 
   /**
    * @brief Create a communication between two hosts.
 
   /**
    * @brief Create a communication between two hosts.
index 13642d0..6fc7185 100644 (file)
@@ -174,7 +174,7 @@ NetworkNS3Model::~NetworkNS3Model() {
 }
 
 LinkImpl* NetworkNS3Model::createLink(const std::string& name, double bandwidth, double latency,
 }
 
 LinkImpl* NetworkNS3Model::createLink(const std::string& name, double bandwidth, double latency,
-                                      e_surf_link_sharing_policy_t policy)
+                                      s4u::Link::SharingPolicy policy)
 {
   return new LinkNS3(this, name, bandwidth, latency);
 }
 {
   return new LinkNS3(this, name, bandwidth, latency);
 }
index 27e8058..97eba7a 100644 (file)
@@ -19,7 +19,7 @@ public:
   NetworkNS3Model();
   ~NetworkNS3Model();
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
   NetworkNS3Model();
   ~NetworkNS3Model();
   LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
-                       e_surf_link_sharing_policy_t policy) override;
+                       s4u::Link::SharingPolicy policy) override;
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   double next_occuring_event(double now) override;
   bool next_occuring_event_is_idempotent() override { return false; }
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
   double next_occuring_event(double now) override;
   bool next_occuring_event_is_idempotent() override { return false; }
index f2edb25..b26fa21 100644 (file)
@@ -57,7 +57,7 @@ NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys)
     : NetworkModel(Model::UpdateAlgo::Full), hostModel_(hmodel)
 {
   set_maxmin_system(sys);
     : NetworkModel(Model::UpdateAlgo::Full), hostModel_(hmodel)
 {
   set_maxmin_system(sys);
-  loopback_     = NetworkL07Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
+  loopback_ = NetworkL07Model::createLink("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE);
 }
 
 NetworkL07Model::~NetworkL07Model()
 }
 
 NetworkL07Model::~NetworkL07Model()
@@ -228,7 +228,7 @@ Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host,  std::vector<double> *spee
 }
 
 kernel::resource::LinkImpl* NetworkL07Model::createLink(const std::string& name, double bandwidth, double latency,
 }
 
 kernel::resource::LinkImpl* NetworkL07Model::createLink(const std::string& name, double bandwidth, double latency,
-                                                        e_surf_link_sharing_policy_t policy)
+                                                        s4u::Link::SharingPolicy policy)
 {
   return new LinkL07(this, name, bandwidth, latency, policy);
 }
 {
   return new LinkL07(this, name, bandwidth, latency, policy);
 }
@@ -245,13 +245,13 @@ CpuL07::CpuL07(CpuL07Model* model, simgrid::s4u::Host* host, std::vector<double>
 CpuL07::~CpuL07()=default;
 
 LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
 CpuL07::~CpuL07()=default;
 
 LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
-                 e_surf_link_sharing_policy_t policy)
+                 s4u::Link::SharingPolicy policy)
     : LinkImpl(model, name, model->get_maxmin_system()->constraint_new(this, bandwidth))
 {
   bandwidth_.peak = bandwidth;
   latency_.peak   = latency;
 
     : LinkImpl(model, name, model->get_maxmin_system()->constraint_new(this, bandwidth))
 {
   bandwidth_.peak = bandwidth;
   latency_.peak   = latency;
 
-  if (policy == SURF_LINK_FATPIPE)
+  if (policy == s4u::Link::SharingPolicy::FATPIPE)
     get_constraint()->unshare();
 
   s4u::Link::onCreation(this->piface_);
     get_constraint()->unshare();
 
   s4u::Link::onCreation(this->piface_);
index e0a8ae9..ae232a5 100644 (file)
@@ -58,7 +58,7 @@ public:
   NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
   ~NetworkL07Model();
   kernel::resource::LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
   NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
   ~NetworkL07Model();
   kernel::resource::LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
-                                         e_surf_link_sharing_policy_t policy) override;
+                                         s4u::Link::SharingPolicy policy) override;
 
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
 
 
   kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
 
@@ -90,7 +90,7 @@ protected:
 class LinkL07 : public kernel::resource::LinkImpl {
 public:
   LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
 class LinkL07 : public kernel::resource::LinkImpl {
 public:
   LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
-          e_surf_link_sharing_policy_t policy);
+          s4u::Link::SharingPolicy policy);
   ~LinkL07() override;
   bool is_used() override;
   void apply_event(tmgr_trace_event_t event, double value) override;
   ~LinkL07() override;
   bool is_used() override;
   void apply_event(tmgr_trace_event_t event, double value) override;
index c8057ad..472a5a5 100644 (file)
@@ -113,7 +113,7 @@ void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link)
 {
   std::vector<std::string> names;
 
 {
   std::vector<std::string> names;
 
-  if (link->policy == SURF_LINK_SPLITDUPLEX) {
+  if (link->policy == simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX) {
     names.push_back(link->id+ "_UP");
     names.push_back(link->id+ "_DOWN");
   } else {
     names.push_back(link->id+ "_UP");
     names.push_back(link->id+ "_DOWN");
   } else {
@@ -219,7 +219,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster
       link.id        = tmp_link;
       link.bandwidth = cluster->loopback_bw;
       link.latency   = cluster->loopback_lat;
       link.id        = tmp_link;
       link.bandwidth = cluster->loopback_bw;
       link.latency   = cluster->loopback_lat;
-      link.policy    = SURF_LINK_FATPIPE;
+      link.policy    = simgrid::s4u::Link::SharingPolicy::FATPIPE;
       sg_platf_new_link(&link);
       linkUp   = simgrid::kernel::resource::LinkImpl::byName(tmp_link);
       linkDown = simgrid::kernel::resource::LinkImpl::byName(tmp_link);
       sg_platf_new_link(&link);
       linkUp   = simgrid::kernel::resource::LinkImpl::byName(tmp_link);
       linkDown = simgrid::kernel::resource::LinkImpl::byName(tmp_link);
@@ -239,7 +239,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster
       link.id        = tmp_link;
       link.bandwidth = cluster->limiter_link;
       link.latency = 0;
       link.id        = tmp_link;
       link.bandwidth = cluster->limiter_link;
       link.latency = 0;
-      link.policy = SURF_LINK_SHARED;
+      link.policy    = simgrid::s4u::Link::SharingPolicy::SHARED;
       sg_platf_new_link(&link);
       linkDown = simgrid::kernel::resource::LinkImpl::byName(tmp_link);
       linkUp   = linkDown;
       sg_platf_new_link(&link);
       linkDown = simgrid::kernel::resource::LinkImpl::byName(tmp_link);
       linkUp   = linkDown;
@@ -312,7 +312,7 @@ void sg_platf_new_cabinet(simgrid::kernel::routing::CabinetCreationArgs* cabinet
     sg_platf_new_host(&host);
 
     simgrid::kernel::routing::LinkCreationArgs link;
     sg_platf_new_host(&host);
 
     simgrid::kernel::routing::LinkCreationArgs link;
-    link.policy    = SURF_LINK_SPLITDUPLEX;
+    link.policy    = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
     link.latency   = cabinet->lat;
     link.bandwidth = cabinet->bw;
     link.id        = "link_" + hostname;
     link.latency   = cabinet->lat;
     link.bandwidth = cabinet->bw;
     link.id        = "link_" + hostname;
index 1b0f935..0871cd4 100644 (file)
 #define SG_PLATF_H
 
 #include "simgrid/host.h"
 #define SG_PLATF_H
 
 #include "simgrid/host.h"
+#include "simgrid/s4u/Link.hpp"
 #include "src/surf/xml/platf.hpp"
 #include "src/surf/xml/simgrid_dtd.h"
 #include "src/surf/xml/platf.hpp"
 #include "src/surf/xml/simgrid_dtd.h"
+
 #include <map>
 #include <string>
 #include <vector>
 #include <map>
 #include <string>
 #include <vector>
@@ -56,7 +58,7 @@ public:
   double latency                      = 0;
   tmgr_trace_t latency_trace          = nullptr;
   tmgr_trace_t state_trace            = nullptr;
   double latency                      = 0;
   tmgr_trace_t latency_trace          = nullptr;
   tmgr_trace_t state_trace            = nullptr;
-  e_surf_link_sharing_policy_t policy = SURF_LINK_FATPIPE;
+  simgrid::s4u::Link::SharingPolicy policy       = simgrid::s4u::Link::SharingPolicy::FATPIPE;
   std::map<std::string, std::string>* properties = nullptr;
 };
 
   std::map<std::string, std::string>* properties = nullptr;
 };
 
@@ -102,8 +104,8 @@ public:
   std::string topo_parameters;
   std::map<std::string, std::string>* properties;
   std::string router_id;
   std::string topo_parameters;
   std::map<std::string, std::string>* properties;
   std::string router_id;
-  e_surf_link_sharing_policy_t sharing_policy;
-  e_surf_link_sharing_policy_t bb_sharing_policy;
+  simgrid::s4u::Link::SharingPolicy sharing_policy;
+  simgrid::s4u::Link::SharingPolicy bb_sharing_policy;
 };
 
 class CabinetCreationArgs {
 };
 
 class CabinetCreationArgs {
index db18b63..2b692e9 100644 (file)
@@ -497,17 +497,17 @@ void ETag_surfxml_cluster(){
 
   switch (AX_surfxml_cluster_sharing___policy) {
   case A_surfxml_cluster_sharing___policy_SHARED:
 
   switch (AX_surfxml_cluster_sharing___policy) {
   case A_surfxml_cluster_sharing___policy_SHARED:
-    cluster.sharing_policy = SURF_LINK_SHARED;
+    cluster.sharing_policy = simgrid::s4u::Link::SharingPolicy::SHARED;
     break;
   case A_surfxml_cluster_sharing___policy_FULLDUPLEX:
     XBT_WARN("FULLDUPLEX is now deprecated. Please update your platform file to use SPLITDUPLEX instead.");
     break;
   case A_surfxml_cluster_sharing___policy_FULLDUPLEX:
     XBT_WARN("FULLDUPLEX is now deprecated. Please update your platform file to use SPLITDUPLEX instead.");
-    cluster.sharing_policy = SURF_LINK_SPLITDUPLEX;
+    cluster.sharing_policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
     break;
   case A_surfxml_cluster_sharing___policy_SPLITDUPLEX:
     break;
   case A_surfxml_cluster_sharing___policy_SPLITDUPLEX:
-    cluster.sharing_policy = SURF_LINK_SPLITDUPLEX;
+    cluster.sharing_policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
     break;
   case A_surfxml_cluster_sharing___policy_FATPIPE:
     break;
   case A_surfxml_cluster_sharing___policy_FATPIPE:
-    cluster.sharing_policy = SURF_LINK_FATPIPE;
+    cluster.sharing_policy = simgrid::s4u::Link::SharingPolicy::FATPIPE;
     break;
   default:
     surf_parse_error(std::string("Invalid cluster sharing policy for cluster ") + cluster.id);
     break;
   default:
     surf_parse_error(std::string("Invalid cluster sharing policy for cluster ") + cluster.id);
@@ -515,10 +515,10 @@ void ETag_surfxml_cluster(){
   }
   switch (AX_surfxml_cluster_bb___sharing___policy) {
   case A_surfxml_cluster_bb___sharing___policy_FATPIPE:
   }
   switch (AX_surfxml_cluster_bb___sharing___policy) {
   case A_surfxml_cluster_bb___sharing___policy_FATPIPE:
-    cluster.bb_sharing_policy = SURF_LINK_FATPIPE;
+    cluster.bb_sharing_policy = simgrid::s4u::Link::SharingPolicy::FATPIPE;
     break;
   case A_surfxml_cluster_bb___sharing___policy_SHARED:
     break;
   case A_surfxml_cluster_bb___sharing___policy_SHARED:
-    cluster.bb_sharing_policy = SURF_LINK_SHARED;
+    cluster.bb_sharing_policy = simgrid::s4u::Link::SharingPolicy::SHARED;
     break;
   default:
     surf_parse_error(std::string("Invalid bb sharing policy in cluster ") + cluster.id);
     break;
   default:
     surf_parse_error(std::string("Invalid bb sharing policy in cluster ") + cluster.id);
@@ -587,17 +587,17 @@ void ETag_surfxml_link(){
 
   switch (A_surfxml_link_sharing___policy) {
   case A_surfxml_link_sharing___policy_SHARED:
 
   switch (A_surfxml_link_sharing___policy) {
   case A_surfxml_link_sharing___policy_SHARED:
-    link.policy = SURF_LINK_SHARED;
+    link.policy = simgrid::s4u::Link::SharingPolicy::SHARED;
     break;
   case A_surfxml_link_sharing___policy_FATPIPE:
     break;
   case A_surfxml_link_sharing___policy_FATPIPE:
-     link.policy = SURF_LINK_FATPIPE;
-     break;
+    link.policy = simgrid::s4u::Link::SharingPolicy::FATPIPE;
+    break;
   case A_surfxml_link_sharing___policy_FULLDUPLEX:
     XBT_WARN("FULLDUPLEX is now deprecated. Please update your platform file to use SPLITDUPLEX instead.");
   case A_surfxml_link_sharing___policy_FULLDUPLEX:
     XBT_WARN("FULLDUPLEX is now deprecated. Please update your platform file to use SPLITDUPLEX instead.");
-    link.policy = SURF_LINK_SPLITDUPLEX;
+    link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
     break;
   case A_surfxml_link_sharing___policy_SPLITDUPLEX:
     break;
   case A_surfxml_link_sharing___policy_SPLITDUPLEX:
-    link.policy = SURF_LINK_SPLITDUPLEX;
+    link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX;
     break;
   default:
     surf_parse_error(std::string("Invalid sharing policy in link ") + link.id);
     break;
   default:
     surf_parse_error(std::string("Invalid sharing policy in link ") + link.id);
@@ -648,7 +648,7 @@ void ETag_surfxml_backbone(){
   link.id = std::string(A_surfxml_backbone_id);
   link.bandwidth = surf_parse_get_bandwidth(A_surfxml_backbone_bandwidth, "bandwidth of backbone", link.id.c_str());
   link.latency = surf_parse_get_time(A_surfxml_backbone_latency, "latency of backbone", link.id.c_str());
   link.id = std::string(A_surfxml_backbone_id);
   link.bandwidth = surf_parse_get_bandwidth(A_surfxml_backbone_bandwidth, "bandwidth of backbone", link.id.c_str());
   link.latency = surf_parse_get_time(A_surfxml_backbone_latency, "latency of backbone", link.id.c_str());
-  link.policy = SURF_LINK_SHARED;
+  link.policy     = simgrid::s4u::Link::SharingPolicy::SHARED;
 
   sg_platf_new_link(&link);
   routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::byName(A_surfxml_backbone_id));
 
   sg_platf_new_link(&link);
   routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::byName(A_surfxml_backbone_id));