1 /* Copyright (c) 2006-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "simgrid/simdag.h"
10 #include "xbt/sysdep.h"
11 #include "surf/surf.h"
12 #include "simgrid/link.h"
15 * \brief Returns the link list
17 * Use SD_link_get_number() to know the array size.
19 * \return an array of \ref SD_link_t containing all links
20 * \see SD_link_get_number()
22 const SD_link_t *SD_link_get_list(void)
25 xbt_lib_cursor_t cursor;
30 if (sd_global->link_list == NULL) { /* this is the first time the function is called */
31 sd_global->link_list = xbt_new(SD_link_t, xbt_lib_length(link_lib));
34 xbt_lib_foreach(link_lib, cursor, key, data) {
35 sd_global->link_list[i++] = (SD_link_t) data[SD_LINK_LEVEL];
38 return sd_global->link_list;
42 * \brief Returns the number of links
44 * \return the number of existing links
45 * \see SD_link_get_list()
47 int SD_link_get_number(void)
49 return xbt_lib_length(link_lib);