Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Polymorphic base class destructor should be either public virtual or protected non...
[simgrid.git] / include / simgrid / kernel / resource / NetworkModelIntf.hpp
1 /* Copyright (c) 2004-2022. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_KERNEL_RESOURCE_NETWORKMODELINTF_HPP
7 #define SIMGRID_KERNEL_RESOURCE_NETWORKMODELINTF_HPP
8
9 #include <simgrid/forward.h>
10
11 #include <unordered_set>
12 #include <vector>
13
14 namespace simgrid {
15 namespace kernel {
16 namespace resource {
17
18 /** @ingroup SURF_interface
19  * @brief Network Model interface class
20  */
21 class XBT_PUBLIC NetworkModelIntf {
22 protected:
23   ~NetworkModelIntf() = default;
24
25 public:
26   /**
27    * @brief Callback to set the bandwidth and latency factors used in a communication
28    *
29    * This callback offers more flexibility when setting the network factors.
30    * It is an alternative to SimGrid's configs, such as network/latency-factors
31    * and network/bandwidth-factors.
32    *
33    * @param size Communication size in bytes
34    * @param src Source host
35    * @param dst Destination host
36    * @param links Vectors with the links used in this comm
37    * @param netzones Set with NetZones involved in the comm
38    * @return Multiply factor
39    */
40   using NetworkFactorCb = double(double size, const s4u::Host* src, const s4u::Host* dst,
41                                  const std::vector<s4u::Link*>& links,
42                                  const std::unordered_set<s4u::NetZone*>& netzones);
43   /** @brief Configure the latency factor callback */
44   virtual void set_lat_factor_cb(const std::function<NetworkFactorCb>& cb) = 0;
45   /** @brief Configure the bandwidth factor callback */
46   virtual void set_bw_factor_cb(const std::function<NetworkFactorCb>& cb) = 0;
47 };
48
49 } // namespace resource
50 } // namespace kernel
51 } // namespace simgrid
52
53 #endif /* SIMGRID_KERNEL_RESOURCE_NETWORKMODELINTF_HPP */