Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
better leaking than segfaulting
[simgrid.git] / src / surf / surf_interface.hpp
index f175f4c..5855cca 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2004-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2004-2016. 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. */
@@ -378,7 +377,7 @@ public:
 
 protected:
   ActionLmmListPtr p_modifiedSet;
-  lmm_system_t p_maxminSystem;
+  lmm_system_t p_maxminSystem = nullptr;
   e_UM_t p_updateMechanism = UM_UNDEFINED;
   int m_selectiveUpdate;
   xbt_heap_t p_actionHeap;
@@ -434,16 +433,16 @@ public:
    */
   Resource(Model *model, const char *name, lmm_constraint_t constraint);
 
-  Resource(Model *model, const char *name, lmm_constraint_t constraint, e_surf_resource_state_t stateInit);
+  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 stateInit the initial state of the Resource
+   * @param initiallyOn the initial state of the Resource
    */
-  Resource(Model *model, const char *name, e_surf_resource_state_t stateInit);
+  Resource(Model *model, const char *name, int initiallyOn);
 
   virtual ~Resource();
 
@@ -467,23 +466,18 @@ public:
   virtual bool isUsed()=0;
 
   /** @brief Check if the current Resource is active */
-  bool isOn();
+  virtual bool isOn();
+  /** @brief Check if the current Resource is shut down */
+  virtual bool isOff();
   /** @brief Turn on the current Resource */
-  void turnOn();
+  virtual void turnOn();
   /** @brief Turn off the current Resource */
-  void turnOff();
-
-  /** @brief Get the [state](\ref e_surf_resource_state_t) of the current Resource */
-  virtual e_surf_resource_state_t getState();
-  /** @brief Set the [state](\ref e_surf_resource_state_t) of the current Resource */
-  virtual void setState(e_surf_resource_state_t state);
+  virtual void turnOff();
 
 private:
   const char *p_name;
   Model *p_model;
-  bool m_running;
-  e_surf_resource_state_t m_stateCurrent;
-
+  bool m_isOn;
 
 public: /* LMM */
   /** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component */