refs #649, added caches to model data reader

* trait
* const fix distributor list
This commit is contained in:
Klaus Basan
2016-06-06 02:36:49 +02:00
parent c39882e5db
commit 332d8e5fc8
8 changed files with 169 additions and 84 deletions

View File

@@ -49,11 +49,22 @@ namespace BlackCore
return ll;
}
const CDistributorList &DbDistributorCache::defaultValue()
{
static const CDistributorList dl;
return dl;
}
const BlackMisc::Network::CUrl &DbIcaoReaderBaseUrl::defaultValue()
{
static const CUrl url;
return url;
}
const CUrl &DbModelReaderBaseUrl::defaultValue()
{
static const CUrl url;
return url;
}
} // ns
} // ns

View File

@@ -14,6 +14,7 @@
#include "blackmisc/datacache.h"
#include "blackmisc/simulation/aircraftmodellist.h"
#include "blackmisc/simulation/distributorlist.h"
#include "blackmisc/aviation/airlineicaocodelist.h"
#include "blackmisc/aviation/aircrafticaocodelist.h"
#include "blackmisc/aviation/liverylist.h"
@@ -40,6 +41,32 @@ namespace BlackCore
static const char *key() { return "dbmodelcache"; }
};
//! Trait for DB distributor cache
struct DbDistributorCache : public BlackMisc::CDataTrait<BlackMisc::Simulation::CDistributorList>
{
//! Default value
static const BlackMisc::Simulation::CDistributorList &defaultValue();
//! Defer loading (no currently small)
static constexpr bool isDeferred() { return false; }
//! Key in data cache
static const char *key() { return "dbdistributorcache"; }
};
//! Trait for DB liveries
struct DbLiveryCache : public BlackMisc::CDataTrait<BlackMisc::Aviation::CLiveryList>
{
//! Default value
static const BlackMisc::Aviation::CLiveryList &defaultValue();
//! Defer loading
static constexpr bool isDeferred() { return true; }
//! Key in data cache
static const char *key() { return "dbliverycache"; }
};
//! Trait for DB airline ICAO codes
struct DbAirlineIcaoCache : public BlackMisc::CDataTrait<BlackMisc::Aviation::CAirlineIcaoCodeList>
{
@@ -80,19 +107,6 @@ namespace BlackCore
static const char *key() { return "dbcountrycache"; }
};
//! Trait for DB liveries
struct DbLiveryCache : public BlackMisc::CDataTrait<BlackMisc::Aviation::CLiveryList>
{
//! Default value
static const BlackMisc::Aviation::CLiveryList &defaultValue();
//! Defer loading
static constexpr bool isDeferred() { return true; }
//! Key in data cache
static const char *key() { return "dbliverycache"; }
};
//! Trait for ICAO reader base URL
struct DbIcaoReaderBaseUrl : public BlackMisc::CDataTrait<BlackMisc::Network::CUrl>
{
@@ -105,6 +119,19 @@ namespace BlackCore
//! Key in data cache
static const char *key() { return "dbicaoreaderurl"; }
};
//! Trait for ICAO reader base URL
struct DbModelReaderBaseUrl : public BlackMisc::CDataTrait<BlackMisc::Network::CUrl>
{
//! Default value
static const BlackMisc::Network::CUrl &defaultValue();
//! First load is synchronous
static constexpr bool isPinned() { return true; }
//! Key in data cache
static const char *key() { return "dbmodelreaderurl"; }
};
} // ns
} // ns