6 #ifndef SWIFT_MISC_SIMULATION_AIRCRAFTMATCHERSETUP_H
7 #define SWIFT_MISC_SIMULATION_AIRCRAFTMATCHERSETUP_H
14 namespace swift::misc::simulation
24 MatchingStepwiseReducePlusScoreBased,
25 MatchingStepwiseReduce,
31 ByModelString = 1 << 0,
35 ByCombinedType = 1 << 4,
36 ByManufacturer = 1 << 5,
39 ByMilOrCivilian = ByCivilian | ByMilitary,
41 ByIcaoOrderAircraftFirst = (1 << 9) | ByIcaoData,
42 ByIcaoOrderAirlineFirst = (1 << 10) | ByIcaoData,
43 ByAirlineGroupSameAsAirline = (1 << 11) | ByIcaoData,
44 ByAirlineGroupIfNoAirline = (1 << 12) | ByIcaoData,
47 ExcludeNoDbData = 1 << 13,
48 ExcludeNoExcluded = 1 << 14,
49 ExcludeDefault = ExcludeNoExcluded | ExcludeNoDbData,
52 ModelSetRemoveFailedModel = 1 << 15,
53 ModelVerificationAtStartup = 1 << 16,
54 ModelFailoverIfNoModelCanBeAdded = 1 << 17,
55 ModelVerificationOnlyWarnError = 1 << 18,
58 ByCategoryGlider = 1 << 20,
59 ByCategoryMilitary = 1 << 21,
60 ByCategorySmallAircraft = 1 << 22,
63 ReverseLookupModelString = 1 << 25,
64 ReverseLookupSwiftLiveryIds = 1 << 26,
65 ReverseLookupDefault = ReverseLookupModelString | ReverseLookupSwiftLiveryIds,
68 ScoreIgnoreZeros = 1 << 28,
69 ScorePreferColorLiveries = 1 << 29,
73 ModeByFLags = ByMilOrCivilian | ByVtol,
76 ModeDefaultSet = ModelSetRemoveFailedModel | ModelVerificationAtStartup | ModelFailoverIfNoModelCanBeAdded,
79 ModeDefaultScore = ScoreIgnoreZeros | ScorePreferColorLiveries | ExcludeDefault | ReverseLookupDefault,
80 ModeDefaultReduce = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType |
81 ByIcaoOrderAircraftFirst | ByAirlineGroupIfNoAirline | ReverseLookupDefault |
82 ExcludeDefault | ByLivery,
83 ModeDefaultReducePlusScore = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType |
84 ByIcaoOrderAircraftFirst | ByAirlineGroupIfNoAirline | ReverseLookupDefault |
85 ExcludeDefault | ModeDefaultScore,
87 Q_DECLARE_FLAGS(MatchingMode, MatchingModeFlag)
94 ForceEnginecount = 1 << 1,
97 Q_DECLARE_FLAGS(ForceMode, ForceModeFlag)
110 IndexMatchingAlgorithm = CPropertyIndexRef::GlobalIndexCAircraftMatcherSetup,
114 IndexMsNetworkEntryFile,
115 IndexMsMatchingStageFile,
116 IndexMsNetworkEnabled,
117 IndexMsMatchingStageEnabled
127 CAircraftMatcherSetup(MatchingAlgorithm algorithm, MatchingMode mode, PickSimilarStrategy pickStrategy);
136 bool setMatchingAlgorithm(MatchingAlgorithm algorithm,
bool reset =
true);
142 ForceMode
getForceMode()
const {
return static_cast<ForceMode
>(m_force); }
152 bool isReverseLookupModelString()
const;
153 bool isReverseLookupSwiftLiveryIds()
const;
154 void resetReverseLookup();
158 bool isDbDataOnly()
const {
return this->getMatchingMode().testFlag(ExcludeNoDbData); }
180 bool doRunMsReverseLookupScript()
const;
181 bool doRunMsMatchingStageScript()
const;
198 return this->getMatchingMode().testFlag(ModelVerificationOnlyWarnError);
203 bool doModelAddFailover()
const {
return this->getMatchingMode().testFlag(ModelFailoverIfNoModelCanBeAdded); }
206 void setVerificationAtStartup(
bool verify);
209 void setOnlyShowVerificationWarningsAndErrors(
bool only);
230 void setAirlineGroupBehaviour(
bool ifNoAirline,
bool sameAsAirline);
233 QString convertToQString(
bool i18n =
false)
const;
245 void reset(MatchingAlgorithm algorithm);
248 bool useCategoryMatching()
const;
251 static const QString &algorithmToString(MatchingAlgorithm algorithm);
254 static const QString &modeFlagToString(MatchingModeFlag modeFlag);
257 static QString modeToString(MatchingMode mode);
260 static const QString &forceFlagToString(ForceModeFlag forceFlag);
263 static QString forceToString(ForceMode force);
266 static const QString &strategyToString(PickSimilarStrategy strategy);
269 static MatchingMode matchingMode(
bool revModelString,
bool revLiveryIds,
bool byModelString,
270 bool byIcaoDataAircraft1st,
bool byIcaoDataAirline1st,
bool byFamily,
271 bool byLivery,
bool byCombinedType,
bool byForceMilitary,
bool byForceCivilian,
272 bool byVtol,
bool byGliderCategory,
bool byMilitaryCategory,
273 bool bySmallAircraftCategory,
bool scoreIgnoreZeros,
274 bool scorePreferColorLiveries,
bool excludeNoDbData,
bool excludeNoExcluded,
275 bool modelVerification,
bool modelVerificationWarnError,
276 bool modelSetRemoveFailedModel,
bool modelFailover);
279 int m_algorithm =
static_cast<int>(MatchingStepwiseReducePlusScoreBased);
280 int m_mode =
static_cast<int>(ModeDefaultReducePlusScore);
281 int m_strategy =
static_cast<int>(PickByOrder);
282 int m_force =
static_cast<int>(ForceNothing);
283 QString m_msReverseLookupFile;
284 QString m_msMatchingStageFile;
285 bool m_msReverseEnabled =
false;
286 bool m_msMatchingEnabled =
false;
303 Q_DECLARE_METATYPE(swift::misc::simulation::CAircraftMatcherSetup::MatchingMode)
305 Q_DECLARE_METATYPE(swift::misc::simulation::CAircraftMatcherSetup::ForceMode)
308 Q_DECLARE_OPERATORS_FOR_FLAGS(swift::misc::simulation::CAircraftMatcherSetup::MatchingMode)
Non-owning reference to a CPropertyIndex with a subset of its features.
Mix of the most commonly used mixin classes.
ColumnIndex
Base class enums.
void setMsMatchingStageEnabled(bool enabled)
Is matching script enabled.
bool removeFromSetIfFailed() const
Remove if failed?
bool onlyShowVerificationWarningsAndErrors() const
Verification only shown for warning/errors?
void setMsReverseLookupFile(const QString &file)
Set matching files.
QString getForceModeAsString() const
Force mode as string.
bool isDbDataOnly() const
DB data?
bool doVerificationAtStartup() const
Verification at startup?
MatchingMode getMatchingMode() const
Matching mode.
void setMsReverseLookupEnabled(bool enabled)
Is matching script enabled.
PickSimilarStrategy
How to pick among similar candiates.
const QString & getMsMatchingStageFile() const
Get matching files.
MatchingModeFlag
Enabled matching mode flags.
ForceModeFlag
Force values.
void setPickStrategy(PickSimilarStrategy strategy)
Set the strategy.
ForceMode getForceMode() const
Force mode.
bool doModelAddFailover() const
Failover if model cannot be loaded.
QString getMatchingModeAsString() const
Matching mode as string.
void setMsMatchingStageFile(const QString &file)
Set matching files.
void setMatchingMode(MatchingMode mode)
Dynamic offset values?
bool isMsMatchingStageEnabled() const
Is matching script enabled.
MatchingAlgorithm getMatchingAlgorithm() const
Algorithm.
void setForceMode(ForceMode fm)
Force mode.
const QString & getMatchingAlgorithmAsString() const
Algorithm as string.
PickSimilarStrategy getPickStrategy() const
Strategy among equally suitable models.
const QString & getPickStrategyAsString() const
Strategy as string.
const QString & getMsReverseLookupFile() const
Get matching files.
bool isMsReverseLookupEnabled() const
Is matching script enabled.
MatchingAlgorithm
Matching algorithm.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...