From: Martin Quinson Date: Fri, 11 Nov 2011 08:37:49 +0000 (+0100) Subject: kill another "method" away from the "singleton" global_routing X-Git-Tag: exp_20120216~312 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3432ea9894c66b049be0b2ad1465d3677e739e19?hp=7b0f1a694ef1415a42a24db44b0389c865ac7424 kill another "method" away from the "singleton" global_routing OO coding in C is something, but applying the worst possible OO design to C is ... inventive --- diff --git a/src/surf/network.c b/src/surf/network.c index 7ef05330c6..d62882504b 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -585,8 +585,8 @@ static surf_action_t net_communicate(const char *src_name, xbt_dynar_t back_route = NULL; int constraints_per_variable = 0; xbt_dynar_t route; - // I will need this route for some time so require for no cleanup - global_routing->get_route_latency(src_name, dst_name, &route, &latency, 0); + // I need to have the forward and backward routes at the same time, so I don't ask the routing to cleanup the route right away for me + routing_get_route_and_latency(src_name, dst_name, &route, &latency, 0); if (sg_network_fullduplex == 1) { back_route = routing_get_route(dst_name, src_name); diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index 4d79e9b93e..6908940221 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -174,8 +174,6 @@ struct s_routing_global { size_t size_of_link; xbt_dynar_t(*get_route_no_cleanup) (const char *src, const char *dst); xbt_dynar_t(*get_onelink_routes) (void); - void (*get_route_latency)(const char *src, const char *dst, - xbt_dynar_t *route, double *latency, int cleanup); }; XBT_PUBLIC(void) routing_model_create(size_t size_of_link, void *loopback); @@ -183,6 +181,8 @@ XBT_PUBLIC(void) routing_exit(void); XBT_PUBLIC(void) routing_register_callbacks(void); XBT_PUBLIC(xbt_dynar_t) routing_get_route(const char *src, const char *dst); +XBT_PUBLIC(void) routing_get_route_and_latency(const char *src, const char *dst, //FIXME too much functions avail? + xbt_dynar_t * route, double *latency, int cleanup); /** * Resource protected methods diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 55d6ab262f..6bac929dfe 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -589,7 +589,7 @@ static void _get_route_latency(const char *src, const char *dst, /** * \brief Generic function for get_route, get_route_no_cleanup, and get_latency */ -static void get_route_latency(const char *src, const char *dst, +void routing_get_route_and_latency(const char *src, const char *dst, xbt_dynar_t * route, double *latency, int cleanup) { static xbt_dynar_t last_route = NULL; @@ -616,7 +616,7 @@ static void get_route_latency(const char *src, const char *dst, */ xbt_dynar_t routing_get_route(const char *src, const char *dst) { xbt_dynar_t route = NULL; - get_route_latency(src, dst, &route, NULL, 1); + routing_get_route_and_latency(src, dst, &route, NULL, 1); return route; } @@ -633,7 +633,7 @@ xbt_dynar_t routing_get_route(const char *src, const char *dst) { static xbt_dynar_t get_route_no_cleanup(const char *src, const char *dst) { xbt_dynar_t route = NULL; - get_route_latency(src, dst, &route, NULL, 0); + routing_get_route_and_latency(src, dst, &route, NULL, 0); return route; } @@ -697,7 +697,6 @@ void routing_model_create(size_t size_of_links, void *loopback) global_routing->root = NULL; global_routing->get_route_no_cleanup = get_route_no_cleanup; global_routing->get_onelink_routes = get_onelink_routes; - global_routing->get_route_latency = get_route_latency; global_routing->loopback = loopback; global_routing->size_of_link = size_of_links; /* no current routing at moment */