Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SimDag Revolution: SD_workstation becomes sg_host
[simgrid.git] / src / simgrid / host.cpp
index dcde167..b11ac9c 100644 (file)
@@ -59,7 +59,6 @@ xbt_dynar_t sg_hosts_as_dynar(void)
 // ========= Layering madness ==============*
 
 #include "src/msg/msg_private.h" // MSG_host_priv_free. FIXME: killme by initializing that level in msg when used
-#include "src/simdag/simdag_private.h" // __SD_workstation_destroy. FIXME: killme by initializing that level in simdag when used
 #include "src/simix/smx_host_private.h" // SIMIX_host_destroy. FIXME: killme by initializing that level in simix when used
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/surf_routing.hpp"
@@ -74,7 +73,7 @@ void sg_host_init()
          delete static_cast<simgrid::surf::NetCard*>(p);
   });
 
-  SD_HOST_LEVEL = simgrid::s4u::Host::extension_create(__SD_workstation_destroy);
+  SD_HOST_LEVEL = simgrid::s4u::Host::extension_create(NULL);
   SIMIX_HOST_LEVEL = simgrid::s4u::Host::extension_create(SIMIX_host_destroy);
   USER_HOST_LEVEL = simgrid::s4u::Host::extension_create(NULL);
 }
@@ -97,16 +96,6 @@ msg_host_priv_t sg_host_msg(sg_host_t host) {
 void sg_host_msg_set(sg_host_t host, msg_host_priv_t smx_host) {
   host->extension_set(MSG_HOST_LEVEL, smx_host);
 }
-// ========== SimDag Layer ==============
-SD_workstation_priv_t sg_host_sd(sg_host_t host) {
-  return (SD_workstation_priv_t) host->extension(SD_HOST_LEVEL);
-}
-void sg_host_sd_set(sg_host_t host, SD_workstation_priv_t smx_host) {
-  host->extension_set(SD_HOST_LEVEL, smx_host);
-}
-void sg_host_sd_destroy(sg_host_t host) {
-  host->extension_set(SD_HOST_LEVEL, nullptr);
-}
 
 // ========== Simix layer =============
 smx_host_priv_t sg_host_simix(sg_host_t host){
@@ -129,7 +118,7 @@ double sg_host_get_available_speed(sg_host_t host){
  *  @return 1 if the host is active or 0 if it has crashed.
  */
 int sg_host_is_on(sg_host_t host) {
-       return host->isOn();
+       return host->is_on();
 }
 
 /** @brief Returns the number of power states for a host.
@@ -137,7 +126,7 @@ int sg_host_is_on(sg_host_t host) {
  *  See also @ref SURF_plugin_energy.
  */
 int sg_host_get_nb_pstates(sg_host_t host) {
-  return host->getNbPStates();
+  return host->pstates_count();
 }
 
 /** @brief Gets the pstate at which that host currently runs.
@@ -145,18 +134,31 @@ int sg_host_get_nb_pstates(sg_host_t host) {
  *  See also @ref SURF_plugin_energy.
  */
 int sg_host_get_pstate(sg_host_t host) {
-  return host->getPState();
+  return host->pstate();
 }
 /** @brief Sets the pstate at which that host should run.
  *
  *  See also @ref SURF_plugin_energy.
  */
 void sg_host_set_pstate(sg_host_t host,int pstate) {
-  host->setPState(pstate);
+  host->set_pstate(pstate);
 }
 
 /** @brief Get the properties of an host */
 xbt_dict_t sg_host_get_properties(sg_host_t host) {
-  return host->getProperties();
+  return host->properties();
+}
+
+
+/** \ingroup m_host_management
+ * \brief Returns the value of a given host property
+ *
+ * \param host a host
+ * \param name a property name
+ * \return value of a property (or NULL if property not set)
+*/
+const char *sg_host_get_property_value(sg_host_t host, const char *name)
+{
+  return (const char*) xbt_dict_get_or_null(sg_host_get_properties(host), name);
 }