X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3b2cba76f01c60f2dea5ff0b1cb0b30931f90748..77acc38a35db79181c828c39e056c890462ab70b:/include/simgrid/kernel/resource/Resource.hpp diff --git a/include/simgrid/kernel/resource/Resource.hpp b/include/simgrid/kernel/resource/Resource.hpp deleted file mode 100644 index 526237ba40..0000000000 --- a/include/simgrid/kernel/resource/Resource.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/* 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. */ - -#ifndef SIMGRID_KERNEL_RESOURCE_RESOURCE_HPP -#define SIMGRID_KERNEL_RESOURCE_RESOURCE_HPP - -#include -#include -#include -#include - -#include - -namespace simgrid { -namespace kernel { -namespace resource { - -/** @ingroup SURF_interface - * @brief SURF resource interface class - * @details This is the ancestor class of every resources in SimGrid, such as links, CPU or disk - */ -class XBT_PUBLIC Resource { - std::string name_ = "unnamed"; - Model* model_ = nullptr; - bool is_on_ = true; - - lmm::Constraint* 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 profiles, in [0,1] */ - profile::Event* event; /**< The associated profile event associated to the metric */ - }; - profile::Event* state_event_ = nullptr; - -public: - Resource() = default; - virtual ~Resource() = default; - - /** @brief Get the Model of the current Resource */ - Model* get_model() const { return model_; } - Resource* set_model(Model* model); - - /** @brief Get the name of the current Resource */ - const std::string& get_name() const { return name_; } - /** @brief Get the name of the current Resource */ - const char* get_cname() const { return name_.c_str(); } - Resource* set_name(const std::string& name); - - /** @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_; } - Resource* set_constraint(lmm::Constraint* constraint); - - bool operator==(const Resource& other) const { return name_ == other.name_; } - - /** @brief Apply an event of external load event to that resource */ - 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() const = 0; - - /** @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 profile files is ignored.*/ - virtual double get_load() const; - - /** @brief Check if the current Resource is active */ - virtual bool is_on() const { return is_on_; } - /** @brief Turn on the current Resource */ - virtual void turn_on() { is_on_ = true; } - /** @brief Turn off the current Resource */ - virtual void turn_off() { is_on_ = false; } - /** @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); - -}; -} // namespace resource -} // namespace kernel -} // namespace simgrid - -namespace std { -template <> class hash { -public: - std::size_t operator()(const simgrid::kernel::resource::Resource& r) const - { - return (std::size_t)xbt_str_hash(r.get_cname()); - } -}; -} // namespace std - -#endif