mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:28:15 +08:00
Caches: rename "get" to "getThreadLocal" and rename "getCopy" to get.
This commit is contained in:
committed by
Klaus Basan
parent
332d8e5fc8
commit
9bef6854ca
@@ -419,7 +419,7 @@ namespace BlackCore
|
||||
Q_ASSERT(this->m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << notification; }
|
||||
|
||||
bool play = !considerSettings || m_audioSettings.get().getNotificationFlag(notification);
|
||||
bool play = !considerSettings || m_audioSettings.getThreadLocal().getNotificationFlag(notification);
|
||||
if (play)
|
||||
{
|
||||
CSoundGenerator::playNotificationSound(90, notification);
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace BlackCore
|
||||
CAltitude(312, CAltitude::MeanSeaLevel, CLengthUnit::ft())
|
||||
);
|
||||
this->m_ownAircraft.setSituation(situation);
|
||||
this->m_ownAircraft.setPilot(this->m_currentNetworkServer.get().getUser());
|
||||
this->m_ownAircraft.setPilot(this->m_currentNetworkServer.getThreadLocal().getUser());
|
||||
|
||||
// from simulator, if available
|
||||
this->m_ownAircraft.setCallsign(CCallsign("SWIFT")); // would come from settings
|
||||
|
||||
@@ -576,7 +576,7 @@ namespace BlackCore
|
||||
{
|
||||
stopSimulatorListeners();
|
||||
|
||||
auto enabledSimulators = m_enabledSimulators.get();
|
||||
auto enabledSimulators = m_enabledSimulators.getThreadLocal();
|
||||
auto allSimulators = m_plugins->getAvailableSimulatorPlugins();
|
||||
for (const CSimulatorPluginInfo& s: allSimulators)
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
dbusAddress = m_dbusServerAddress.get();
|
||||
dbusAddress = m_dbusServerAddress.getThreadLocal();
|
||||
}
|
||||
|
||||
// DBus
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BlackCore
|
||||
|
||||
CAircraftIcaoCodeList CIcaoDataReader::getAircraftIcaoCodes() const
|
||||
{
|
||||
return m_aircraftIcaoCache.getCopy();
|
||||
return m_aircraftIcaoCache.get();
|
||||
}
|
||||
|
||||
CAircraftIcaoCode CIcaoDataReader::getAircraftIcaoCodeForDesignator(const QString &designator) const
|
||||
@@ -62,7 +62,7 @@ namespace BlackCore
|
||||
|
||||
CAirlineIcaoCodeList CIcaoDataReader::getAirlineIcaoCodes() const
|
||||
{
|
||||
return m_airlineIcaoCache.getCopy();
|
||||
return m_airlineIcaoCache.get();
|
||||
}
|
||||
|
||||
CAircraftIcaoCode CIcaoDataReader::smartAircraftIcaoSelector(const CAircraftIcaoCode &icaoPattern) const
|
||||
@@ -73,7 +73,7 @@ namespace BlackCore
|
||||
|
||||
CCountryList CIcaoDataReader::getCountries() const
|
||||
{
|
||||
return m_countryCache.getCopy();
|
||||
return m_countryCache.get();
|
||||
}
|
||||
|
||||
CCountry CIcaoDataReader::getCountryForIsoCode(const QString &isoCode) const
|
||||
@@ -201,7 +201,7 @@ namespace BlackCore
|
||||
|
||||
void CIcaoDataReader::updateReaderUrl(const CUrl &url)
|
||||
{
|
||||
const CUrl current = this->m_readerUrlCache.getCopy();
|
||||
const CUrl current = this->m_readerUrlCache.get();
|
||||
if (current == url) { return; }
|
||||
const CStatusMessage m = this->m_readerUrlCache.set(url);
|
||||
if (m.isFailure())
|
||||
@@ -420,9 +420,9 @@ namespace BlackCore
|
||||
{
|
||||
switch (entity)
|
||||
{
|
||||
case CEntityFlags::AircraftIcaoEntity: return this->m_aircraftIcaoCache.getCopy().size();
|
||||
case CEntityFlags::AirlineIcaoEntity: return this->m_airlineIcaoCache.getCopy().size();
|
||||
case CEntityFlags::CountryEntity: return this->m_countryCache.getCopy().size();
|
||||
case CEntityFlags::AircraftIcaoEntity: return this->m_aircraftIcaoCache.get().size();
|
||||
case CEntityFlags::AirlineIcaoEntity: return this->m_airlineIcaoCache.get().size();
|
||||
case CEntityFlags::CountryEntity: return this->m_countryCache.get().size();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -430,7 +430,7 @@ namespace BlackCore
|
||||
bool CIcaoDataReader::hasChangedUrl(CEntityFlags::Entity entity) const
|
||||
{
|
||||
Q_UNUSED(entity);
|
||||
return CDatabaseReader::isChangedUrl(this->m_readerUrlCache.getCopy(), this->getBaseUrl());
|
||||
return CDatabaseReader::isChangedUrl(this->m_readerUrlCache.get(), this->getBaseUrl());
|
||||
}
|
||||
|
||||
CUrl CIcaoDataReader::getAircraftIcaoUrl(bool shared) const
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BlackCore
|
||||
|
||||
CLiveryList CModelDataReader::getLiveries() const
|
||||
{
|
||||
return this->m_liveryCache.getCopy();
|
||||
return this->m_liveryCache.get();
|
||||
}
|
||||
|
||||
CLivery CModelDataReader::getLiveryForCombinedCode(const QString &combinedCode) const
|
||||
@@ -79,12 +79,12 @@ namespace BlackCore
|
||||
|
||||
CDistributorList CModelDataReader::getDistributors() const
|
||||
{
|
||||
return m_distributorCache.getCopy();
|
||||
return m_distributorCache.get();
|
||||
}
|
||||
|
||||
CAircraftModelList CModelDataReader::getModels() const
|
||||
{
|
||||
return m_modelCache.getCopy();
|
||||
return m_modelCache.get();
|
||||
}
|
||||
|
||||
CAircraftModel CModelDataReader::getModelForModelString(const QString &modelString) const
|
||||
@@ -231,7 +231,7 @@ namespace BlackCore
|
||||
|
||||
void CModelDataReader::updateReaderUrl(const CUrl &url)
|
||||
{
|
||||
const CUrl current = this->m_readerUrlCache.getCopy();
|
||||
const CUrl current = this->m_readerUrlCache.get();
|
||||
if (current == url) { return; }
|
||||
const CStatusMessage m = this->m_readerUrlCache.set(url);
|
||||
if (m.isFailure())
|
||||
@@ -489,9 +489,9 @@ namespace BlackCore
|
||||
{
|
||||
switch (entity)
|
||||
{
|
||||
case CEntityFlags::LiveryEntity: return this->m_liveryCache.getCopy().size();
|
||||
case CEntityFlags::ModelEntity: return this->m_modelCache.getCopy().size();
|
||||
case CEntityFlags::DistributorEntity: return this->m_distributorCache.getCopy().size();
|
||||
case CEntityFlags::LiveryEntity: return this->m_liveryCache.get().size();
|
||||
case CEntityFlags::ModelEntity: return this->m_modelCache.get().size();
|
||||
case CEntityFlags::DistributorEntity: return this->m_distributorCache.get().size();
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@@ -499,7 +499,7 @@ namespace BlackCore
|
||||
bool CModelDataReader::hasChangedUrl(CEntityFlags::Entity entity) const
|
||||
{
|
||||
Q_UNUSED(entity);
|
||||
return CDatabaseReader::isChangedUrl(this->m_readerUrlCache.getCopy(), this->getBaseUrl());
|
||||
return CDatabaseReader::isChangedUrl(this->m_readerUrlCache.get(), this->getBaseUrl());
|
||||
}
|
||||
|
||||
const CUrl &CModelDataReader::getBaseUrl()
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace BlackCore
|
||||
void CInputManager::ps_changeHotkeySettings()
|
||||
{
|
||||
m_configuredActions.clear();
|
||||
for (CActionHotkey actionHotkey : m_actionHotkeys.get())
|
||||
for (CActionHotkey actionHotkey : m_actionHotkeys.getThreadLocal())
|
||||
{
|
||||
CHotkeyCombination combination = actionHotkey.getCombination();
|
||||
if (combination.isEmpty()) continue;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace BlackCore
|
||||
: INetwork(parent), COwnAircraftAware(ownAircraft),
|
||||
m_loginMode(LoginNormal),
|
||||
m_status(vatStatusIdle),
|
||||
m_fsdTextCodec(QTextCodec::codecForName(m_fsdTextCodecSetting.get().toLocal8Bit())),
|
||||
m_fsdTextCodec(QTextCodec::codecForName(m_fsdTextCodecSetting.getThreadLocal().toLocal8Bit())),
|
||||
m_tokenBucket(10, CTime(5, CTimeUnit::s()), 1)
|
||||
{
|
||||
connect(this, &CNetworkVatlib::terminate, this, &INetwork::terminateConnection, Qt::QueuedConnection);
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
m_setup.synchronize(); // make sure it is loaded
|
||||
CGlobalSetup cachedSetup = m_setup.getCopy();
|
||||
CGlobalSetup cachedSetup = m_setup.get();
|
||||
const bool cacheAvailable = cachedSetup.wasLoaded();
|
||||
msgs.push_back(cacheAvailable ?
|
||||
CStatusMessage(this, CStatusMessage::SeverityInfo , "Cached setup syncronized and contains data") :
|
||||
@@ -281,7 +281,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
const CGlobalSetup currentSetup = m_setup.getCopy();
|
||||
const CGlobalSetup currentSetup = m_setup.get();
|
||||
CGlobalSetup loadedSetup;
|
||||
loadedSetup.convertFromJson(Json::jsonObjectFromString(setupJson));
|
||||
loadedSetup.markAsLoaded(true);
|
||||
@@ -410,12 +410,12 @@ namespace BlackCore
|
||||
|
||||
CGlobalSetup CSetupReader::getSetup() const
|
||||
{
|
||||
return m_setup.getCopy();
|
||||
return m_setup.get();
|
||||
}
|
||||
|
||||
CUpdateInfo CSetupReader::getUpdateInfo() const
|
||||
{
|
||||
return m_updateInfo.getCopy();
|
||||
return m_updateInfo.get();
|
||||
}
|
||||
|
||||
CStatusMessageList CSetupReader::manageSetupAvailability(bool webRead, bool localRead)
|
||||
@@ -440,7 +440,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
bool cacheAvailable = this->m_setup.get().wasLoaded();
|
||||
bool cacheAvailable = this->m_setup.getThreadLocal().wasLoaded();
|
||||
available = cacheAvailable && this->m_bootstrapMode != Explicit;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,12 +86,12 @@ namespace BlackCore
|
||||
|
||||
CServerList CVatsimDataFileReader::getVoiceServers() const
|
||||
{
|
||||
return this->m_lastGoodSetup.getCopy().getVoiceServers();
|
||||
return this->m_lastGoodSetup.get().getVoiceServers();
|
||||
}
|
||||
|
||||
CServerList CVatsimDataFileReader::getFsdServers() const
|
||||
{
|
||||
return this->m_lastGoodSetup.getCopy().getFsdServers();
|
||||
return this->m_lastGoodSetup.get().getFsdServers();
|
||||
}
|
||||
|
||||
CUserList CVatsimDataFileReader::getPilotsForCallsigns(const CCallsignSet &callsigns)
|
||||
@@ -379,7 +379,7 @@ namespace BlackCore
|
||||
this->m_aircraft = aircraft;
|
||||
this->m_atcStations = atcStations;
|
||||
this->m_voiceCapabilities = voiceCapabilities;
|
||||
CVatsimSetup vs(this->m_lastGoodSetup.get());
|
||||
CVatsimSetup vs(this->m_lastGoodSetup.getThreadLocal());
|
||||
vs.setVoiceServers(voiceServers);
|
||||
vs.setFsdServers(fsdServers);
|
||||
vs.setUtcTimestamp(updateTimestampFromFile);
|
||||
|
||||
@@ -53,12 +53,12 @@ namespace BlackCore
|
||||
|
||||
CUrlList CVatsimStatusFileReader::getMetarFileUrls() const
|
||||
{
|
||||
return this->m_lastGoodSetup.getCopy().getMetarFileUrls();
|
||||
return this->m_lastGoodSetup.get().getMetarFileUrls();
|
||||
}
|
||||
|
||||
CUrlList CVatsimStatusFileReader::getDataFileUrls() const
|
||||
{
|
||||
return this->m_lastGoodSetup.getCopy().getDataFileUrls();
|
||||
return this->m_lastGoodSetup.get().getDataFileUrls();
|
||||
}
|
||||
|
||||
void CVatsimStatusFileReader::cleanup()
|
||||
@@ -148,7 +148,7 @@ namespace BlackCore
|
||||
// this part needs to be synchronized
|
||||
{
|
||||
// cache itself is thread safe
|
||||
CVatsimSetup vs(this->m_lastGoodSetup.getCopy());
|
||||
CVatsimSetup vs(this->m_lastGoodSetup.get());
|
||||
vs.setDataFileUrls(dataFiles);
|
||||
vs.setMetarFileUrls(metarFiles);
|
||||
vs.setServerFileUrls(serverFiles);
|
||||
|
||||
Reference in New Issue
Block a user