X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1ecbb4c88462e9ec9be0c830a257da6e9b774a25..9003b522ca66f1a3723c63ce1c4753ad7aea9b70:/src/surf/gtnets/gtnets_topology.cc diff --git a/src/surf/gtnets/gtnets_topology.cc b/src/surf/gtnets/gtnets_topology.cc index 7df843cf4e..d3f2f13293 100644 --- a/src/surf/gtnets/gtnets_topology.cc +++ b/src/surf/gtnets/gtnets_topology.cc @@ -1,5 +1,3 @@ -/* $ID$ */ - /* Copyright (c) 2007 Kayo Fujiwara. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -38,7 +36,7 @@ GTNETS_Node::~GTNETS_Node(){ // hostid = network_card_id int GTNETS_Node::add_host(int hostid){ - xbt_assert0(!(is_router_), "Cannot add a host to a router node"); + xbt_assert(!(is_router_), "Cannot add a host to a router node"); hosts_.insert(hostid); return 0; } @@ -46,9 +44,9 @@ int GTNETS_Node::add_host(int hostid){ // Add a router. If this node already has a router/host, // return -1. int GTNETS_Node::add_router(int routerid){ - xbt_assert0(!(hosts_.size() > 1), "Router node should have only one router"); + xbt_assert(!(hosts_.size() > 1), "Router node should have only one router"); if (hosts_.size() == 1){ - xbt_assert1((hosts_.find(routerid) != hosts_.end()), "Node %d is a different router", routerid); + xbt_assert((hosts_.find(routerid) != hosts_.end()), "Node %d is a different router", routerid); return 0; } is_router_ = true; @@ -121,7 +119,7 @@ bool GTNETS_Link::route_exists(){ // return the peer node id int GTNETS_Link::peer_node(int cur_id){ - xbt_assert0(((cur_id == src_node_->id())||(cur_id == dst_node_->id())), "Node not found"); + xbt_assert(((cur_id == src_node_->id())||(cur_id == dst_node_->id())), "Node not found"); if (cur_id == src_node_->id()) return dst_node_->id(); else if (cur_id == dst_node_->id()) return src_node_->id(); @@ -168,7 +166,7 @@ int GTNETS_Topology::node_size(){ int GTNETS_Topology::add_link(int id){ map::iterator iter = links_.find(id); - xbt_assert1((iter == links_.end()), "Link %d already exists", id); + xbt_assert((iter == links_.end()), "Link %d already exists", id); if(iter == links_.end()) { GTNETS_Link* link= new GTNETS_Link(id); @@ -196,11 +194,11 @@ bool GTNETS_Topology::is_router(int id){ //return the node id of the peer of cur_id by linkid. int GTNETS_Topology::peer_node_id(int linkid, int cur_id){ GTNETS_Link* link = links_[linkid]; - xbt_assert1((link), "Link %d not found", linkid); - xbt_assert1(!((cur_id < 0) || (cur_id > nodes_.size()-1)), "Node %d not found", cur_id); + xbt_assert((link), "Link %d not found", linkid); + xbt_assert(!((cur_id < 0) || (cur_id > nodes_.size()-1)), "Node %d not found", cur_id); int peer = link->peer_node(nodes_[cur_id]->id()); - xbt_assert0(!(peer < 0), "Peer not found"); + xbt_assert(!(peer < 0), "Peer not found"); return peer; } @@ -210,7 +208,7 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ map::iterator iter = links_.find(linkid); - xbt_assert1(!(iter == links_.end()), "Link %d not found", linkid); + xbt_assert(!(iter == links_.end()), "Link %d not found", linkid); link = iter->second; XBT_DEBUG("Add onehop route, src (#%d), dst (#%d), linkid %d:(#%d)",src, dst, linkid, link->id()); @@ -258,7 +256,7 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ link->add_dst(nodes_[d_node_id]); }else if (!(src_node && dst_node)){ - xbt_assert0((src_node && dst_node), "Either src or dst is null"); + xbt_assert((src_node && dst_node), "Either src or dst is null"); } // case 1: link has two routers @@ -267,14 +265,14 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ int tmpsrc2 = nodeid_from_hostid(src); int tmpdst1 = dst_node->id(); int tmpdst2 = nodeid_from_hostid(dst); - xbt_assert0( (((tmpsrc1 == tmpsrc2) && (tmpdst1 == tmpdst2)) || + xbt_assert( (((tmpsrc1 == tmpsrc2) && (tmpdst1 == tmpdst2)) || ((tmpsrc1 == tmpdst2) && (tmpdst1 == tmpsrc2))), "Different one hop route defined"); } // case 2: link has one router and one host else if (src_node->is_router() && !dst_node->is_router()){ int newsrc, newdst; - xbt_assert0( ((is_router(src))||(is_router(dst))), "One of nodes should be a router"); + xbt_assert( ((is_router(src))||(is_router(dst))), "One of nodes should be a router"); if (is_router(src)){ newsrc = src; @@ -284,10 +282,10 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ newdst = src; } - xbt_assert0(!(src_node->id() != nodeid_from_hostid(newsrc)), "The router should be identical"); + xbt_assert(!(src_node->id() != nodeid_from_hostid(newsrc)), "The router should be identical"); //now, to add dst to dst_node, dst should be a host. - xbt_assert1(!(is_router(newdst)), "Dst %d is not an endpoint. cannot add it to dst_node", newdst); + xbt_assert(!(is_router(newdst)), "Dst %d is not an endpoint. cannot add it to dst_node", newdst); if (!dst_node->include(newdst)){ dst_node->add_host(newdst); @@ -296,7 +294,7 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ } else if (!src_node->is_router() && dst_node->is_router()){ int newsrc, newdst; - xbt_assert0(((is_router(src))||(is_router(dst))), "One of nodes should be a router"); + xbt_assert(((is_router(src))||(is_router(dst))), "One of nodes should be a router"); if (is_router(src)){ newsrc = dst; @@ -306,9 +304,9 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ newdst = dst; } - xbt_assert0(!(dst_node->id() != hosts_[newdst]), "The router should be identical"); + xbt_assert(!(dst_node->id() != hosts_[newdst]), "The router should be identical"); //now, to add dst to src_node, dst should be a host. - xbt_assert1(!(is_router(newsrc)), "Src %d is not an endpoint. cannot add it to src_node", newsrc); + xbt_assert(!(is_router(newsrc)), "Src %d is not an endpoint. cannot add it to src_node", newsrc); if (!src_node->include(newsrc)){ src_node->add_host(newsrc); @@ -318,7 +316,7 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ // case 3: link has two hosts else if (!src_node->is_router() && !dst_node->is_router()){ - xbt_assert0(!(is_router(src) || is_router(dst)), "Cannot add a router to host-host link"); + xbt_assert(!(is_router(src) || is_router(dst)), "Cannot add a router to host-host link"); //if both are hosts, the order doesn't matter. if (src_node->include(src)){