本文整理汇总了C++中Station::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ Station::getName方法的具体用法?C++ Station::getName怎么用?C++ Station::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Station
的用法示例。
在下文中一共展示了Station::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findRoute
void Dijstra::findRoute(Station start, Station end){
graph costs;
std::priority_queue<pp, std::vector<pp>, Prioritize> queue;
// all the stations have int_max as cost
for(graph::iterator it=g.begin(); it!=g.end(); it++) {
costs[it->first][it->first] = INT_MAX;
for(distance::iterator jt=it->second.begin(); jt!=it->second.end(); ++jt){
costs[jt->first][jt->first] = INT_MAX;
}
}
// set first station to cost 0
costs[start][start] = 0;
queue.push(pp(start, 0));
while(!queue.empty()) {
// get the station with the lowest cost
Station station = queue.top().first;
queue.pop();
for(graph::iterator it=costs.begin(); it!=costs.end(); ++it) {
int cost = costs[it->first].begin()->second;
// go through all stations and get edge cost
if(g[station].find(it->first) != g[station].end())
cost = g[station][it->first];
else if(g[it->first].find(station) != g[it->first].end())
cost = g[it->first][station];
// check for a cheaper option
if (costs[it->first].begin()->second > costs[station].begin()->second + cost) {
Station old = costs[it->first].begin()->first;
costs[it->first].erase(old);
costs[it->first][station] = costs[station].begin()->second + cost;
queue.push(pp(it->first, costs[it->first].begin()->second));
}
}
}
std::cout<<"cost "<<costs[end].begin()->second<<"\n";
std::cout<<"station "<<end.getName()<<"\n";
Station station = costs[end].begin()->first;
while(costs[station].begin()->second != 0){
std::cout<<"station "<<station.getName()<<"\n";
station = costs[station].begin()->first;
}
std::cout<<"station "<<start.getName()<<"\n";
};
示例2: rMain
int
station_get_name(LuaState* state)
{
Station* station = rMain()->getMission()->getStation();
wstring stationName = station->getName();
state->PushWString(stationName.c_str());
return 1;
}
示例3: testParseFile
void TestConfig::testParseFile()
{
//QCOMPARE(10.0, filter.getValue());
ConfigParse config("files/config01.xml");
QList<Station> *list;
list = new QList<Station>;
config.parse(list);
QCOMPARE(config.getMosqServer(), QString("localhost"));
QCOMPARE(config.getAppName(), QString("FunTechHouse_METAR2MQTT2__01"));
QCOMPARE(list->size(), 1);
{
Station station = list->at(0);
QCOMPARE(station.getName(), QString("EKCH"));
QCOMPARE(station.getMosqTopic(), QString("METAR/EKCH"));
}
}