From 850b11f6847edce3023ef068f2df7417691e2df3 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 14 Jan 2016 00:01:00 +0100 Subject: [PATCH 1/1] some simple cleanups in the routing code Overrides where needed, initialize the fields at declaration, kill dead comments and dupplicated fields. As usual. Muuuuch more cleanups to come in that area. --- src/include/surf/surf.h | 8 ++--- src/surf/network_ns3.cpp | 2 +- src/surf/sg_platf.cpp | 2 +- src/surf/surf_routing.cpp | 23 ++++++-------- src/surf/surf_routing.hpp | 8 ++--- src/surf/surf_routing_cluster.cpp | 11 ------- src/surf/surf_routing_cluster.hpp | 36 +++++++++------------- src/surf/surf_routing_cluster_fat_tree.hpp | 16 +++------- src/surf/surf_routing_dijkstra.cpp | 9 ++---- src/surf/surf_routing_dijkstra.hpp | 20 ++++++------ src/surf/surf_routing_floyd.hpp | 24 ++++----------- src/surf/surf_routing_full.cpp | 4 --- src/surf/surf_routing_full.hpp | 23 ++++---------- src/surf/surf_routing_generic.cpp | 5 --- src/surf/surf_routing_generic.hpp | 17 +++++----- src/surf/surf_routing_none.cpp | 9 +----- src/surf/surf_routing_none.hpp | 22 ++++++------- src/surf/surf_routing_vivaldi.cpp | 4 +++ src/surf/surf_routing_vivaldi.hpp | 19 ++---------- 19 files changed, 90 insertions(+), 172 deletions(-) diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index d6cd014cff..275ac07d45 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -35,10 +35,10 @@ extern XBT_PRIVATE int sg_network_crosstraffic; extern XBT_PRIVATE xbt_dynar_t surf_path; typedef enum { - SURF_NETWORK_ELEMENT_NULL = 0, /* NULL */ - SURF_NETWORK_ELEMENT_HOST, /* host type */ - SURF_NETWORK_ELEMENT_ROUTER, /* router type */ - SURF_NETWORK_ELEMENT_AS /* AS type */ + SURF_NETWORK_ELEMENT_NULL = 0, /* NULL */ + SURF_NETWORK_ELEMENT_HOST, /* host type */ + SURF_NETWORK_ELEMENT_ROUTER, /* router type */ + SURF_NETWORK_ELEMENT_AS /* AS type */ } e_surf_network_element_type_t; #ifdef __cplusplus diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 67576e0914..8649f82775 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -231,7 +231,7 @@ static void parse_ns3_end_platform(void) static void define_callbacks_ns3(void) { simgrid::s4u::Host::onCreation.connect(simgrid_ns3_add_host); - simgrid::surf::routingEdgeCreatedCallbacks.connect(simgrid_ns3_add_router); + simgrid::surf::netcardCreatedCallbacks.connect(simgrid_ns3_add_router); sg_platf_link_add_cb (&parse_ns3_add_link); sg_platf_cluster_add_cb (&parse_ns3_add_cluster); simgrid::surf::asCreatedCallbacks.connect(parse_ns3_add_AS); diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 09f9f453c3..a42a5d2f90 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -95,7 +95,7 @@ void sg_platf_new_router(sg_platf_router_cbarg_t router) info->setId(current_routing->parsePU(info)); xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, (void *) info); XBT_DEBUG("Having set name '%s' id '%d'", router->id, info->getId()); - simgrid::surf::routingEdgeCreatedCallbacks(info); + simgrid::surf::netcardCreatedCallbacks(info); if (router->coord && strcmp(router->coord, "")) { unsigned int cursor; diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 71d2e463ca..b9a584ff9e 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -23,7 +23,7 @@ namespace simgrid { namespace surf { -simgrid::xbt::signal routingEdgeCreatedCallbacks; +simgrid::xbt::signal netcardCreatedCallbacks; simgrid::xbt::signal asCreatedCallbacks; } @@ -61,7 +61,7 @@ simgrid::surf::NetCard *sg_netcard_by_name_or_null(const char *name) sg_host_t h = sg_host_by_name(name); simgrid::surf::NetCard *net_elm = h==NULL?NULL: h->pimpl_netcard; if (!net_elm) - net_elm = (simgrid::surf::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL); + net_elm = (simgrid::surf::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL); return net_elm; } @@ -172,7 +172,7 @@ simgrid::surf::NetCard *routing_add_host( sg_host_t h = sg_host_by_name_or_create(host->id); h->pimpl_netcard = netcard; XBT_DEBUG("Having set name '%s' id '%d'", host->id, netcard->getId()); - simgrid::surf::routingEdgeCreatedCallbacks(netcard); + simgrid::surf::netcardCreatedCallbacks(netcard); if(mount_list){ xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list); @@ -339,9 +339,9 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS) /* set the new current component of the tree */ current_routing = new_as; - current_routing->p_netElem = info; + current_routing->p_netcard = info; - simgrid::surf::routingEdgeCreatedCallbacks(info); + simgrid::surf::netcardCreatedCallbacks(info); simgrid::surf::asCreatedCallbacks(new_as); } @@ -495,10 +495,10 @@ static void _get_route_and_latency( route.link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL); // Find the net_card corresponding to father - simgrid::surf::NetCard *src_father_net_elm = src_father->p_netElem; - simgrid::surf::NetCard *dst_father_net_elm = dst_father->p_netElem; + simgrid::surf::NetCard *src_father_netcard = src_father->p_netcard; + simgrid::surf::NetCard *dst_father_netcard = dst_father->p_netcard; - common_father->getRouteAndLatency(src_father_net_elm, dst_father_net_elm, + common_father->getRouteAndLatency(src_father_netcard, dst_father_netcard, &route, latency); xbt_assert((route.gw_src != NULL) && (route.gw_dst != NULL), @@ -516,7 +516,6 @@ static void _get_route_and_latency( if (dst_gateway_net_elm != dst) _get_route_and_latency(dst_gateway_net_elm, dst, links, latency); - // if vivaldi latency+=vivaldi(src_gateway,dst_gateway) } AS_t surf_platf_get_root(routing_platf_t platf){ @@ -544,12 +543,10 @@ namespace surf { * walk through the routing components tree and find a route between hosts * by calling each "get_route" function in each routing component. */ -void RoutingPlatf::getRouteAndLatency( - simgrid::surf::NetCard *src, simgrid::surf::NetCard *dst, - xbt_dynar_t* route, double *latency) +void RoutingPlatf::getRouteAndLatency(NetCard *src, NetCard *dst, xbt_dynar_t* route, double *latency) { XBT_DEBUG("routing_get_route_and_latency from %s to %s", src->getName(), dst->getName()); - if (!*route) { + if (NULL == *route) { xbt_dynar_reset(routing_platf->p_lastRoute); *route = routing_platf->p_lastRoute; } diff --git a/src/surf/surf_routing.hpp b/src/surf/surf_routing.hpp index 600edf1e1e..c3801295dd 100644 --- a/src/surf/surf_routing.hpp +++ b/src/surf/surf_routing.hpp @@ -55,7 +55,7 @@ public: char *p_name = nullptr; As *p_routingFather = nullptr; xbt_dict_t p_routingSons = xbt_dict_new_homogeneous(NULL); - NetCard *p_netElem; + NetCard *p_netcard; xbt_dynar_t p_linkUpDownList = NULL; /** @@ -71,8 +71,8 @@ public: xbt_dynar_free(&p_indexNetworkElm); xbt_dynar_free(&p_linkUpDownList); xbt_free(p_name); - if (p_netElem) - delete p_netElem; + if (p_netcard) + delete p_netcard; }; /** @@ -161,7 +161,7 @@ public: * Callbacks * *************/ -XBT_PUBLIC_DATA(simgrid::xbt::signal) routingEdgeCreatedCallbacks; +XBT_PUBLIC_DATA(simgrid::xbt::signal) netcardCreatedCallbacks; XBT_PUBLIC_DATA(simgrid::xbt::signal) asCreatedCallbacks; } diff --git a/src/surf/surf_routing_cluster.cpp b/src/surf/surf_routing_cluster.cpp index 4c924192d5..6c284fc59e 100644 --- a/src/surf/surf_routing_cluster.cpp +++ b/src/surf/surf_routing_cluster.cpp @@ -21,17 +21,6 @@ AS_t model_cluster_create(void) namespace simgrid { namespace surf { -/* Creation routing model functions */ -AsCluster::AsCluster() : AsNone() -{ - p_backbone = 0; - p_loopback = 0; - p_router = 0; - p_has_limiter = 0; - p_has_loopback = 0; - p_nb_links_per_node = 1; -} - /* Business methods */ void AsCluster::getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat) { diff --git a/src/surf/surf_routing_cluster.hpp b/src/surf/surf_routing_cluster.hpp index 4cdb430327..ce935c5cf1 100644 --- a/src/surf/surf_routing_cluster.hpp +++ b/src/surf/surf_routing_cluster.hpp @@ -26,29 +26,21 @@ class XBT_PRIVATE AsCluster; class AsCluster: public AsNone { public: - AsCluster(); - - virtual void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency); - //xbt_dynar_t getOneLinkRoutes(); - //void parseRoute(sg_platf_route_cbarg_t route); - //void parseASroute(sg_platf_route_cbarg_t route); - - void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges); - //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat); - - /* The parser calls the following functions to inform the routing models - * that a new element is added to the AS currently built. - * - * Of course, only the routing model of this AS is informed, not every ones */ - int parsePU(NetCard *elm); /* A host or a router, whatever */ - int parseAS(NetCard *elm); + AsCluster() {} + + virtual void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; + void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; + + int parsePU(NetCard *elm) override; /* A host or a router, whatever */ + int parseAS(NetCard *elm) override; virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position); - Link* p_backbone; - void *p_loopback; - NetCard *p_router; - int p_has_limiter; - int p_has_loopback; - int p_nb_links_per_node; + + Link* p_backbone = nullptr; + void *p_loopback = nullptr; + NetCard *p_router = nullptr; + int p_has_limiter = 0; + int p_has_loopback = 0; + int p_nb_links_per_node = 1; }; diff --git a/src/surf/surf_routing_cluster_fat_tree.hpp b/src/surf/surf_routing_cluster_fat_tree.hpp index 30253876e8..9b5d8873a8 100644 --- a/src/surf/surf_routing_cluster_fat_tree.hpp +++ b/src/surf/surf_routing_cluster_fat_tree.hpp @@ -80,17 +80,13 @@ class FatTreeLink { public: FatTreeLink(sg_platf_cluster_cbarg_t cluster, FatTreeNode *source, FatTreeNode *destination); - /** Link going up in the tree - */ + /** Link going up in the tree */ Link *upLink; - /** Link going down in the tree - */ + /** Link going down in the tree */ Link *downLink; - /** Upper end of the link - */ + /** Upper end of the link */ FatTreeNode *upNode; - /** Lower end of the link - */ + /** Lower end of the link */ FatTreeNode *downNode; }; @@ -121,7 +117,7 @@ public: ~AsClusterFatTree(); virtual void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, - double *latency); + double *latency) override; /** \brief Generate the fat tree * @@ -135,8 +131,6 @@ public: * It will also store the cluster for future use. */ void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster); - /** \brief Add a processing node. - */ void addProcessingNode(int id); void generateDotFile(const std::string& filename = "fatTree.dot") const; diff --git a/src/surf/surf_routing_dijkstra.cpp b/src/surf/surf_routing_dijkstra.cpp index 62776a1bd4..c6afb1f468 100644 --- a/src/surf/surf_routing_dijkstra.cpp +++ b/src/surf/surf_routing_dijkstra.cpp @@ -176,7 +176,7 @@ void AsDijkstra::addLoopback() { } } -xbt_dynar_t AsDijkstra::getOnelinkRoutes() +xbt_dynar_t AsDijkstra::getOneLinkRoutes() { xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f); sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1); @@ -409,13 +409,10 @@ AsDijkstra::~AsDijkstra() /* Creation routing model functions */ -AsDijkstra::AsDijkstra() : AsGeneric(), m_cached(0) { - p_routeGraph = NULL; - p_graphNodeMap = NULL; - p_routeCache = NULL; +AsDijkstra::AsDijkstra() : AsGeneric() { } -AsDijkstra::AsDijkstra(int cached) : AsGeneric(), m_cached(cached) +AsDijkstra::AsDijkstra(bool cached) : AsGeneric(), m_cached(cached) { p_routeGraph = NULL; p_graphNodeMap = NULL; diff --git a/src/surf/surf_routing_dijkstra.hpp b/src/surf/surf_routing_dijkstra.hpp index 9450b2e446..a5ef07e3ed 100644 --- a/src/surf/surf_routing_dijkstra.hpp +++ b/src/surf/surf_routing_dijkstra.hpp @@ -37,7 +37,7 @@ class XBT_PRIVATE AsDijkstra; class AsDijkstra : public AsGeneric { public: AsDijkstra(); - AsDijkstra(int cached); + AsDijkstra(bool cached); ~AsDijkstra(); xbt_node_t routeGraphNewNode(int id, int graph_id); graph_node_map_element_t nodeMapSearch(int id); @@ -55,17 +55,17 @@ public: * will have a loopback attached to it. */ void addLoopback(); - void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat); - xbt_dynar_t getOnelinkRoutes(); - void getRouteAndLatency(sg_platf_route_cbarg_t route, double *lat); - void parseASroute(sg_platf_route_cbarg_t route); - void parseRoute(sg_platf_route_cbarg_t route); + void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t route, double *lat) override; + xbt_dynar_t getOneLinkRoutes() override; + void getRouteAndLatency(sg_platf_route_cbarg_t route, double *lat); // FIXME: this function is dangerously not overriding because of diverging prototype + void parseASroute(sg_platf_route_cbarg_t route) override; + void parseRoute(sg_platf_route_cbarg_t route) override; void end(); - xbt_graph_t p_routeGraph; /* xbt_graph */ - xbt_dict_t p_graphNodeMap; /* map */ - xbt_dict_t p_routeCache; /* use in cache mode */ - int m_cached; + xbt_graph_t p_routeGraph = nullptr; /* xbt_graph */ + xbt_dict_t p_graphNodeMap = nullptr; /* map */ + xbt_dict_t p_routeCache = nullptr; /* use in cache mode */ + bool m_cached = false; }; } diff --git a/src/surf/surf_routing_floyd.hpp b/src/surf/surf_routing_floyd.hpp index 1302a84e9b..5f498f4357 100644 --- a/src/surf/surf_routing_floyd.hpp +++ b/src/surf/surf_routing_floyd.hpp @@ -25,26 +25,14 @@ public: AsFloyd(); ~AsFloyd(); - void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency); - xbt_dynar_t getOneLinkRoutes(); - void parseASroute(sg_platf_route_cbarg_t route); - void parseRoute(sg_platf_route_cbarg_t route); + void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; + xbt_dynar_t getOneLinkRoutes() override; + void parseASroute(sg_platf_route_cbarg_t route) override; + void parseRoute(sg_platf_route_cbarg_t route) override; void end(); - //void parseASroute(sg_platf_route_cbarg_t route); - //void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges); - //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat); - - /* The parser calls the following functions to inform the routing models - * that a new element is added to the AS currently built. - * - * Of course, only the routing model of this AS is informed, not every ones */ - //int parsePU(RoutingEdge *elm); /* A host or a router, whatever */ - //int parseAS(RoutingEdge *elm); - - //virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0; - - /* vars for calculate the floyd algorith. */ +private: + /* vars to compute the Floyd algorithm. */ int *p_predecessorTable; double *p_costTable; sg_platf_route_cbarg_t *p_linkTable; diff --git a/src/surf/surf_routing_full.cpp b/src/surf/surf_routing_full.cpp index cf8fc2b14c..a3ffd03c52 100644 --- a/src/surf/surf_routing_full.cpp +++ b/src/surf/surf_routing_full.cpp @@ -49,10 +49,6 @@ void model_full_end(AS_t _routing) namespace simgrid { namespace surf { -AsFull::AsFull(){ - p_routingTable = 0; -} - AsFull::~AsFull(){ if (p_routingTable) { int table_size = (int)xbt_dynar_length(p_indexNetworkElm); diff --git a/src/surf/surf_routing_full.hpp b/src/surf/surf_routing_full.hpp index 4a6676f926..c7b662421a 100644 --- a/src/surf/surf_routing_full.hpp +++ b/src/surf/surf_routing_full.hpp @@ -21,27 +21,16 @@ class XBT_PRIVATE AsFull; class AsFull: public AsGeneric { public: - sg_platf_route_cbarg_t *p_routingTable; - AsFull(); + AsFull() {} ~AsFull(); - void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency); - xbt_dynar_t getOneLinkRoutes(); - void parseRoute(sg_platf_route_cbarg_t route); - void parseASroute(sg_platf_route_cbarg_t route); + void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; + xbt_dynar_t getOneLinkRoutes() override; + void parseRoute(sg_platf_route_cbarg_t route) override; + void parseASroute(sg_platf_route_cbarg_t route) override; - //void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges); - //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat); - - /* The parser calls the following functions to inform the routing models - * that a new element is added to the AS currently built. - * - * Of course, only the routing model of this AS is informed, not every ones */ - //virtual int parsePU(RoutingEdge *elm)=0; /* A host or a router, whatever */ - //virtual int parseAS( RoutingEdge *elm)=0; - - //virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0; + sg_platf_route_cbarg_t *p_routingTable = nullptr; }; } diff --git a/src/surf/surf_routing_generic.cpp b/src/surf/surf_routing_generic.cpp index 3173d9c655..982038daf4 100644 --- a/src/surf/surf_routing_generic.cpp +++ b/src/surf/surf_routing_generic.cpp @@ -156,11 +156,6 @@ xbt_edge_t new_xbt_graph_edge(xbt_graph_t graph, xbt_node_t s, xbt_node_t d, namespace simgrid { namespace surf { -xbt_dynar_t AsGeneric::getOneLinkRoutes() { // FIXME: kill that stub - xbt_die("\"generic_get_onelink_routes\" not implemented yet"); - return NULL; -} - void AsGeneric::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) { int src, dst; diff --git a/src/surf/surf_routing_generic.hpp b/src/surf/surf_routing_generic.hpp index 69ba2e9e56..96ffd16dbf 100644 --- a/src/surf/surf_routing_generic.hpp +++ b/src/surf/surf_routing_generic.hpp @@ -21,20 +21,19 @@ public: AsGeneric(); ~AsGeneric(); - virtual void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency); - virtual xbt_dynar_t getOneLinkRoutes(); - virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges); - virtual sg_platf_route_cbarg_t getBypassRoute(NetCard *src, NetCard *dst, double *lat); + virtual void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; + virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; + virtual sg_platf_route_cbarg_t getBypassRoute(NetCard *src, NetCard *dst, double *lat) override; /* The parser calls the following functions to inform the routing models * that a new element is added to the AS currently built. * * Of course, only the routing model of this AS is informed, not every ones */ - virtual int parsePU(NetCard *elm); /* A host or a router, whatever */ - virtual int parseAS(NetCard *elm); - virtual void parseRoute(sg_platf_route_cbarg_t route); - virtual void parseASroute(sg_platf_route_cbarg_t route); - virtual void parseBypassroute(sg_platf_route_cbarg_t e_route); + virtual int parsePU(NetCard *elm) override; /* A host or a router, whatever */ + virtual int parseAS(NetCard *elm) override; + virtual void parseRoute(sg_platf_route_cbarg_t route) override; + virtual void parseASroute(sg_platf_route_cbarg_t route) override; + virtual void parseBypassroute(sg_platf_route_cbarg_t e_route) override; virtual sg_platf_route_cbarg_t newExtendedRoute(e_surf_routing_hierarchy_t hierarchy, sg_platf_route_cbarg_t routearg, int change_order); virtual As *asExist(As *to_find); diff --git a/src/surf/surf_routing_none.cpp b/src/surf/surf_routing_none.cpp index 989730d783..4ba9287b31 100644 --- a/src/surf/surf_routing_none.cpp +++ b/src/surf/surf_routing_none.cpp @@ -51,7 +51,7 @@ int AsNone::parseAS(NetCard *elm) { } void AsNone::parseRoute(sg_platf_route_cbarg_t /*route*/){ - THROW_IMPOSSIBLE; + THROW_IMPOSSIBLE; /* No. */ } void AsNone::parseASroute(sg_platf_route_cbarg_t /*route*/){ @@ -61,12 +61,5 @@ void AsNone::parseBypassroute(sg_platf_route_cbarg_t /*e_route*/){ THROW_IMPOSSIBLE; } -/* Creation routing model functions */ -AsNone::AsNone() { -} - -AsNone::~AsNone() { -} - } } diff --git a/src/surf/surf_routing_none.hpp b/src/surf/surf_routing_none.hpp index a7f1cc9c53..b706f89832 100644 --- a/src/surf/surf_routing_none.hpp +++ b/src/surf/surf_routing_none.hpp @@ -16,23 +16,23 @@ namespace surf { class XBT_PRIVATE AsNone : public As { public: - AsNone(); - ~AsNone(); + AsNone() {} + ~AsNone() {} - void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency); - xbt_dynar_t getOneLinkRoutes(); - void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges); - sg_platf_route_cbarg_t getBypassRoute(NetCard *src, NetCard *dst, double *lat); + void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; + xbt_dynar_t getOneLinkRoutes() override; + void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; + sg_platf_route_cbarg_t getBypassRoute(NetCard *src, NetCard *dst, double *lat) override; /* The parser calls the following functions to inform the routing models * that a new element is added to the AS currently built. * * Of course, only the routing model of this AS is informed, not every ones */ - int parsePU(NetCard *elm); /* A host or a router, whatever */ - int parseAS( NetCard *elm); - void parseRoute(sg_platf_route_cbarg_t route); - void parseASroute(sg_platf_route_cbarg_t route); - void parseBypassroute(sg_platf_route_cbarg_t e_route); + int parsePU(NetCard *elm) override; /* A host or a router, whatever */ + int parseAS( NetCard *elm) override; + void parseRoute(sg_platf_route_cbarg_t route) override; + void parseASroute(sg_platf_route_cbarg_t route) override; + void parseBypassroute(sg_platf_route_cbarg_t e_route) override; }; } diff --git a/src/surf/surf_routing_vivaldi.cpp b/src/surf/surf_routing_vivaldi.cpp index f5ae8aaba9..b31f273e16 100644 --- a/src/surf/surf_routing_vivaldi.cpp +++ b/src/surf/surf_routing_vivaldi.cpp @@ -9,6 +9,10 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_vivaldi, surf, "Routing part of surf"); +#define HOST_PEER(peername) bprintf("peer_%s", peername) +#define ROUTER_PEER(peername) bprintf("router_%s", peername) +#define LINK_PEER(peername) bprintf("link_%s", peername) + static XBT_INLINE double euclidean_dist_comp(int index, xbt_dynar_t src, xbt_dynar_t dst) { double src_coord, dst_coord; diff --git a/src/surf/surf_routing_vivaldi.hpp b/src/surf/surf_routing_vivaldi.hpp index 9ad8f53da4..3641a13960 100644 --- a/src/surf/surf_routing_vivaldi.hpp +++ b/src/surf/surf_routing_vivaldi.hpp @@ -14,9 +14,6 @@ /* ************************************************** */ /* ************** Vivaldi ROUTING **************** */ XBT_PRIVATE AS_t model_vivaldi_create(void); /* create structures for vivaldi routing model */ -#define HOST_PEER(peername) bprintf("peer_%s", peername) -#define ROUTER_PEER(peername) bprintf("router_%s", peername) -#define LINK_PEER(peername) bprintf("link_%s", peername) namespace simgrid { namespace surf { @@ -28,23 +25,11 @@ class XBT_PRIVATE AsVivaldi; class AsVivaldi: public AsGeneric { public: - sg_platf_route_cbarg_t *p_routingTable; - AsVivaldi() : AsGeneric() {}; ~AsVivaldi() {}; - void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency); - //void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges); - //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat); - - /* The parser calls the following functions to inform the routing models - * that a new element is added to the AS currently built. - * - * Of course, only the routing model of this AS is informed, not every ones */ - int parsePU(NetCard *elm); /* A host or a router, whatever */ - //virtual int parseAS( RoutingEdge *elm)=0; - - //virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0; + void getRouteAndLatency(NetCard *src, NetCard *dst, sg_platf_route_cbarg_t into, double *latency) override; + int parsePU(NetCard *elm) override; }; } -- 2.20.1