本文整理汇总了C++中Road::is_two_way方法的典型用法代码示例。如果您正苦于以下问题:C++ Road::is_two_way方法的具体用法?C++ Road::is_two_way怎么用?C++ Road::is_two_way使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Road
的用法示例。
在下文中一共展示了Road::is_two_way方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readEdges
/**
* Reads the edges from a file and loads them into the graph
*/
void readEdges(Graph<Node, Road> & g, GraphViewer *gv) {
ifstream inFile;
//Ler o ficheiro subroads.txt
inFile.open("database/subroadsDemo.txt");
if (!inFile) {
cerr << "Unable to open file subroadsDemo.txt";
exit(1); // call system to stop
}
std::string line;
unsigned long roadID;
unsigned long node1ID, node2ID;
while (std::getline(inFile, line)) {
std::stringstream linestream(line);
std::string data;
linestream >> roadID;
std::getline(linestream, data, ';'); // read up-to the first ; (discard ;).
linestream >> node1ID;
std::getline(linestream, data, ';'); // read up-to the first ; (discard ;).
linestream >> node2ID;
float weight = calcWeight(findNode(g, node1ID), findNode(g, node2ID));
gv->addEdge(roadID, node1ID, node2ID, EdgeType::UNDIRECTED);
Road r = readRoads(roadID, gv);
if (r.is_two_way())
g.addEdge1(findNode(g, node2ID), findNode(g, node1ID), weight, r);
g.addEdge1(findNode(g, node1ID), findNode(g, node2ID), weight, r);
}
inFile.close();
}