Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow to add a disk to a host after a load_platform from xml
[simgrid.git] / src / surf / cpu_cas01.hpp
index ed193cb666878ab6c9e75d765cf1b3afdfd52a15..e7e9a57c8526acda7000b4cdf314886f7d14a9c4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-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. */
@@ -6,17 +6,15 @@
 #ifndef SIMGRID_SURF_CPUCAS01_HPP
 #define SIMGRID_SURF_CPUCAS01_HPP
 
-#include "cpu_interface.hpp"
+#include "src/kernel/resource/CpuImpl.hpp"
 #include "xbt/base.h"
 
+namespace simgrid::kernel::resource {
+
 /***********
  * Classes *
  ***********/
 
-namespace simgrid {
-namespace kernel {
-namespace resource {
-
 class XBT_PRIVATE CpuCas01Model;
 class XBT_PRIVATE CpuCas01;
 class XBT_PRIVATE CpuCas01Action;
@@ -39,6 +37,8 @@ public:
  ************/
 
 class CpuCas01 : public CpuImpl {
+  std::function<s4u::Host::CpuFactorCb> factor_cb_ = {};
+
 public:
   using CpuImpl::CpuImpl;
   CpuCas01(const CpuCas01&) = delete;
@@ -49,31 +49,23 @@ public:
   CpuAction* sleep(double duration) override;
   void set_factor_cb(const std::function<s4u::Host::CpuFactorCb>& cb) override;
 
-  bool is_used() const override;
-
 protected:
   void on_speed_change() override;
-
-private:
-  std::function<s4u::Host::CpuFactorCb> factor_cb_ = {};
 };
 
 /**********
  * Action *
  **********/
 class CpuCas01Action : public CpuAction {
+  int requested_core_ = 1;
+
 public:
   CpuCas01Action(Model* model, double cost, bool failed, double speed, lmm::Constraint* constraint, int requested_core);
   CpuCas01Action(const CpuCas01Action&) = delete;
   CpuCas01Action& operator=(const CpuCas01Action&) = delete;
-  int requested_core() const;
-
-private:
-  int requested_core_ = 1;
+  int requested_core() const { return requested_core_; }
 };
 
-} // namespace resource
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::resource
 
 #endif