Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename networkLinkCreatedCallbacks into Link::onCreation and other cleanups
[simgrid.git] / src / surf / cpu_interface.hpp
index c68e484..12a8e00 100644 (file)
@@ -27,30 +27,6 @@ class CpuPlugin;
  *************/
 XBT_PUBLIC(Cpu*) getActionCpu(CpuAction *action);
 
-/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Cpu creation *
- * @details Callback functions have the following signature: `void(CpuPtr)`
- */
-XBT_PUBLIC_DATA( surf_callback(void, Cpu*)) cpuCreatedCallbacks;
-
-/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Cpu destruction *
- * @details Callback functions have the following signature: `void(CpuPtr)`
- */
-XBT_PUBLIC_DATA( surf_callback(void, Cpu*)) cpuDestructedCallbacks;
-
-/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after Cpu State changed *
- * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
- */
-XBT_PUBLIC_DATA( surf_callback(void, Cpu*, e_surf_resource_state_t, e_surf_resource_state_t)) cpuStateChangedCallbacks;
-
-/** @ingroup SURF_callbacks
- * @brief Callbacks handler which emit the callbacks after CpuAction State changed *
- * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_action_state_t old, e_surf_action_state_t current)`
- */
-XBT_PUBLIC_DATA( surf_callback(void, CpuAction*, e_surf_action_state_t, e_surf_action_state_t)) cpuActionStateChangedCallbacks;
-
 XBT_PUBLIC(void) cpu_add_traces();
 
 /*********
@@ -98,8 +74,8 @@ public:
 */
 XBT_PUBLIC_CLASS Cpu : public simgrid::surf::Resource {
 public:
-  static simgrid::xbt::FacetLevel<simgrid::Host, Cpu> LEVEL;
-  static void init();
+  static simgrid::xbt::Extension<simgrid::Host, Cpu> EXTENSION_ID;
+  static void classInit();
   Cpu();
 
   /**
@@ -172,15 +148,11 @@ public:
   virtual void setPstate(int pstate_index)=0;
   virtual int  getPstate()=0;
 
-  void setState(e_surf_resource_state_t state);
   void plug(simgrid::Host* host);
 
   void addTraces(void);
   simgrid::Host* getHost() { return m_host; }
 
-protected:
-  virtual void onDie() override;
-
 public:
   int m_core = 1;                /* Amount of cores */
   double m_speedPeak;            /*< CPU speed peak, ie max value */
@@ -204,6 +176,11 @@ public:
 XBT_PUBLIC_CLASS CpuAction : public simgrid::surf::Action {
 friend XBT_PUBLIC(Cpu*) getActionCpu(CpuAction *action);
 public:
+/** @brief Callbacks handler which emit the callbacks after CpuAction State changed *
+ * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_action_state_t old, e_surf_action_state_t current)`
+ */
+  static simgrid::surf::signal<void(simgrid::surf::CpuAction*, e_surf_action_state_t, e_surf_action_state_t)> onStateChange;
+
   /** @brief CpuAction constructor */
   CpuAction(simgrid::surf::Model *model, double cost, bool failed)
     : Action(model, cost, failed) {} //FIXME:REMOVE