/** @ingroup SURF_interface
* @brief SURF resource interface class
- * @details A resource represent an element of a component (e.g.: a link for the network)
+ * @details This is the ancestor class of every resources in SimGrid, such as links, CPU or storage
*/
XBT_PUBLIC_CLASS Resource {
public:
*/
Resource(Model *model, const char *name, lmm_constraint_t constraint);
- Resource(Model *model, const char *name, lmm_constraint_t constraint, int initiallyOn);
-
- /**
- * @brief Resource constructor
- *
- * @param model Model associated to this Resource
- * @param name The name of the Resource
- * @param initiallyOn the initial state of the Resource
- */
- Resource(Model *model, const char *name, int initiallyOn);
-
virtual ~Resource();
/** @brief Get the Model of the current Resource */
- Model *getModel() const ;
+ Model *getModel() const;
/** @brief Get the name of the current Resource */
- const char *getName() const ;
+ const char *getName() const;
bool operator==(const Resource &other) const;
virtual bool isUsed()=0;
/** @brief Check if the current Resource is active */
- virtual bool isOn();
+ virtual bool isOn() const;
/** @brief Check if the current Resource is shut down */
- virtual bool isOff();
+ virtual bool isOff() const;
/** @brief Turn on the current Resource */
virtual void turnOn();
/** @brief Turn off the current Resource */
private:
const char *name_;
Model *model_;
- bool isOn_;
+ bool isOn_ = 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_t getConstraint();
+ lmm_constraint_t getConstraint() const;
protected:
lmm_constraint_t constraint_ = nullptr;
};