Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Please Asan.
[simgrid.git] / include / simgrid / s4u / NetZone.hpp
index bb6fb7fcb9eccc943ce4b9d14ff267d768d5f1da..97ecfbbc71d06d1eb6b295ec2ecc43fab7164d33 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2022. The SimGrid Team. All rights reserved.               */
+/* Copyright (c) 2016-2023. The SimGrid Team. All rights reserved.               */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 #include <map>
 #include <string>
 #include <unordered_map>
+#include <unordered_set>
 #include <utility>
 #include <vector>
 
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
 
 /** @brief Networking Zones
  *
@@ -47,7 +47,7 @@ public:
   std::vector<NetZone*> get_children() const;
 
   std::vector<Host*> get_all_hosts() const;
-  int get_host_count() const;
+  size_t get_host_count() const;
 
   kernel::routing::NetZoneImpl* get_impl() const { return pimpl_; }
 
@@ -93,7 +93,9 @@ private:
 #endif
 
 public:
+  /** \static Add a callback fired on each newly created NetZone */
   static void on_creation_cb(const std::function<void(NetZone const&)>& cb) { on_creation.connect(cb); }
+  /** \static Add a callback fired on each newly sealed NetZone */
   static void on_seal_cb(const std::function<void(NetZone const&)>& cb) { on_seal.connect(cb); }
 
   /**
@@ -142,7 +144,7 @@ public:
   s4u::SplitDuplexLink* create_split_duplex_link(const std::string& name, const std::string& bandwidth);
   s4u::SplitDuplexLink* create_split_duplex_link(const std::string& name, double bandwidth);
 
-  kernel::resource::NetworkModelIntf* get_network_model() const;
+  kernel::resource::NetworkModel* get_network_model() const;
 
   /**
    * @brief Make a router within that NetZone
@@ -153,6 +155,15 @@ public:
 
   /** @brief Seal this netzone configuration */
   NetZone* seal();
+
+  void
+  set_latency_factor_cb(std::function<double(double size, const s4u::Host* src, const s4u::Host* dst,
+                                             const std::vector<s4u::Link*>& /*links*/,
+                                             const std::unordered_set<s4u::NetZone*>& /*netzones*/)> const& cb) const;
+  void
+  set_bandwidth_factor_cb(std::function<double(double size, const s4u::Host* src, const s4u::Host* dst,
+                                               const std::vector<s4u::Link*>& /*links*/,
+                                               const std::unordered_set<s4u::NetZone*>& /*netzones*/)> const& cb) const;
 };
 
 // External constructors so that the types (and the types of their content) remain hidden
@@ -319,7 +330,6 @@ XBT_PUBLIC NetZone* create_dragonfly_zone(const std::string& name, const NetZone
                                           const DragonflyParams& parameters, const ClusterCallbacks& set_callbacks,
                                           double bandwidth, double latency, Link::SharingPolicy sharing_policy);
 
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
 
 #endif /* SIMGRID_S4U_NETZONE_HPP */