using std::sort;
-class AirportWithMetar : public FGPositioned::Filter
+class AirportWithMetar : public FGAirport::AirportFilter
{
public:
- virtual bool pass(FGPositioned* aPos) const
+ virtual bool passAirport(FGAirport* aApt) const
{
- if ((aPos->type() < FGPositioned::AIRPORT) || (aPos->type() > FGPositioned::SEAPORT)) {
- return false;
- }
-
- FGAirport* apt = static_cast<FGAirport*>(aPos);
- return apt->getMetar();
+ return aApt->getMetar();
}
};
\f
void
FGMetarEnvironmentCtrl::thread_stop()
{
- request_queue.push( string() ); // ask thread to terminate
+ request_queue.push(NULL); // ask thread to terminate
thread->join();
}
{
while ( true )
{
- string icao = fetcher->request_queue.pop();
- if (icao.empty())
+ FGAirport* apt = fetcher->request_queue.pop();
+ if (!apt)
return;
- SG_LOG( SG_GENERAL, SG_INFO, "Thread: fetch metar data = " << icao );
- FGMetarResult result = fetcher->fetch_data( icao );
+ SG_LOG( SG_GENERAL, SG_INFO, "Thread: fetch metar data = " << apt->ident() );
+ FGMetarResult result = fetcher->fetch_data( apt );
fetcher->result_queue.push( result );
}
}