mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
refs #849, matching statistics entry and container class
This commit is contained in:
committed by
Mathew Sutcliffe
parent
dcfaca431c
commit
ad0ef16ba5
70
src/blackmisc/simulation/matchingstatistics.h
Normal file
70
src/blackmisc/simulation/matchingstatistics.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* Copyright (C) 2017
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_SIMULATION_MATCHINGSTATISTICS_H
|
||||
#define BLACKMISC_SIMULATION_MATCHINGSTATISTICS_H
|
||||
|
||||
#include "matchingstatisticsentry.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/timestampobjectlist.h"
|
||||
#include "blackmisc/collection.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
//! Value object for matching statistics.
|
||||
class BLACKMISC_EXPORT CMatchingStatistics :
|
||||
public BlackMisc::CSequence<CMatchingStatisticsEntry>,
|
||||
public BlackMisc::ITimestampObjectList<CMatchingStatisticsEntry, CMatchingStatistics>,
|
||||
public BlackMisc::Mixin::MetaType<CMatchingStatistics>
|
||||
{
|
||||
public:
|
||||
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CMatchingStatistics)
|
||||
|
||||
//! Default constructor.
|
||||
CMatchingStatistics();
|
||||
|
||||
//! Construct from a base class object.
|
||||
CMatchingStatistics(const CSequence<CMatchingStatisticsEntry> &other);
|
||||
|
||||
//! Find by session id
|
||||
CMatchingStatistics findBySessionId(const QString &sessionId) const;
|
||||
|
||||
//! Find entires denoting missing entries only
|
||||
CMatchingStatistics findMissingOnly() const;
|
||||
|
||||
//! Contains session id
|
||||
bool containsSessionId(const QString &sessionId) const;
|
||||
|
||||
//! Contains given aircraft / airline combination
|
||||
bool containsAircraftAirlineCombination(const QString &aircraftDesignator, const QString &airlineDesignator) const;
|
||||
|
||||
//! Contains given aircraft / airline combination
|
||||
bool containsAircraftAirlineCombination(const QString &sessionId, const QString &aircraftDesignator, const QString &airlineDesignator) const;
|
||||
|
||||
//! Increase count if found
|
||||
bool increaseCountIfFound(CMatchingStatisticsEntry::EntryType type, const QString &sessionId, const QString &aircraftDesignator, const QString &airlineDesignator = {});
|
||||
|
||||
//! Add a combination, normally with no duplicates (in that case count is increased
|
||||
void addAircraft(CMatchingStatisticsEntry::EntryType type, const QString &sessionId, const QString &modelSetId, const QString &description, const QString &aircraftDesignator, bool avoidDuplicates = true);
|
||||
|
||||
//! Add a combination, normally with no duplicates (in that case count is increased
|
||||
void addAircraftAirlineCombination(CMatchingStatisticsEntry::EntryType type, const QString &sessionId, const QString &modelSetId, const QString &description, const QString &aircraftDesignator, const QString &airlineDesignator, bool avoidDuplicates = true);
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CMatchingStatistics)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Simulation::CMatchingStatisticsEntry>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Simulation::CMatchingStatisticsEntry>)
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user