Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
tiny doc improvements
[simgrid.git] / include / simgrid / kernel / resource / Resource.hpp
index f70ea2d..105e9d3 100644 (file)
@@ -6,7 +6,12 @@
 #ifndef SIMGRID_KERNEL_RESOURCE_RESOURCE_HPP
 #define SIMGRID_KERNEL_RESOURCE_RESOURCE_HPP
 
-#include "src/surf/surf_interface.hpp"
+#include <simgrid/forward.h>
+#include <xbt/signal.hpp>
+#include <xbt/str.h>
+#include <xbt/utility.hpp>
+
+#include <string>
 
 namespace simgrid {
 namespace kernel {
@@ -30,55 +35,52 @@ public:
   virtual ~Resource();
 
   /** @brief Get the Model of the current Resource */
-  Model* model() const;
+  Model* get_model() const;
 
   /** @brief Get the name of the current Resource */
-  const std::string& getName() const;
+  const std::string& get_name() const;
   /** @brief Get the name of the current Resource */
-  const char* getCname() const;
+  const char* get_cname() const;
 
   bool operator==(const Resource& other) const;
 
-  /**
-   * @brief Apply an event of external load event to that resource
-   *
-   * @param event What happened
-   * @param value [TODO]
-   */
-  virtual void apply_event(tmgr_trace_event_t event, double value) = 0;
+  /** @brief Apply an event of external load event to that resource */
+  virtual void apply_event(TraceEvent* event, double value) = 0;
 
   /** @brief Check if the current Resource is used (if it currently serves an action) */
-  virtual bool isUsed() = 0;
+  virtual bool is_used() = 0;
 
-  /** @brief returns the current load (in flops per second, byte per second or similar) */
-  virtual double getLoad();
+  /** @brief returns the current load due to activities (in flops per second, byte per second or similar)
+   *
+   * The load due to external usages modeled by trace files is ignored.*/
+  virtual double get_load();
 
   /** @brief Check if the current Resource is active */
-  virtual bool isOn() const;
+  virtual bool is_on() const;
   /** @brief Check if the current Resource is shut down */
-  virtual bool isOff() const;
+  virtual bool is_off() const;
   /** @brief Turn on the current Resource */
-  virtual void turnOn();
+  virtual void turn_on();
   /** @brief Turn off the current Resource */
-  virtual void turnOff();
+  virtual void turn_off();
 
 private:
   std::string name_;
   Model* model_;
-  bool isOn_ = true;
+  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) */
-  kernel::lmm::Constraint* constraint() const;
+  lmm::Constraint* get_constraint() const;
 
 private:
   kernel::lmm::Constraint* const constraint_ = 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 traces, in [0,1] */
-    tmgr_trace_event_t event; /**< The associated trace event associated to the metric */
+    double peak;       /**< The peak of the metric, ie its max value */
+    double scale;      /**< Current availability of the metric according to the traces, in [0,1] */
+    TraceEvent* event; /**< The associated trace event associated to the metric */
   };
 };
 } // namespace resource
@@ -90,7 +92,7 @@ template <> class hash<simgrid::kernel::resource::Resource> {
 public:
   std::size_t operator()(const simgrid::kernel::resource::Resource& r) const
   {
-    return (std::size_t)xbt_str_hash(r.getCname());
+    return (std::size_t)xbt_str_hash(r.get_cname());
   }
 };
 } // namespace std