1 #include "simdag/simdag.h"
2 #include "xbt/sysdep.h" /* xbt_new0 */
6 SG_link_t SG_link_create(void *data, const char *name, double capacity, double bandwidth, double latency) {
7 xbt_assert0(capacity >= 0, "Invalid parameter"); /* or capacity > 0 ? */
9 SG_link_t link = xbt_new0(s_SG_link_t, 1);
12 link->name = xbt_strdup(name);
13 link->capacity = capacity;
14 link->current_bandwidth = bandwidth;
15 link->current_latency = latency;
20 /* Returns the user data of a link. The user data can be NULL.
22 void* SG_link_get_data(SG_link_t link) {
23 xbt_assert0(link, "Invalid parameter");
27 /* Sets the user data of a link. The data can be NULL.
29 void SG_link_set_data(SG_link_t link, void *data) {
30 xbt_assert0(link, "Invalid parameter");
34 /* Returns the name of a link. The name can be NULL.
36 const char* SG_link_get_name(SG_link_t link) {
37 xbt_assert0(link, "Invalid parameter");
41 /* Returns the capacity of a link.
43 double SG_link_get_capacity(SG_link_t link) {
44 xbt_assert0(link, "Invalid parameter");
45 return link->capacity;
48 /* Return the current bandwidth of a link.
50 double SG_link_get_current_bandwidth(SG_link_t link) {
51 xbt_assert0(link, "Invalid parameter");
52 return link->current_bandwidth;
55 /* Return the current latency of a link.
57 double SG_link_get_current_latency(SG_link_t link) {
58 xbt_assert0(link, "Invalid parameter");
59 return link->current_latency;
62 /* Destroys a link. The user data (if any) should have been destroyed first.
64 void SG_link_destroy(SG_link_t link) {
65 xbt_assert0(link, "Invalid parameter");