| 1 | /* |
| 2 | * Copyright (C) 2018 Edward d'Auvergne |
| 3 | * |
| 4 | * This file is part of the program FlightGear. |
| 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | |
| 21 | #include "NavDataCache.hxx" |
| 22 | |
| 23 | #include <iostream> |
| 24 | |
| 25 | #include <simgear/timing/timestamp.hxx> |
| 26 | |
| 27 | #include <Navaids/NavDataCache.hxx> |
| 28 | |
| 29 | |
| 30 | namespace FGTestApi { |
| 31 | |
| 32 | namespace setUp { |
| 33 | |
| 34 | void initNavDataCache() |
| 35 | { |
| 36 | if (flightgear::NavDataCache::instance()) |
| 37 | return; |
| 38 | |
| 39 | flightgear::NavDataCache* cache = flightgear::NavDataCache::createInstance(); |
| 40 | if (cache->isRebuildRequired()) { |
| 41 | std::cerr << "Navcache rebuild for testing" << std::flush; |
| 42 | |
| 43 | while (cache->rebuild() != flightgear::NavDataCache::REBUILD_DONE) { |
| 44 | SGTimeStamp::sleepForMSec(1000); |
| 45 | std::cerr << "." << std::flush; |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | } // End of namespace setUp. |
| 51 | |
| 52 | } // End of namespace FGTestApi. |