Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill another "method" away from the "singleton" global_routing
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 11 Nov 2011 08:37:49 +0000 (09:37 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 11 Nov 2011 08:37:49 +0000 (09:37 +0100)
OO coding in C is something, but applying the worst possible OO design
to C is ... inventive

src/surf/network.c
src/surf/surf_private.h
src/surf/surf_routing.c

index 7ef0533..d628825 100644 (file)
@@ -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);
index 4d79e9b..6908940 100644 (file)
@@ -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
index 55d6ab2..6bac929 100644 (file)
@@ -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 */