refs #614, moved cache to vPilot reader

This commit is contained in:
Klaus Basan
2016-03-29 09:28:46 +02:00
parent 01d4faa20f
commit a1d6492ff2
4 changed files with 72 additions and 30 deletions

View File

@@ -16,6 +16,7 @@
#include "blackmisc/worker.h"
#include "blackmisc/simulation/aircraftmodellist.h"
#include "blackmisc/simulation/fscommon/vpilotmodelruleset.h"
#include "blackmisc/simulation/data/modelcaches.h"
#include <QStringList>
#include <QObject>
#include <QReadWriteLock>
@@ -60,7 +61,11 @@ namespace BlackMisc
//! Get as models
//! \threadsafe
BlackMisc::Simulation::CAircraftModelList getAsModels() const;
BlackMisc::Simulation::CAircraftModelList getAsModels();
//! Get as models from cache
//! \threadsafe
BlackMisc::Simulation::CAircraftModelList getAsModelsFromCache() const;
//! Get model count
//! \threadsafe
@@ -95,6 +100,13 @@ namespace BlackMisc
//! \threadsafe
void ps_readInBackgroundFinished();
//! Cache changed
void ps_onVPilotCacheChanged();
//! Set cache (in main thread)
//! \threadsafe
void ps_setCache(const BlackMisc::Simulation::CAircraftModelList &models);
private:
QStringList m_fileList; //!< list of file names
QStringList m_fileListWithProblems; //!< problems during parsing
@@ -102,13 +114,12 @@ namespace BlackMisc
CVPilotModelRuleSet m_rules; //!< rules list
bool m_asyncLoadInProgress = false; //!< Asynchronous load in progress
bool m_shutdown = false; //!< Shutdown
mutable BlackMisc::Simulation::CAircraftModelList m_models; //!< converted to models
BlackMisc::CData<BlackMisc::Simulation::Data::VPilotAircraftModels> m_cachedVPilotModels { this, &CVPilotRulesReader::ps_onVPilotCacheChanged }; //!< cache for latest vPilot rules
mutable QReadWriteLock m_lockData;
//! Read single file and do parsing
//! \threadsafe
bool loadFile(const QString &fileName, CVPilotModelRuleSet &ruleSet);
};
} // namespace
} // namespace