- virtual void updateRemainingLazy(double now);
- void heapInsert(xbt_heap_t heap, double key, enum heap_action_type hat);
- void heapRemove(xbt_heap_t heap);
- void updateIndexHeap(int i);
- lmm_variable_t getVariable() {return p_variable;}
- double getLastUpdate() {return m_lastUpdate;}
- void refreshLastUpdate() {m_lastUpdate = surf_get_clock();}
- enum heap_action_type getHat() {return m_hat;}
- bool is_linked() {return actionLmmHook::is_linked();}
- void gapRemove();
+ /**
+ * @brief Constructor of non-LMM Resources
+ *
+ * @param model Model associated to this Resource
+ * @param name The name of the Resource
+ */
+ Resource(Model *model, const char *name);
+
+ /**
+ * @brief Constructor of LMM Resources
+ *
+ * @param model Model associated to this Resource
+ * @param name The name of the Resource
+ * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
+ */
+ 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();
+
+ /** @brief Get the name of the current Resource */
+ const char *getName();
+
+ /**
+ * @brief Update the state of the current Resource
+ * @details [TODO]
+ *
+ * @param event_type [TODO]
+ * @param value [TODO]
+ * @param date [TODO]
+ */
+ virtual void updateState(tmgr_trace_event_t event_type, double value, double date)=0;
+
+ /** @brief Check if the current Resource is used (if it currently serves an action) */
+ virtual bool isUsed()=0;
+
+ /** @brief Check if the current Resource is active */
+ virtual bool isOn();
+ /** @brief Check if the current Resource is shut down */
+ virtual bool isOff();
+ /** @brief Turn on the current Resource */
+ virtual void turnOn();
+ /** @brief Turn off the current Resource */
+ virtual void turnOff();
+
+private:
+ const char *p_name;
+ Model *p_model;
+ bool m_isOn;
+
+public: /* LMM */
+ /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component */
+ lmm_constraint_t getConstraint();
+protected:
+ lmm_constraint_t p_constraint = nullptr;