mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Ref T259, Ref T243 adjusted container, models and views to support CInterpolationSetupList
* added forward declarations * added some utility functions
This commit is contained in:
@@ -7,14 +7,15 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/simulation/interpolationsetuplist.h"
|
||||
#include "blackmisc/aviation/callsignobjectlist.h"
|
||||
#include "blackmisc/aviation/callsign.h"
|
||||
#include "blackmisc/predicates.h"
|
||||
#include "blackmisc/aviation/atcstationlist.h"
|
||||
#include "blackmisc/aviation/aircraftsituationlist.h"
|
||||
#include "blackmisc/aviation/flightplanlist.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/network/clientlist.h"
|
||||
#include "blackmisc/predicates.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
@@ -179,6 +180,17 @@ namespace BlackMisc
|
||||
return result;
|
||||
}
|
||||
|
||||
template<class OBJ, class CONTAINER>
|
||||
int ICallsignObjectList<OBJ, CONTAINER>::replaceOrAddObjectByCallsign(const OBJ &otherObject)
|
||||
{
|
||||
const CCallsign cs(otherObject.getCallsign());
|
||||
if (cs.isEmpty()) { return 0; }
|
||||
CONTAINER ©(this->container());
|
||||
copy.removeByCallsign(cs);
|
||||
copy.push_back(otherObject);
|
||||
return 1;
|
||||
}
|
||||
|
||||
template<class OBJ, class CONTAINER>
|
||||
int ICallsignObjectList<OBJ, CONTAINER>::replaceOrAddObjectsByCallsign(const CONTAINER &others)
|
||||
{
|
||||
@@ -188,7 +200,7 @@ namespace BlackMisc
|
||||
for (const OBJ &obj : others)
|
||||
{
|
||||
const CCallsign cs(obj.getCallsign());
|
||||
if (cs.isEmpty()) continue;
|
||||
if (cs.isEmpty()) { continue; }
|
||||
copy.removeByCallsign(cs);
|
||||
copy.push_back(obj);
|
||||
c++;
|
||||
@@ -237,6 +249,7 @@ namespace BlackMisc
|
||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE ICallsignObjectList<BlackMisc::Aviation::CAircraftSituation, BlackMisc::Aviation::CAircraftSituationList>;
|
||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE ICallsignObjectList<BlackMisc::Aviation::CFlightPlan, BlackMisc::Aviation::CFlightPlanList>;
|
||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE ICallsignObjectList<BlackMisc::Simulation::CSimulatedAircraft, BlackMisc::Simulation::CSimulatedAircraftList>;
|
||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE ICallsignObjectList<BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign, BlackMisc::Simulation::CInterpolationSetupList>;
|
||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE ICallsignObjectList<BlackMisc::Network::CClient, BlackMisc::Network::CClientList>;
|
||||
//! \endcond
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace BlackMisc
|
||||
{
|
||||
class CSimulatedAircraft;
|
||||
class CSimulatedAircraftList;
|
||||
class CInterpolationAndRenderingSetupPerCallsign;
|
||||
class CInterpolationSetupList;
|
||||
}
|
||||
|
||||
namespace Network
|
||||
@@ -90,11 +92,14 @@ namespace BlackMisc
|
||||
//! Split into 0..n containers as per callsign
|
||||
QHash<BlackMisc::Aviation::CCallsign, CONTAINER> splitPerCallsign() const;
|
||||
|
||||
//! Replace or add objects by callsign
|
||||
int replaceOrAddObjectByCallsign(const OBJ &otherObject);
|
||||
|
||||
//! Replace or add objects by callsign
|
||||
int replaceOrAddObjectsByCallsign(const CONTAINER &others);
|
||||
|
||||
//! Incremental update or add object
|
||||
int incrementalUpdateOrAdd(const OBJ &objectBeforeChanged, const BlackMisc::CPropertyIndexVariantMap &changedValues);
|
||||
int incrementalUpdateOrAdd(const OBJ &objectBeforeChanged, const CPropertyIndexVariantMap &changedValues);
|
||||
|
||||
//! Sort by callsign
|
||||
void sortByCallsign();
|
||||
@@ -115,6 +120,7 @@ namespace BlackMisc
|
||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE ICallsignObjectList<BlackMisc::Aviation::CAircraftSituation, BlackMisc::Aviation::CAircraftSituationList>;
|
||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE ICallsignObjectList<BlackMisc::Aviation::CFlightPlan, BlackMisc::Aviation::CFlightPlanList>;
|
||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE ICallsignObjectList<BlackMisc::Simulation::CSimulatedAircraft, BlackMisc::Simulation::CSimulatedAircraftList>;
|
||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE ICallsignObjectList<BlackMisc::Simulation::CInterpolationAndRenderingSetupPerCallsign, BlackMisc::Simulation::CInterpolationSetupList>;
|
||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE ICallsignObjectList<BlackMisc::Network::CClient, BlackMisc::Network::CClientList>;
|
||||
//! \endcond
|
||||
|
||||
|
||||
Reference in New Issue
Block a user