2 #include "simdag/simdag.h"
3 #include "xbt/sysdep.h" /* xbt_new0 */
7 SD_link_t __SD_link_create(const char *name, void *surf_link, void *data) {
8 xbt_assert0(surf_link != NULL, "surf_link is NULL !");
9 SD_link_data_t sd_data = xbt_new0(s_SD_link_data_t, 1); /* link private data */
10 sd_data->surf_link = surf_link;
12 SD_link_t link = xbt_new0(s_SD_link_t, 1);
13 link->name = xbt_strdup(name);
15 link->sd_data = sd_data;
17 /*link->capacity = capacity;*/
18 /* link->current_bandwidth = bandwidth;
19 link->current_latency = latency;*/
24 /* Returns the user data of a link. The user data can be NULL.
26 void* SD_link_get_data(SD_link_t link) {
27 xbt_assert0(link, "Invalid parameter");
31 /* Sets the user data of a link. The new data can be NULL. The old data should have been freed first if it was not NULL.
33 void SD_link_set_data(SD_link_t link, void *data) {
34 xbt_assert0(link, "Invalid parameter");
38 /* Returns the name of a link. The name can be NULL.
40 const char* SD_link_get_name(SD_link_t link) {
41 xbt_assert0(link, "Invalid parameter");
45 /* Returns the capacity of a link.
48 double SD_link_get_capacity(SD_link_t link) {
49 xbt_assert0(link, "Invalid parameter");
50 return link->capacity;
53 /* Return the current bandwidth of a link.
55 double SD_link_get_current_bandwidth(SD_link_t link) {
56 xbt_assert0(link, "Invalid parameter");
60 /* return link->current_bandwidth;*/
63 /* Return the current latency of a link.
65 double SD_link_get_current_latency(SD_link_t link) {
66 xbt_assert0(link, "Invalid parameter");
70 /* return link->current_latency;*/
73 /* Destroys a link. The user data (if any) should have been destroyed first.
75 void __SD_link_destroy(SD_link_t link) {
76 xbt_assert0(link, "Invalid parameter");
78 if (link->sd_data != NULL)
79 xbt_free(link->sd_data);
81 if (link->name != NULL)