X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8d0eaea75f444b5ac20edfca6d4ce04cee7307e7..6a6c1a432ee6568c58d74d31746544e6afabdf6f:/src/simdag/sd_link.c diff --git a/src/simdag/sd_link.c b/src/simdag/sd_link.c index fcfc57858f..6ee5e6f788 100644 --- a/src/simdag/sd_link.c +++ b/src/simdag/sd_link.c @@ -1,82 +1,32 @@ -#include "private.h" -#include "simdag/simdag.h" -#include "xbt/sysdep.h" /* xbt_new0 */ - -/* Creates a link. - */ -SG_link_t __SG_link_create(const char *name, void *surf_link, void *data) { - xbt_assert0(surf_link != NULL, "surf_link is NULL !"); - SG_link_data_t sgdata = xbt_new0(s_SG_link_data_t, 1); /* link private data */ - sgdata->surf_link = surf_link; - - SG_link_t link = xbt_new0(s_SG_link_t, 1); - link->name = xbt_strdup(name); - link->data = data; - link->sgdata = sgdata; +/* Copyright (c) 2006-2015. The SimGrid Team. + * All rights reserved. */ - /*link->capacity = capacity;*/ - /* link->current_bandwidth = bandwidth; - link->current_latency = latency;*/ +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ - return link; -} - -/* Returns the user data of a link. The user data can be NULL. - */ -void* SG_link_get_data(SG_link_t link) { - xbt_assert0(link, "Invalid parameter"); - return link->data; -} - -/* Sets the user data of a link. The data can be NULL. - */ -void SG_link_set_data(SG_link_t link, void *data) { - xbt_assert0(link, "Invalid parameter"); - link->data = data; -} - -/* Returns the name of a link. The name can be NULL. - */ -const char* SG_link_get_name(SG_link_t link) { - xbt_assert0(link, "Invalid parameter"); - return link->name; -} - -/* Returns the capacity of a link. - */ -/* -double SG_link_get_capacity(SG_link_t link) { - xbt_assert0(link, "Invalid parameter"); - return link->capacity; -}*/ - -/* Return the current bandwidth of a link. - */ -double SG_link_get_current_bandwidth(SG_link_t link) { - xbt_assert0(link, "Invalid parameter"); - - /* TODO */ - return 0; - /* return link->current_bandwidth;*/ +#include "private.h" +#include "simgrid/simdag.h" +#include "xbt/dict.h" +#include "xbt/sysdep.h" +#include "surf/surf.h" +#include "simgrid/link.h" + +/** + * \brief Returns the link list + * + * Use SD_link_get_number() to know the array size. + * + * \return an array of \ref SD_link_t containing all links + * \see SD_link_get_number() + */ +const SD_link_t *SD_link_get_list(void) +{ + if (sd_global->link_list == NULL) /* this is the first time the function is called */ + sd_global->link_list = sg_link_list(); + + return sd_global->link_list; } -/* Return the current latency of a link. - */ -double SG_link_get_current_latency(SG_link_t link) { - xbt_assert0(link, "Invalid parameter"); - - /* TODO */ - return 0; - /* return link->current_latency;*/ -} -/* Destroys a link. The user data (if any) should have been destroyed first. - */ -void __SG_link_destroy(SG_link_t link) { - xbt_assert0(link, "Invalid parameter"); - if (link->name) - xbt_free(link->name); - xbt_free(link); -}