Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill an unimplemented function. Fix #14
[simgrid.git] / src / msg / msg_host.cpp
index da8e2ff..c6a6e3e 100644 (file)
@@ -9,6 +9,7 @@
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "simgrid/simix.h"
+#include "simgrid/Host.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg);
 
@@ -72,7 +73,7 @@ msg_host_t __MSG_host_create(sg_host_t host) // FIXME: don't return our paramete
  */
 msg_host_t MSG_host_by_name(const char *name)
 {
-  return (msg_host_t) xbt_lib_get_elm_or_null(host_lib,name);
+  return simgrid::Host::by_name_or_null(name);
 }
 
 /** \ingroup m_host_management
@@ -179,27 +180,23 @@ void __MSG_host_destroy(msg_host_t host) //FIXME: killme?
  */
 int MSG_get_host_number(void)
 {
-  return xbt_lib_length(host_lib);
+  return xbt_dict_length(host_list);
 }
 
 #ifdef MSG_USE_DEPRECATED
 msg_host_t *MSG_get_host_table(void)
 {
-      void **array;
-    int i = 0;
-    xbt_lib_cursor_t cursor;
-    char *key;
-    void **data;
+  if (xbt_dict_is_empty(host_list))
+    return nullptr;
 
-    if (xbt_lib_length(host_lib) == 0)
-    return NULL;
-    else
-    array = xbt_new0(void *, xbt_lib_length(host_lib));
+  void **array = xbt_new0(void *, xbt_dict_length(host_list));
 
-    xbt_lib_foreach(host_lib, cursor, key, data) {
+    xbt_lib_cursor_t cursor;
+    const char *id;
+    simgrid::Host* host;
+    xbt_dict_foreach(host_list, cursor, id, host)
       if(routing_get_network_element_type(key) == SURF_NETWORK_ELEMENT_HOST)
-        array[i++] = data[MSG_HOST_LEVEL];
-    }
+        array[i++] = host->facet(MSG_HOST_LEVEL);
 
     return (msg_host_t *)array;
 }
@@ -213,18 +210,6 @@ xbt_dynar_t MSG_hosts_as_dynar(void) {
   return sg_hosts_as_dynar();
 }
 
-/** \ingroup m_host_management
- * \brief Return the number of MSG tasks currently running on a
- * #msg_host_t. The external load is not taken in account.
- */
-int MSG_get_host_msgload(msg_host_t h)
-{
-  xbt_assert((h != NULL), "Invalid parameters");
-  xbt_die( "Not implemented yet");
-
-  return (0);
-}
-
 /** \ingroup m_host_management
  * \brief Return the speed of the processor (in flop/s), regardless of 
     the current load on the machine.