X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5faf49cdf3f8ad8751317b857a6d3134fe07eda3..f7ec298174c4a06224656796dc5cd1594a863070:/src/surf/surf_routing.hpp diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index 960314f2bc..d0ae19bf62 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -1,20 +1,26 @@ #include "surf.hpp" +#include #ifndef NETWORK_ROUTING_HPP_ #define NETWORK_ROUTING_HPP_ void routing_model_create( void *loopback); +/* ************************************************************************** */ +/* ************************* GRAPH EXPORTING FUNCTIONS ********************** */ +xbt_node_t new_xbt_graph_node (xbt_graph_t graph, const char *name, xbt_dict_t nodes); +xbt_edge_t new_xbt_graph_edge (xbt_graph_t graph, xbt_node_t s, xbt_node_t d, xbt_dict_t edges); + /*********** * Classes * ***********/ -class As; +struct As; typedef As *AsPtr; class RoutingModelDescription; typedef RoutingModelDescription *RoutingModelDescriptionPtr; -class RoutingEdge; +struct RoutingEdge; typedef RoutingEdge *RoutingEdgePtr; class Onelink; @@ -23,15 +29,7 @@ typedef Onelink *OnelinkPtr; class RoutingPlatf; typedef RoutingPlatf *RoutingPlatfPtr; - -/*FIXME:class RoutingModelDescription { - const char *p_name; - const char *p_desc; - AsPtr create(); - void end(AsPtr as); -};*/ - -class As { +struct As { public: xbt_dynar_t p_indexNetworkElm; xbt_dict_t p_bypassRoutes; /* store bypass routes */ @@ -44,7 +42,10 @@ public: xbt_dynar_t p_linkUpDownList; As(){}; - ~As(){}; + virtual ~As(){ + xbt_free(p_name); + }; + virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency)=0; virtual xbt_dynar_t getOneLinkRoutes()=0; virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0; @@ -61,8 +62,9 @@ public: virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0; }; -class RoutingEdge { +struct RoutingEdge { public: + ~RoutingEdge() { xbt_free(p_name);}; AsPtr p_rcComponent; e_surf_network_element_type_t p_rcType; int m_id; @@ -74,17 +76,21 @@ public: */ class Onelink { public: + Onelink(void *link, RoutingEdgePtr src, RoutingEdgePtr dst) + : p_src(src), p_dst(dst), p_link(link) {}; RoutingEdgePtr p_src; RoutingEdgePtr p_dst; - void *p_linkPtr; + void *p_link; }; class RoutingPlatf { public: + ~RoutingPlatf(); AsPtr p_root; void *p_loopback; xbt_dynar_t p_lastRoute; xbt_dynar_t getOneLinkRoutes(void); + xbt_dynar_t recursiveGetOneLinkRoutes(AsPtr rc); void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, xbt_dynar_t * links, double *latency); };