2 #include "simdag/simdag.h"
3 #include "xbt/sysdep.h" /* xbt_new0 */
7 SG_link_t __SG_link_create(const char *name, void *surf_link, void *data) {
8 xbt_assert0(surf_link != NULL, "surf_link is NULL !");
9 SG_link_data_t sgdata = xbt_new0(s_SG_link_data_t, 1); /* link private data */
10 sgdata->surf_link = surf_link;
12 SG_link_t link = xbt_new0(s_SG_link_t, 1);
13 link->name = xbt_strdup(name);
15 link->sgdata = sgdata;
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* SG_link_get_data(SG_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 SG_link_set_data(SG_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* SG_link_get_name(SG_link_t link) {
41 xbt_assert0(link, "Invalid parameter");
45 /* Returns the capacity of a link.
48 double SG_link_get_capacity(SG_link_t link) {
49 xbt_assert0(link, "Invalid parameter");
50 return link->capacity;
53 /* Return the current bandwidth of a link.
55 double SG_link_get_current_bandwidth(SG_link_t link) {
56 xbt_assert0(link, "Invalid parameter");
60 /* return link->current_bandwidth;*/
63 /* Return the current latency of a link.
65 double SG_link_get_current_latency(SG_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 __SG_link_destroy(SG_link_t link) {
76 xbt_assert0(link, "Invalid parameter");
78 if (link->sgdata != NULL)
79 xbt_free(link->sgdata);
81 if (link->name != NULL)