]> AND Public Git Repository - simgrid.git/blobdiff - src/kernel/lmm/maxmin.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Extract assignments from expressions.
[simgrid.git] / src / kernel / lmm / maxmin.hpp
index f525dfa55baae99d90f82cb1700519109ba9c591..2ad066c67ed449dbcabe5ef509980dcb903cd203 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2021. 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 "simgrid/s4u/Link.hpp"
 #include "src/surf/surf_interface.hpp"
 #include "xbt/asserts.h"
+#include "xbt/ex.h"
 #include "xbt/mallocator.h"
 
 #include <boost/intrusive/list.hpp>
 #include <cmath>
 #include <limits>
+#include <memory>
 #include <vector>
 
 namespace simgrid {
@@ -141,6 +143,12 @@ namespace lmm {
  */
 class XBT_PUBLIC Element {
 public:
+  // Use rule-of-three, and implicitely disable the move constructor which should be 'noexcept' according to C++ Core
+  // Guidelines.
+  Element()               = default;
+  Element(const Element&) = default;
+  ~Element()              = default;
+
   int get_concurrency() const;
   void decrease_concurrency();
   void increase_concurrency();
@@ -185,6 +193,8 @@ public:
   /** @brief Unshare a constraint. */
   void unshare() { sharing_policy_ = s4u::Link::SharingPolicy::FATPIPE; }
 
+  /** @brief Set how a constraint is shared  */
+  void set_sharing_policy(s4u::Link::SharingPolicy policy) { sharing_policy_ = policy; }
   /** @brief Check how a constraint is shared  */
   s4u::Link::SharingPolicy get_sharing_policy() const { return sharing_policy_; }
 
@@ -529,7 +539,7 @@ public:
                                                                    &Constraint::saturated_constraint_set_hook_>>
       saturated_constraint_set;
 
-  resource::Action::ModifiedSet* modified_set_ = nullptr;
+  std::unique_ptr<resource::Action::ModifiedSet> modified_set_ = nullptr;
 
 private:
   using dyn_light_t = std::vector<int>;
@@ -553,16 +563,13 @@ private:
 
 class XBT_PUBLIC FairBottleneck : public System {
 public:
-  explicit FairBottleneck(bool selective_update) : System(selective_update) {}
+  using System::System;
   void solve() final { bottleneck_solve(); }
 
 private:
   void bottleneck_solve();
 };
 
-XBT_PUBLIC System* make_new_maxmin_system(bool selective_update);
-XBT_PUBLIC System* make_new_fair_bottleneck_system(bool selective_update);
-
 /** @} */
 } // namespace lmm
 } // namespace kernel