- xbt_lib_foreach(as_router_lib, cursor_src, src, value1){ // Routes from router
- value1 = (sg_netcard_t)xbt_lib_get_or_null(as_router_lib,src,ROUTING_ASR_LEVEL);
- if (value1->isRouter()){
- xbt_lib_foreach(as_router_lib, cursor_dst, dst, value2){ //to router
- value2 = (sg_netcard_t)xbt_lib_get_or_null(as_router_lib,dst,ROUTING_ASR_LEVEL);
- if(value2->isRouter()){
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", src, dst);
- std::vector<Link*> *route = new std::vector<Link*>();
- routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route,nullptr);
- for(auto link :*route)
- std::printf("<link_ctn id=\"%s\"/>",link->getName());
- delete route;
- std::printf("\n </route>\n");
- }
- }
- for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
- host2 = hosts[it_dst];
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ",src, host2->name().c_str());
- std::vector<Link*> *route = new std::vector<Link*>();
- value2 = host2->pimpl_netcard;
- routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route, nullptr);
- for(auto link : *route)
- std::printf("<link_ctn id=\"%s\"/>",link->getName());
- delete route;
- std::printf("\n </route>\n");
- }
- }
- }
+ std::printf("</AS>\n");
+ std::printf("</platform>\n");
+ std::free(hosts);
+ std::free(links);
+}
+
+int main(int argc, char** argv)
+{
+ char* platformFile = nullptr;
+ int timings = 0;
+
+ xbt_os_timer_t parse_time = xbt_os_timer_new();
+
+ SD_init(&argc, argv);
+
+ xbt_assert(parse_cmdline(&timings, &platformFile, argc, argv) && platformFile,
+ "Invalid command line arguments: expected [--timings] platformFile");