Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[cmake/java] copy all native libs in one shot to fix parallel build
[simgrid.git] / src / surf / surf_interface.hpp
index 516a2c9..ea0d647 100644 (file)
@@ -33,17 +33,17 @@ namespace surf {
   private:
     sigc::signal<R, P...> sig_;
   public:
-    template<class T> XBT_ALWAYS_INLINE
-    void connect(T&& slot)
+    template<class U> XBT_ALWAYS_INLINE
+    void connect(U&& slot)
     {
-      sig_.connect(std::forward<T>(slot));
+      sig_.connect(std::forward<U>(slot));
     }
     template<class Res, class... Args> XBT_ALWAYS_INLINE
     void connect(Res(*slot)(Args...))
     {
       sig_.connect(sigc::ptr_fun(slot));
     }
-    template<class... Args>
+    template<class... Args> XBT_ALWAYS_INLINE
     R operator()(Args&&... args) const
     {
       return sig_.emit(std::forward<Args>(args)...);
@@ -414,8 +414,6 @@ namespace surf {
  */
 XBT_PUBLIC_CLASS Resource {
 public:
-  Resource();
-
   /**
    * @brief Constructor of non-LMM Resources
    *
@@ -433,16 +431,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();
 
@@ -466,29 +464,24 @@ 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 */
   lmm_constraint_t getConstraint();
 protected:
-  lmm_constraint_t p_constraint;
+  lmm_constraint_t p_constraint = nullptr;
 };
 
 }