#include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include
namespace simgrid {
-
-namespace surf {
-class Link;
-}
namespace kernel {
namespace routing {
class NetZoneImpl;
-class NetCard;
}
}
+
namespace s4u {
/** @brief Networking Zones
virtual void seal();
char* name();
NetZone* father();
- ;
+
xbt_dict_t children(); // Sub netzones
xbt_dynar_t hosts(); // my content as a dynar
-public:
/* Add content to the netzone, at parsing time. It should be sealed afterward. */
virtual int addComponent(kernel::routing::NetCard * elm); /* A host, a router or a netzone, whatever */
virtual void addRoute(sg_platf_route_cbarg_t route);
{
XBT_DEBUG("Generating switches.");
this->nodesByLevel_.resize(this->levels_ + 1, 0);
- unsigned int nodesRequired = 0;
// Take care of the number of nodes by level
this->nodesByLevel_[0] = 1;
nodesInThisLevel *= this->lowerLevelNodesNumber_[j];
this->nodesByLevel_[i + 1] = nodesInThisLevel;
- nodesRequired += nodesInThisLevel;
}
// Create the switches
linkTemplate.id = bprintf("limiter_%d", id);
sg_platf_new_link(&linkTemplate);
this->limiterLink = Link::byName(linkTemplate.id);
- free((void*)linkTemplate.id);
+ free(const_cast<char*>(linkTemplate.id));
}
if (cluster->loopback_bw || cluster->loopback_lat) {
memset(&linkTemplate, 0, sizeof(linkTemplate));
linkTemplate.id = bprintf("loopback_%d", id);
sg_platf_new_link(&linkTemplate);
this->loopback = Link::byName(linkTemplate.id);
- free((void*)linkTemplate.id);
+ free(const_cast<char*>(linkTemplate.id));
}
}
linkTemplate.policy = cluster->sharing_policy; // sthg to do with that ?
linkTemplate.id = bprintf("link_from_%d_to_%d_%d", downNode->id, upNode->id, uniqueId);
sg_platf_new_link(&linkTemplate);
- Link* link;
- std::string tmpID;
+
if (cluster->sharing_policy == SURF_LINK_FULLDUPLEX) {
- tmpID = std::string(linkTemplate.id) + "_UP";
- link = Link::byName(tmpID.c_str());
- this->upLink = link; // check link?
+ std::string tmpID = std::string(linkTemplate.id) + "_UP";
+ this->upLink = Link::byName(tmpID.c_str()); // check link?
tmpID = std::string(linkTemplate.id) + "_DOWN";
- link = Link::byName(tmpID.c_str());
- this->downLink = link; // check link ?
+ this->downLink = Link::byName(tmpID.c_str()); // check link ?
} else {
- link = Link::byName(linkTemplate.id);
- this->upLink = link;
- this->downLink = link;
+ this->upLink = Link::byName(linkTemplate.id);
+ this->downLink = this->upLink;
}
+ free(const_cast<char*>(linkTemplate.id));
uniqueId++;
- free((void*)linkTemplate.id);
}
}
}