X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/702d6d0fe6771c35145c22266e0271c0c7daf0b7..9155a460bc645b1664a3e3acd7a68ba6786f19b2:/src/simdag/sd_workstation.c diff --git a/src/simdag/sd_workstation.c b/src/simdag/sd_workstation.c index 5c25338872..3d842eff6b 100644 --- a/src/simdag/sd_workstation.c +++ b/src/simdag/sd_workstation.c @@ -20,7 +20,6 @@ SD_workstation_t __SD_workstation_create(void *surf_workstation, void *data) { const char *name = SD_workstation_get_name(workstation); xbt_dict_set(sd_global->workstations, name, workstation, __SD_workstation_destroy); /* add the workstation to the dictionary */ - /* TODO: route */ return workstation; } @@ -85,16 +84,34 @@ const char* SD_workstation_get_name(SD_workstation_t workstation) { return surf_workstation_resource->common_public->get_resource_name(workstation->sd_data->surf_workstation); } +/* Returns an new array of links representating the route between two workstations. + */ SD_link_t* SD_workstation_route_get_list(SD_workstation_t src, SD_workstation_t dst) { CHECK_INIT_DONE(); - /* TODO */ - return NULL; + + void *surf_src = src->sd_data->surf_workstation; + void *surf_dst = dst->sd_data->surf_workstation; + + const void **surf_route = surf_workstation_resource->extension_public->get_route(surf_src, surf_dst); + int route_size = surf_workstation_resource->extension_public->get_route_size(surf_src, surf_dst); + + SD_link_t* route = xbt_new0(SD_link_t, route_size); + const char *link_name; + int i; + for (i = 0; i < route_size; i++) { + link_name = surf_workstation_resource->extension_public->get_link_name(surf_route[i]); + route[i] = xbt_dict_get(sd_global->links, link_name); + } + + return route; } +/* Returns the number of links on the route between two workstations. + */ int SD_workstation_route_get_size(SD_workstation_t src, SD_workstation_t dst) { CHECK_INIT_DONE(); - /* TODO */ - return 0; + return surf_workstation_resource->extension_public-> + get_route_size(src->sd_data->surf_workstation, dst->sd_data->surf_workstation); } /* Returns the total power of a workstation. @@ -123,7 +140,5 @@ void __SD_workstation_destroy(void *workstation) { xbt_free(((SD_workstation_t) workstation)->sd_data); } - /* TODO: route */ - xbt_free(workstation); }