+ xbt_assert(SD_workstation_get_number() > 0, "There is no workstation!");
+
+ if (sd_global->workstation_list == NULL) { /* this is the first time the function is called */
+ sd_global->workstation_list =
+ xbt_new(SD_workstation_t, xbt_lib_length(host_lib));
+
+ i = 0;
+ xbt_lib_foreach(host_lib, cursor, key, data) {
+ if(data[SD_HOST_LEVEL])
+ sd_global->workstation_list[i++] = xbt_dict_cursor_get_elm(cursor);
+ }
+ }
+ return sd_global->workstation_list;
+}
+
+/**
+ * \brief Returns the number of workstations
+ *
+ * \return the number of existing workstations
+ * \see SD_workstation_get_list()
+ */
+int SD_workstation_get_number(void)
+{
+ return xbt_lib_length(host_lib);
+}
+
+/**
+ * \brief Returns the user data of a workstation
+ *
+ * \param workstation a workstation
+ * \return the user data associated with this workstation (can be \c NULL)
+ * \see SD_workstation_set_data()
+ */
+void *SD_workstation_get_data(SD_workstation_t workstation)
+{
+ return SD_workstation_priv(workstation)->data;
+}
+
+/**
+ * \brief Sets the user data of a workstation
+ *
+ * The new data can be \c NULL. The old data should have been freed first
+ * if it was not \c NULL.
+ *
+ * \param workstation a workstation
+ * \param data the new data you want to associate with this workstation
+ * \see SD_workstation_get_data()
+ */
+void SD_workstation_set_data(SD_workstation_t workstation, void *data)
+{
+ SD_workstation_priv(workstation)->data = data;