Use nested namespaces (C++17 feature)

This commit is contained in:
Mat Sutcliffe
2021-09-15 21:44:54 +01:00
parent 3f2e5b0b69
commit 57d32da826
1345 changed files with 146075 additions and 150376 deletions

View File

@@ -23,86 +23,83 @@
#include <QReadWriteLock>
#include <atomic>
namespace BlackMisc
namespace BlackMisc::Simulation
{
namespace Simulation
//! Validate model files from the sets and check if the model still exists
class BLACKMISC_EXPORT CBackgroundValidation : public CContinuousWorker
{
//! Validate model files from the sets and check if the model still exists
class BLACKMISC_EXPORT CBackgroundValidation : public CContinuousWorker
{
Q_OBJECT
Q_OBJECT
public:
//! Log categories
static const QStringList &getLogCategories();
public:
//! Log categories
static const QStringList &getLogCategories();
//! Constructor
CBackgroundValidation(QObject *owner);
//! Constructor
CBackgroundValidation(QObject *owner);
//! Corresponding simulator
//! \threadsafe
void setCurrentSimulator(const CSimulatorInfo &simulator, const QString &simDirectory);
//! Corresponding simulator
//! \threadsafe
void setCurrentSimulator(const CSimulatorInfo &simulator, const QString &simDirectory);
//! Was already checked for simulator?
//! \threadsafe
bool wasAlreadyChecked(const CSimulatorInfo &simulator) const;
//! Was already checked for simulator?
//! \threadsafe
bool wasAlreadyChecked(const CSimulatorInfo &simulator) const;
//! Validation in progress
//! \threadsafe
bool isValidating() const { return m_inWork; }
//! Validation in progress
//! \threadsafe
bool isValidating() const { return m_inWork; }
//! Reset checked for simulator
//! \threadsafe
void resetAlreadyChecked(const CSimulatorInfo &simulator);
//! Reset checked for simulator
//! \threadsafe
void resetAlreadyChecked(const CSimulatorInfo &simulator);
//! Corresponding simulator
//! \threadsafe
BlackMisc::Simulation::CSimulatorInfo getCurrentSimulator() const;
//! Corresponding simulator
//! \threadsafe
BlackMisc::Simulation::CSimulatorInfo getCurrentSimulator() const;
//! Trigger a validation, returns false if "work in progress"
//! \threadsafe
bool triggerValidation(const CSimulatorInfo &simulator, const QString &simDirectory);
//! Trigger a validation, returns false if "work in progress"
//! \threadsafe
bool triggerValidation(const CSimulatorInfo &simulator, const QString &simDirectory);
//! Request last results (again), if there are any
//! \remark emits CBackgroundValidation::validated signal
//! \threadsafe
bool requestLastValidationResults();
//! Request last results (again), if there are any
//! \remark emits CBackgroundValidation::validated signal
//! \threadsafe
bool requestLastValidationResults();
signals:
//! Validating
void validating(bool running);
signals:
//! Validating
void validating(bool running);
//! Validated for simulator
void validated(const CSimulatorInfo &simulator, const CAircraftModelList &validModels, const CAircraftModelList &invalidModels, bool stopped, const CStatusMessageList &msgs);
//! Validated for simulator
void validated(const CSimulatorInfo &simulator, const CAircraftModelList &validModels, const CAircraftModelList &invalidModels, bool stopped, const CStatusMessageList &msgs);
protected:
//! \copydoc CContinuousWorker::beforeQuit
virtual void beforeQuit() noexcept override;
protected:
//! \copydoc CContinuousWorker::beforeQuit
virtual void beforeQuit() noexcept override;
private:
mutable QReadWriteLock m_lock; //!< lock snapshot
std::atomic_bool m_inWork { false }; //!< indicates a running update
std::atomic_bool m_wasStopped { false }; //!< has been stopped or should be stopped
CSimulatorInfo m_simulator; //!< simulator
QString m_simDirectory; //!< corresponding sim directory
private:
mutable QReadWriteLock m_lock; //!< lock snapshot
std::atomic_bool m_inWork { false }; //!< indicates a running update
std::atomic_bool m_wasStopped { false }; //!< has been stopped or should be stopped
CSimulatorInfo m_simulator; //!< simulator
QString m_simDirectory; //!< corresponding sim directory
// last result values, mostly needed when running in the distributed swift system and we want to get the values
CAircraftModelList m_lastResultValid;
CAircraftModelList m_lastResultInvalid;
CSimulatorInfo m_lastResultSimulator;
CStatusMessageList m_lastResultMsgs;
bool m_lastResultWasStopped = false;
std::atomic_int m_timerBasedRuns{0};
// last result values, mostly needed when running in the distributed swift system and we want to get the values
CAircraftModelList m_lastResultValid;
CAircraftModelList m_lastResultInvalid;
CSimulatorInfo m_lastResultSimulator;
CStatusMessageList m_lastResultMsgs;
bool m_lastResultWasStopped = false;
std::atomic_int m_timerBasedRuns{0};
QMap<CSimulatorInfo, CStatusMessageList> m_checkedSimulatorMsgs; //!< all simulators ever checked
CSetting<Settings::TModelMatching> m_matchingSettings { this }; //!< settings
QMap<CSimulatorInfo, CStatusMessageList> m_checkedSimulatorMsgs; //!< all simulators ever checked
CSetting<Settings::TModelMatching> m_matchingSettings { this }; //!< settings
// Set/caches as member as we are in own thread, central instance will not work
Data::CModelSetCaches m_modelSets { false, this };
// Set/caches as member as we are in own thread, central instance will not work
Data::CModelSetCaches m_modelSets { false, this };
//! Do the validation checks
void doWork();
};
} // ns
//! Do the validation checks
void doWork();
};
} // ns
#endif // guard