Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / include / simgrid / kernel / resource / Resource.hpp
index ebab496..05b5fdd 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004-2019. 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. */
@@ -22,6 +22,20 @@ namespace resource {
  * @details This is the ancestor class of every resources in SimGrid, such as links, CPU or storage
  */
 class XBT_PUBLIC Resource {
+  std::string name_;
+  Model* model_;
+  bool is_on_ = true;
+
+  lmm::Constraint* const constraint_;
+
+protected:
+  struct Metric {
+    double peak;           /**< The peak of the metric, ie its max value */
+    double scale;          /**< Current availability of the metric according to the profiles, in [0,1] */
+    profile::Event* event; /**< The associated profile event associated to the metric */
+  };
+  profile::Event* state_event_ = nullptr;
+
 public:
   /**
    * @brief Constructor of LMM Resources
@@ -35,7 +49,7 @@ public:
   {
   }
 
-  virtual ~Resource();
+  virtual ~Resource() = default;
 
   /** @brief Get the Model of the current Resource */
   Model* get_model() const { return model_; }
@@ -51,7 +65,7 @@ public:
   virtual void apply_event(profile::Event* event, double value) = 0;
 
   /** @brief Check if the current Resource is used (if it currently serves an action) */
-  virtual bool is_used() = 0;
+  virtual bool is_used() const = 0;
 
   /** @brief returns the current load due to activities (in flops per second, byte per second or similar)
    *
@@ -60,8 +74,6 @@ public:
 
   /** @brief Check if the current Resource is active */
   virtual bool is_on() const { return is_on_; }
-  /** @brief Check if the current Resource is shut down */
-  XBT_ATTRIB_DEPRECATED_v325("Please use !is_on()") virtual bool is_off() const { return not is_on_; }
   /** @brief Turn on the current Resource */
   virtual void turn_on() { is_on_ = true; }
   /** @brief Turn off the current Resource */
@@ -69,32 +81,8 @@ public:
   /** @brief setup the profile file with states events (ON or OFF). The profile must contain boolean values. */
   virtual void set_state_profile(profile::Profile* profile);
 
-#ifndef DOXYGEN
-  XBT_ATTRIB_DEPRECATED_v325("Please use Resource::set_state_profile()") virtual void set_state_trace(
-      profile::Profile* profile) { set_state_profile(profile); }
-#endif
-
-private:
-  std::string name_;
-  Model* model_;
-  bool is_on_ = true;
-
-public: /* LMM */
   /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
   lmm::Constraint* get_constraint() const { return constraint_; }
-
-private:
-  kernel::lmm::Constraint* const constraint_;
-
-public:
-  profile::Event* state_event_ = nullptr;
-
-protected:
-  struct Metric {
-    double peak;       /**< The peak of the metric, ie its max value */
-    double scale;      /**< Current availability of the metric according to the profiles, in [0,1] */
-    profile::Event* event; /**< The associated profile event associated to the metric */
-  };
 };
 } // namespace resource
 } // namespace kernel