mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 05:51:23 +08:00
refs #787, caches/model set loader
* Caches initialized * simulators with model set
This commit is contained in:
@@ -126,6 +126,11 @@ namespace BlackMisc
|
|||||||
return this->getSimulator().matchesAny(info);
|
return this->getSimulator().matchesAny(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSimulatorInfo CAircraftModelSetLoader::simulatorsWithInitializedModelSet() const
|
||||||
|
{
|
||||||
|
return this->m_caches.simulatorsWithInitializedCache();
|
||||||
|
}
|
||||||
|
|
||||||
void CAircraftModelSetLoader::gracefulShutdown()
|
void CAircraftModelSetLoader::gracefulShutdown()
|
||||||
{
|
{
|
||||||
// void
|
// void
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ namespace BlackMisc
|
|||||||
//! Is the given simulator supported?
|
//! Is the given simulator supported?
|
||||||
bool supportsSimulator(const BlackMisc::Simulation::CSimulatorInfo &info);
|
bool supportsSimulator(const BlackMisc::Simulation::CSimulatorInfo &info);
|
||||||
|
|
||||||
|
//! Simulators with initialized caches
|
||||||
|
CSimulatorInfo simulatorsWithInitializedModelSet() const;
|
||||||
|
|
||||||
//! Shutdown
|
//! Shutdown
|
||||||
void gracefulShutdown();
|
void gracefulShutdown();
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,21 @@ namespace BlackMisc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSimulatorInfo IMultiSimulatorModelCaches::simulatorsWithInitializedCache() const
|
||||||
|
{
|
||||||
|
static const QDateTime outdated = QDateTime::currentDateTimeUtc().addDays(-365 * 5);
|
||||||
|
CSimulatorInfo withInitializedCache;
|
||||||
|
for (const CSimulatorInfo &simInfo : CSimulatorInfo::allSimulators().asSingleSimulatorSet())
|
||||||
|
{
|
||||||
|
const QDateTime ts = this->getCacheTimestamp(simInfo);
|
||||||
|
if (ts.isValid() && ts > outdated)
|
||||||
|
{
|
||||||
|
withInitializedCache.add(simInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return withInitializedCache;
|
||||||
|
}
|
||||||
|
|
||||||
CModelCaches::CModelCaches(bool synchronizeCache, QObject *parent) : IMultiSimulatorModelCaches(parent)
|
CModelCaches::CModelCaches(bool synchronizeCache, QObject *parent) : IMultiSimulatorModelCaches(parent)
|
||||||
{
|
{
|
||||||
this->m_currentSimulator.synchronize();
|
this->m_currentSimulator.synchronize();
|
||||||
|
|||||||
@@ -166,6 +166,10 @@ namespace BlackMisc
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
virtual QDateTime getCacheTimestamp(const BlackMisc::Simulation::CSimulatorInfo &simulator) const = 0;
|
virtual QDateTime getCacheTimestamp(const BlackMisc::Simulation::CSimulatorInfo &simulator) const = 0;
|
||||||
|
|
||||||
|
//! Initilaized caches for which simulator
|
||||||
|
//! \threadsafe
|
||||||
|
BlackMisc::Simulation::CSimulatorInfo simulatorsWithInitializedCache() const;
|
||||||
|
|
||||||
//! Timestamp
|
//! Timestamp
|
||||||
QDateTime getSynchronizedTimestamp(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
QDateTime getSynchronizedTimestamp(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user