📄 analyzer_backbone_property.cpp
字号:
#include "analyzer_backbone_property.h"/*** Questo file analizza gli shortest path e crea i file a partire dalla * cartella di destinazione passata come parametro. * E'possibile analizzare gli shortest path dei vari livelli dello stack * di simulazione. Le cartelle vengono create in base alla stringa che * descrive lo stack. */void analyze_backbone_property(string topologyDirectory, string resultFile, int selectedLayer, Measure & degree, string & layer_name) { // Average graph, backbone, inducted; string topology; string stack; string layer; string currentLayer; vector<string> layers; int i_tmp; unsigned int i; string s_tmp; string color; NodeList backbone_nodes; Graph backbone; // Apre il file di risultato in lettura. istream * inFile; if (use_zipped) inFile = new igzstream((resultFile + ".gz").c_str()); else inFile = new ifstream((resultFile).c_str()); // Inizia a leggere il file. while (*inFile >> topology >> stack) { cout << "."; cout.flush(); extractLayers(stack, layers); if (selectedLayer >= (int)layers.size()) { for (i = 0; i < layers.size(); i++) { skipLayer(inFile); } } else { for (i = 0; i < (unsigned int)selectedLayer; i++) { skipLayer(inFile); } { *inFile >> currentLayer; if ((currentLayer == "BACKBONE") || (currentLayer == "SHIVA") || (currentLayer == "CONNECTOR")) { // skip i dati in trasmissione dei nodi. *inFile >> i_tmp; for (int t = 0; t < (i_tmp + 2); t++) getline(*inFile, s_tmp, '\n'); *inFile >> i_tmp; int t; backbone_nodes.clear(); for (t = 0; t < i_tmp; t++) { NodeList tmp_nodes; // Carica i colori dei nodi. readColor(inFile, color, tmp_nodes, false); if ((color == "black") || (color == "gray")) { for (NodeList::iterator n = tmp_nodes.begin(); n != tmp_nodes.end(); n++) backbone_nodes.insert(*n); } } // Carica il backbone del grafo. loadFromDump(inFile, backbone); // Calcola Il degree totale della topologia. for (Graph::iterator n = backbone.begin(); n != backbone.end(); n++) degree.addMeasure(n->second.size()); } if ((currentLayer == "SHIVA") || (currentLayer == "CONNECTOR")) { getline(*inFile, s_tmp, '\n'); } } for (++i; i < layers.size(); i++) { skipLayer(inFile); } } } layer_name = string(""); // Save Name of layer. for (int l = 0; l <= selectedLayer; l++) { layer_name += layers[l]; if (l < selectedLayer) layer_name += string("-"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -