X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/abc6ac8b859794c5e38b56629674377872c70939..8d900364a801ea8e049c5862e360aedea8093094:/src/surf/surf_routing.cpp diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 7cee152ca4..dee4649daf 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -39,14 +39,19 @@ namespace surf { xbt_dynar_free(&vertices_); xbt_dynar_free(&upDownLinks); xbt_free(name_); - if (netcard_) - delete netcard_; + delete netcard_; + } + void As::Seal() + { + sealed_ = true; } sg_platf_route_cbarg_t As::getBypassRoute(NetCard * /*src*/, NetCard * /*dst*/, double * /*lat*/) { return NULL; } - + xbt_dynar_t As::getOneLinkRoutes() { + return NULL; + } int As::addComponent(NetCard *elm) { XBT_DEBUG("Load component \"%s\"", elm->name()); @@ -54,11 +59,11 @@ namespace surf { return xbt_dynar_length(vertices_)-1; } - void As::parseRoute(sg_platf_route_cbarg_t /*route*/){ - THROW_IMPOSSIBLE; /* No. */ + void As::addRoute(sg_platf_route_cbarg_t /*route*/){ + xbt_die("AS %s does not accept new routes (wrong class).",name_); } void As::parseBypassroute(sg_platf_route_cbarg_t /*e_route*/){ - THROW_IMPOSSIBLE; + xbt_die("AS %s does not accept new bypass routes (wrong class).",name_); } }} // namespace simgrid::surf @@ -89,10 +94,10 @@ int ROUTING_PROP_ASR_LEVEL; //Where the properties are stored 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); - return net_elm; + simgrid::surf::NetCard *netcard = h==NULL ? NULL: h->pimpl_netcard; + if (!netcard) + netcard = (simgrid::surf::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL); + return netcard; } /* Global vars */ @@ -161,7 +166,7 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS) { XBT_DEBUG("routing_AS_begin"); - xbt_assert(NULL == xbt_lib_get_or_null(as_router_lib, AS->id, ROUTING_ASR_LEVEL), + xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, AS->id, ROUTING_ASR_LEVEL), "Refusing to create a second AS called \"%s\".", AS->id); _sg_cfg_init_status = 2; /* HACK: direct access to the global controlling the level of configuration to prevent @@ -209,8 +214,7 @@ void routing_AS_begin(sg_platf_AS_cbarg_t AS) THROWF(arg_error, 0, "All defined components must belong to a AS"); } - xbt_lib_set(as_router_lib, netcard->name(), ROUTING_ASR_LEVEL, - (void *) netcard); + xbt_lib_set(as_router_lib, netcard->name(), ROUTING_ASR_LEVEL, (void *) netcard); XBT_DEBUG("Having set name '%s' id '%d'", new_as->name_, netcard->id()); /* set the new current component of the tree */ @@ -427,15 +431,6 @@ xbt_dynar_t RoutingPlatf::getOneLinkRoutes(){ } } -e_surf_network_element_type_t routing_get_network_element_type(const char *name) -{ - simgrid::surf::NetCard *rc = sg_netcard_by_name_or_null(name); - if (rc) - return rc->getRcType(); - - return SURF_NETWORK_ELEMENT_NULL; -} - /** @brief create the root AS */ void routing_model_create( void *loopback) {