1 /* Copyright (c) 2013-2015. The SimGrid Team.
2 * All rights reserved. */
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. */
9 #include "surf_routing_generic.hpp"
11 #ifndef SURF_ROUTING_DIJKSTRA_HPP_
12 #define SURF_ROUTING_DIJKSTRA_HPP_
14 typedef struct graph_node_data {
16 int graph_id; /* used for caching internal graph id's */
17 } s_graph_node_data_t, *graph_node_data_t;
19 typedef struct graph_node_map_element {
21 } s_graph_node_map_element_t, *graph_node_map_element_t;
23 typedef struct route_cache_element {
26 } s_route_cache_element_t, *route_cache_element_t;
35 class XBT_PRIVATE AsDijkstra;
37 /** Dijkstra routing data: fast initialization, slow lookup, small memory requirements, shortest path routing only */
38 class AsDijkstra : public AsGeneric {
43 AsDijkstra(bool cached);
45 xbt_node_t routeGraphNewNode(int id, int graph_id);
46 graph_node_map_element_t nodeMapSearch(int id);
47 void newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route);
49 * For each vertex (node) already in the graph,
50 * make sure it also has a loopback link; this loopback
51 * can potentially already be in the graph, and in that
52 * case nothing will be done.
54 * If no loopback is specified for a node, we will use
55 * the loopback that is provided by the routing platform.
57 * After this function returns, any node in the graph
58 * will have a loopback attached to it.
61 void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat) override;
62 xbt_dynar_t getOneLinkRoutes() override;
63 void getRouteAndLatency(sg_platf_route_cbarg_t route, double *lat); // FIXME: this function is dangerously not overriding because of diverging prototype
64 void parseASroute(sg_platf_route_cbarg_t route) override;
65 void parseRoute(sg_platf_route_cbarg_t route) override;
68 xbt_graph_t p_routeGraph = nullptr; /* xbt_graph */
69 xbt_dict_t p_graphNodeMap = nullptr; /* map */
70 xbt_dict_t p_routeCache = nullptr; /* use in cache mode */
71 bool m_cached = false;
77 #endif /* SURF_ROUTING_DIJKSTRA_HPP_ */