Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fixed typo in documentation of surf_routing.hpp
[simgrid.git] / src / surf / surf_routing_dijkstra.hpp
1 /* Copyright (c) 2013-2014. 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 "surf_routing_generic.hpp"
8
9 #ifndef SURF_ROUTING_DIJKSTRA_HPP_
10 #define SURF_ROUTING_DIJKSTRA_HPP_
11
12 typedef struct graph_node_data {
13   int id;
14   int graph_id;                 /* used for caching internal graph id's */
15 } s_graph_node_data_t, *graph_node_data_t;
16
17 typedef struct graph_node_map_element {
18   xbt_node_t node;
19 } s_graph_node_map_element_t, *graph_node_map_element_t;
20
21 typedef struct route_cache_element {
22   int *pred_arr;
23   int size;
24 } s_route_cache_element_t, *route_cache_element_t;
25
26 /***********
27  * Classes *
28  ***********/
29 class AsDijkstra;
30 typedef AsDijkstra *AsDijkstraPtr;
31
32 class AsDijkstra : public AsGeneric {
33 public:
34   AsDijkstra();
35   AsDijkstra(int cached);
36   ~AsDijkstra();
37         xbt_node_t routeGraphNewNode(int id, int graph_id);
38         graph_node_map_element_t nodeMapSearch(int id);
39         void newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route);
40     /**
41      * For each vertex (node) already in the graph,
42      * make sure it also has a loopback link; this loopback
43      * can potentially already be in the graph, and in that
44      * case nothing will be done.
45      *
46      * If no loopback is specified for a node, we will use
47      * the loopback that is provided by the routing platform.
48      *
49      * After this function returns, any node in the graph
50      * will have a loopback attached to it.
51      */
52         void addLoopback();
53         void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat);
54         xbt_dynar_t getOnelinkRoutes();
55         void getRouteAndLatency(sg_platf_route_cbarg_t route, double *lat);
56         void parseASroute(sg_platf_route_cbarg_t route);
57         void parseRoute(sg_platf_route_cbarg_t route);
58         void end();
59
60   xbt_graph_t p_routeGraph;      /* xbt_graph */
61   xbt_dict_t p_graphNodeMap;    /* map */
62   xbt_dict_t p_routeCache;       /* use in cache mode */
63   int m_cached;
64 };
65
66 #endif /* SURF_ROUTING_DIJKSTRA_HPP_ */