SD_workstation_t *workstation_list; /* array of workstations, created only if
necessary in SD_workstation_get_list */
- xbt_dict_t links; /* links */
- int link_count; /* number of links */
SD_link_t *link_list; /* array of links, created only if
necessary in SD_link_get_list */
SD_link_t *recyclable_route; /* array returned by SD_route_get_list
sd_global->workstations = xbt_dict_new();
sd_global->workstation_count = 0;
sd_global->workstation_list = NULL;
- sd_global->links = xbt_dict_new();
- sd_global->link_count = 0;
sd_global->link_list = NULL;
sd_global->recyclable_route = NULL;
sd_global->watch_point_reached = 0;
if (SD_INITIALISED()) {
XBT_DEBUG("Destroying workstation and link dictionaries...");
xbt_dict_free(&sd_global->workstations);
- xbt_dict_free(&sd_global->links);
XBT_DEBUG("Destroying workstation and link arrays if necessary...");
if (sd_global->workstation_list != NULL)
link->sharing_policy = SD_LINK_FATPIPE;
name = SD_link_get_name(link);
- xbt_dict_set(sd_global->links, name, link, __SD_link_destroy); /* add the link to the dictionary */
- sd_global->link_count++;
+ xbt_lib_set(link_lib,name,SD_LINK_LEVEL,link);
return link;
}
const SD_link_t *SD_link_get_list(void)
{
- xbt_dict_cursor_t cursor;
+ xbt_lib_cursor_t cursor;
char *key;
- void *data;
+ void **data;
int i;
SD_CHECK_INIT_DONE();
xbt_assert0(SD_link_get_number() > 0, "There is no link!");
if (sd_global->link_list == NULL) { /* this is the first time the function is called */
- sd_global->link_list = xbt_new(SD_link_t, sd_global->link_count);
+ sd_global->link_list = xbt_new(SD_link_t, link_lib->count);
i = 0;
- xbt_dict_foreach(sd_global->links, cursor, key, data) {
- sd_global->link_list[i++] = (SD_link_t) data;
+ xbt_lib_foreach(link_lib, cursor, key, data) {
+ sd_global->link_list[i++] = (SD_link_t) data[SD_LINK_LEVEL];
}
}
return sd_global->link_list;
int SD_link_get_number(void)
{
SD_CHECK_INIT_DONE();
- return sd_global->link_count;
+ return link_lib->count;
}
/**
xbt_dynar_foreach(surf_route, cpt, surf_link) {
link_name = surf_resource_name(surf_link);
sd_global->recyclable_route[cpt] =
- xbt_dict_get(sd_global->links, link_name);
+ xbt_lib_get_or_null(link_lib, link_name, SD_LINK_LEVEL);
}
return sd_global->recyclable_route;
}