Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename some symbols around Link::isShared to make their purpose clear
[simgrid.git] / src / surf / surf_routing_dijkstra.hpp
1 /* Copyright (c) 2013-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include <xbt/base.h>
8
9 #include "surf_routing_generic.hpp"
10
11 #ifndef SURF_ROUTING_DIJKSTRA_HPP_
12 #define SURF_ROUTING_DIJKSTRA_HPP_
13
14 typedef struct graph_node_data {
15   int id;
16   int graph_id;                 /* used for caching internal graph id's */
17 } s_graph_node_data_t, *graph_node_data_t;
18
19 typedef struct graph_node_map_element {
20   xbt_node_t node;
21 } s_graph_node_map_element_t, *graph_node_map_element_t;
22
23 typedef struct route_cache_element {
24   int *pred_arr;
25   int size;
26 } s_route_cache_element_t, *route_cache_element_t;
27
28 /***********
29  * Classes *
30  ***********/
31 class XBT_PRIVATE AsDijkstra;
32
33 class AsDijkstra : public AsGeneric {
34 public:
35   AsDijkstra();
36   AsDijkstra(int cached);
37   ~AsDijkstra();
38         xbt_node_t routeGraphNewNode(int id, int graph_id);
39         graph_node_map_element_t nodeMapSearch(int id);
40         void newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route);
41     /**
42      * For each vertex (node) already in the graph,
43      * make sure it also has a loopback link; this loopback
44      * can potentially already be in the graph, and in that
45      * case nothing will be done.
46      *
47      * If no loopback is specified for a node, we will use
48      * the loopback that is provided by the routing platform.
49      *
50      * After this function returns, any node in the graph
51      * will have a loopback attached to it.
52      */
53         void addLoopback();
54         void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat);
55         xbt_dynar_t getOnelinkRoutes();
56         void getRouteAndLatency(sg_platf_route_cbarg_t route, double *lat);
57         void parseASroute(sg_platf_route_cbarg_t route);
58         void parseRoute(sg_platf_route_cbarg_t route);
59         void end();
60
61   xbt_graph_t p_routeGraph;      /* xbt_graph */
62   xbt_dict_t p_graphNodeMap;    /* map */
63   xbt_dict_t p_routeCache;       /* use in cache mode */
64   int m_cached;
65 };
66
67 #endif /* SURF_ROUTING_DIJKSTRA_HPP_ */