Fix weak vtables

This commit is contained in:
Roland Winklmeier
2018-08-24 15:25:47 +02:00
parent 4cf3bc580f
commit 5e38936fd2
30 changed files with 133 additions and 8 deletions

View File

@@ -25,6 +25,8 @@ namespace BlackGui
class BLACKGUI_EXPORT CDbMappingComponentAware class BLACKGUI_EXPORT CDbMappingComponentAware
{ {
public: public:
//! Set the corresponding component //! Set the corresponding component
virtual void setMappingComponent(CDbMappingComponent *component); virtual void setMappingComponent(CDbMappingComponent *component);
@@ -35,6 +37,9 @@ namespace BlackGui
//! Constructor //! Constructor
CDbMappingComponentAware(QObject *parent); CDbMappingComponentAware(QObject *parent);
//! Destructor
virtual ~CDbMappingComponentAware() {}
private : private :
CDbMappingComponent *m_mappingComponent = nullptr; //!< reference to component CDbMappingComponent *m_mappingComponent = nullptr; //!< reference to component
}; };

View File

@@ -63,6 +63,9 @@ namespace BlackGui
//! \remarks Normally the info area will be provided later \sa setParentDockWidgetInfoArea //! \remarks Normally the info area will be provided later \sa setParentDockWidgetInfoArea
CEnableForDockWidgetInfoArea(CDockWidgetInfoArea *parentInfoArea = nullptr); CEnableForDockWidgetInfoArea(CDockWidgetInfoArea *parentInfoArea = nullptr);
// Destructor
virtual ~CEnableForDockWidgetInfoArea() {}
private: private:
BlackGui::CDockWidgetInfoArea *m_parentDockableInfoArea = nullptr; //!< my parent dockable widget BlackGui::CDockWidgetInfoArea *m_parentDockableInfoArea = nullptr; //!< my parent dockable widget
BlackMisc::CConnectionGuard m_connections; BlackMisc::CConnectionGuard m_connections;

View File

@@ -21,6 +21,9 @@ namespace BlackGui
CDropBase::CDropBase() CDropBase::CDropBase()
{ } { }
CDropBase::~CDropBase()
{ }
void CDropBase::setAcceptedMetaTypeIds(const QList<int> &ids) void CDropBase::setAcceptedMetaTypeIds(const QList<int> &ids)
{ {
m_acceptedMetaTypes = ids; m_acceptedMetaTypes = ids;

View File

@@ -24,6 +24,9 @@ namespace BlackGui
class BLACKGUI_EXPORT CDropBase class BLACKGUI_EXPORT CDropBase
{ {
public: public:
//! Dtor
virtual ~CDropBase();
//! Accepted ids //! Accepted ids
void setAcceptedMetaTypeIds(const QList<int> &ids); void setAcceptedMetaTypeIds(const QList<int> &ids);
@@ -48,9 +51,6 @@ namespace BlackGui
//! Mime data to CVariant (normally encapsulating a value object) //! Mime data to CVariant (normally encapsulating a value object)
BlackMisc::CVariant toCVariant(const QMimeData *mime) const; BlackMisc::CVariant toCVariant(const QMimeData *mime) const;
//! Dtor
virtual ~CDropBase() {}
protected: protected:
//! Ctor //! Ctor
CDropBase(); CDropBase();

View File

@@ -34,6 +34,9 @@ namespace BlackGui
{ {
namespace Menus namespace Menus
{ {
void IAircraftModelViewMenu::anchor()
{ }
const CLogCategoryList &IAircraftModelViewMenu::getLogCategories() const CLogCategoryList &IAircraftModelViewMenu::getLogCategories()
{ {
static const CLogCategoryList cats { CLogCategory::guiComponent() }; static const CLogCategoryList cats { CLogCategory::guiComponent() };

View File

@@ -28,6 +28,8 @@ namespace BlackGui
//! Menu base class for aircraft model view menus //! Menu base class for aircraft model view menus
class IAircraftModelViewMenu : public IMenuDelegate class IAircraftModelViewMenu : public IMenuDelegate
{ {
virtual void anchor();
public: public:
//! Constructor //! Constructor
IAircraftModelViewMenu(BlackGui::Views::CAircraftModelView *modelView, bool separator = true) : IAircraftModelViewMenu(BlackGui::Views::CAircraftModelView *modelView, bool separator = true) :

View File

@@ -25,6 +25,9 @@ namespace BlackMisc
{ {
namespace Geo namespace Geo
{ {
ICoordinateGeodetic::~ICoordinateGeodetic()
{ }
QString CCoordinateGeodetic::convertToQString(bool i18n) const QString CCoordinateGeodetic::convertToQString(bool i18n) const
{ {
return ICoordinateGeodetic::convertToQString(i18n); return ICoordinateGeodetic::convertToQString(i18n);

View File

@@ -56,7 +56,7 @@ namespace BlackMisc
}; };
//! Destructor //! Destructor
virtual ~ICoordinateGeodetic() {} virtual ~ICoordinateGeodetic();
//! Latitude //! Latitude
virtual CLatitude latitude() const = 0; virtual CLatitude latitude() const = 0;

View File

@@ -24,6 +24,10 @@ namespace BlackMisc
return stack.localData(); return stack.localData();
} }
// pin vtables to this file
void CJsonException::anchor()
{ }
CStatusMessage CJsonException::toStatusMessage(const CLogCategoryList &categories, const QString &prefix) const CStatusMessage CJsonException::toStatusMessage(const CLogCategoryList &categories, const QString &prefix) const
{ {
return CStatusMessage(categories).validationError(toString(prefix)); return CStatusMessage(categories).validationError(toString(prefix));

View File

@@ -26,6 +26,8 @@ namespace BlackMisc
*/ */
class BLACKMISC_EXPORT CJsonException : public std::runtime_error class BLACKMISC_EXPORT CJsonException : public std::runtime_error
{ {
virtual void anchor();
public: public:
//! Constructor. //! Constructor.
explicit CJsonException(const QString &message) : std::runtime_error(message.toStdString()) {} explicit CJsonException(const QString &message) : std::runtime_error(message.toStdString()) {}

View File

@@ -132,6 +132,10 @@ namespace BlackMisc
return true; return true;
} }
// Pin the vtable to this file
void CClientAware::anchor()
{ }
CClientList CClientAware::getClients() const CClientList CClientAware::getClients() const
{ {
if (this->provider()) { return this->provider()->getClients(); } if (this->provider()) { return this->provider()->getClients(); }

View File

@@ -109,6 +109,8 @@ namespace BlackMisc
//! Class which can be directly used to access an \sa IClientProvider object //! Class which can be directly used to access an \sa IClientProvider object
class BLACKMISC_EXPORT CClientAware : public IProviderAware<IClientProvider> class BLACKMISC_EXPORT CClientAware : public IProviderAware<IClientProvider>
{ {
virtual void anchor();
public: public:
//! \copydoc CClientProvider::getClients //! \copydoc CClientProvider::getClients
CClientList getClients() const; CClientList getClients() const;

View File

@@ -57,6 +57,10 @@ namespace BlackMisc
return true; return true;
} }
// pin vtable to this file
void CEcosystemAware::anchor()
{ }
CEcosystem CEcosystemAware::getCurrentEcosystem() const CEcosystem CEcosystemAware::getCurrentEcosystem() const
{ {
if (!this->hasProvider()) { return CEcosystem::unspecified(); } if (!this->hasProvider()) { return CEcosystem::unspecified(); }

View File

@@ -63,6 +63,8 @@ namespace BlackMisc
//! Delegating class which can be directly used to access an \sa IEcosystemProvider instance //! Delegating class which can be directly used to access an \sa IEcosystemProvider instance
class BLACKMISC_EXPORT CEcosystemAware : public IProviderAware<IEcosystemProvider> class BLACKMISC_EXPORT CEcosystemAware : public IProviderAware<IEcosystemProvider>
{ {
virtual void anchor();
public: public:
//! Set the provider //! Set the provider
void setEcosystemProvider(IEcosystemProvider *provider) { this->setProvider(provider); } void setEcosystemProvider(IEcosystemProvider *provider) { this->setProvider(provider); }

View File

@@ -18,6 +18,29 @@ namespace BlackMisc
{ {
using BlackMisc::Math::CMathUtils; using BlackMisc::Math::CMathUtils;
// pin vtables to this file
void CLengthUnit::anchor()
{ }
void CFrequencyUnit::anchor()
{ }
void CMassUnit::anchor()
{ }
void CPressureUnit::anchor()
{ }
void CTemperatureUnit::anchor()
{ }
void CSpeedUnit::anchor()
{ }
void CAccelerationUnit::anchor()
{ }
QString CAngleUnit::makeRoundedQStringWithUnit(double value, int digits, bool i18n) const QString CAngleUnit::makeRoundedQStringWithUnit(double value, int digits, bool i18n) const
{ {
if (digits < 0) digits = this->getDisplayDigits(); if (digits < 0) digits = this->getDisplayDigits();

View File

@@ -56,6 +56,8 @@ namespace BlackMisc
struct StatuteMilesToMeters { static double factor() { return 1609.3472; } }; struct StatuteMilesToMeters { static double factor() { return 1609.3472; } };
using MetersToMeters = One; using MetersToMeters = One;
virtual void anchor();
public: public:
//! Base type //! Base type
using base_type = CMeasurementUnit; using base_type = CMeasurementUnit;
@@ -271,6 +273,8 @@ namespace BlackMisc
using HertzToHertz = One; using HertzToHertz = One;
virtual void anchor();
public: public:
//! Base type //! Base type
using base_type = CMeasurementUnit; using base_type = CMeasurementUnit;
@@ -362,6 +366,8 @@ namespace BlackMisc
using GramsToKilograms = Milli<One>; using GramsToKilograms = Milli<One>;
struct PoundsToKilograms { static double factor() { return 0.45359237; } }; struct PoundsToKilograms { static double factor() { return 0.45359237; } };
virtual void anchor();
public: public:
//! Base type //! Base type
using base_type = CMeasurementUnit; using base_type = CMeasurementUnit;
@@ -464,6 +470,8 @@ namespace BlackMisc
struct InchesToHectopascals { static double factor() { return 33.86389; } }; struct InchesToHectopascals { static double factor() { return 33.86389; } };
struct MillimetersToHectopascals { static double factor() { return 860.142806; } }; struct MillimetersToHectopascals { static double factor() { return 860.142806; } };
virtual void anchor();
public: public:
//! Base type //! Base type
using base_type = CMeasurementUnit; using base_type = CMeasurementUnit;
@@ -589,6 +597,8 @@ namespace BlackMisc
static double offset() { return 32.0; } static double offset() { return 32.0; }
}; };
virtual void anchor();
public: public:
//! Base type //! Base type
using base_type = CMeasurementUnit; using base_type = CMeasurementUnit;
@@ -673,6 +683,8 @@ namespace BlackMisc
struct FtPerSecToMps { static double factor() { return 0.3048 ; } }; struct FtPerSecToMps { static double factor() { return 0.3048 ; } };
struct FtPerMinToMps { static double factor() { return 0.3048 / 60.0; } }; struct FtPerMinToMps { static double factor() { return 0.3048 / 60.0; } };
virtual void anchor();
public: public:
//! Base type //! Base type
using base_type = CMeasurementUnit; using base_type = CMeasurementUnit;
@@ -918,6 +930,8 @@ namespace BlackMisc
struct FeetToMeters { static double factor() { return 0.3048; } }; struct FeetToMeters { static double factor() { return 0.3048; } };
virtual void anchor();
public: public:
//! Base type //! Base type
using base_type = CMeasurementUnit; using base_type = CMeasurementUnit;

View File

@@ -0,0 +1,16 @@
/* Copyright (C) 2018
* 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.
*/
#include "blackmisc/provider.h"
namespace BlackMisc
{
IProvider::~IProvider()
{ }
}

View File

@@ -20,11 +20,11 @@
namespace BlackMisc namespace BlackMisc
{ {
//! Base class for providers //! Base class for providers
class IProvider class BLACKMISC_EXPORT IProvider
{ {
public: public:
//! Dtor //! Dtor
virtual ~IProvider() {} virtual ~IProvider();
//! Return as QObject //! Return as QObject
virtual QObject *asQObject() { return nullptr; } virtual QObject *asQObject() { return nullptr; }

View File

@@ -197,6 +197,10 @@ namespace BlackMisc
return m_setups; return m_setups;
} }
// pin vtables to this file
void CInterpolationSetupAware::anchor()
{ }
CInterpolationAndRenderingSetupPerCallsign CInterpolationSetupAware::getInterpolationSetupPerCallsignOrDefault(const CCallsign &callsign) const CInterpolationAndRenderingSetupPerCallsign CInterpolationSetupAware::getInterpolationSetupPerCallsignOrDefault(const CCallsign &callsign) const
{ {
if (!this->hasProvider()) { return CInterpolationAndRenderingSetupPerCallsign(); } if (!this->hasProvider()) { return CInterpolationAndRenderingSetupPerCallsign(); }

View File

@@ -110,6 +110,8 @@ namespace BlackMisc
//! Class which can be directly used to access an \sa IInterpolationSetupProvider object //! Class which can be directly used to access an \sa IInterpolationSetupProvider object
class BLACKMISC_EXPORT CInterpolationSetupAware : public IProviderAware<IInterpolationSetupProvider> class BLACKMISC_EXPORT CInterpolationSetupAware : public IProviderAware<IInterpolationSetupProvider>
{ {
virtual void anchor();
public: public:
//! \copydoc IInterpolationSetupProvider::getInterpolationSetupPerCallsignOrDefault //! \copydoc IInterpolationSetupProvider::getInterpolationSetupPerCallsignOrDefault
CInterpolationAndRenderingSetupPerCallsign getInterpolationSetupPerCallsignOrDefault(const Aviation::CCallsign &callsign) const; CInterpolationAndRenderingSetupPerCallsign getInterpolationSetupPerCallsignOrDefault(const Aviation::CCallsign &callsign) const;

View File

@@ -54,6 +54,9 @@ namespace BlackMisc
m_pbh = CInterpolatorPbh(m_simulationTimeFraction, situation1, situation2); m_pbh = CInterpolatorPbh(m_simulationTimeFraction, situation1, situation2);
} }
void CInterpolatorLinear::anchor()
{ }
CAircraftSituation CInterpolatorLinear::CInterpolant::interpolatePositionAndAltitude(const CAircraftSituation &situation, bool interpolateGndFactor) const CAircraftSituation CInterpolatorLinear::CInterpolant::interpolatePositionAndAltitude(const CAircraftSituation &situation, bool interpolateGndFactor) const
{ {
const std::array<double, 3> oldVec(m_oldSituation.getPosition().normalVectorDouble()); const std::array<double, 3> oldVec(m_oldSituation.getPosition().normalVectorDouble());

View File

@@ -30,6 +30,8 @@ namespace BlackMisc
//! Linear interpolator, calculation inbetween positions //! Linear interpolator, calculation inbetween positions
class BLACKMISC_EXPORT CInterpolatorLinear : public CInterpolator<CInterpolatorLinear> class BLACKMISC_EXPORT CInterpolatorLinear : public CInterpolator<CInterpolatorLinear>
{ {
virtual void anchor();
public: public:
//! Constructor //! Constructor
CInterpolatorLinear(const Aviation::CCallsign &callsign, CInterpolatorLinear(const Aviation::CCallsign &callsign,

View File

@@ -142,6 +142,10 @@ namespace BlackMisc
return true; return true;
} }
// pin vtables to this file
void CInterpolatorSpline::anchor()
{ }
CInterpolatorSpline::CInterpolant CInterpolatorSpline::getInterpolant(SituationLog &log) CInterpolatorSpline::CInterpolant CInterpolatorSpline::getInterpolant(SituationLog &log)
{ {
// recalculate derivatives only if they changed // recalculate derivatives only if they changed

View File

@@ -27,6 +27,8 @@ namespace BlackMisc
//! Cubic spline interpolator //! Cubic spline interpolator
class BLACKMISC_EXPORT CInterpolatorSpline : public CInterpolator<CInterpolatorSpline> class BLACKMISC_EXPORT CInterpolatorSpline : public CInterpolator<CInterpolatorSpline>
{ {
virtual void anchor();
public: public:
//! Constructor //! Constructor
CInterpolatorSpline(const Aviation::CCallsign &callsign, CInterpolatorSpline(const Aviation::CCallsign &callsign,

View File

@@ -24,6 +24,10 @@ namespace BlackMisc
return changed1 || changed2; return changed1 || changed2;
} }
// pin vtables to this file
void COwnAircraftAware::anchor()
{ }
CSimulatedAircraft COwnAircraftAware::getOwnAircraft() const CSimulatedAircraft COwnAircraftAware::getOwnAircraft() const
{ {
Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available"); Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");

View File

@@ -111,6 +111,8 @@ namespace BlackMisc
//! Delegating class which can be directly used to access an \sa IOwnAircraftProvider instance //! Delegating class which can be directly used to access an \sa IOwnAircraftProvider instance
class BLACKMISC_EXPORT COwnAircraftAware : public IProviderAware<IOwnAircraftProvider> class BLACKMISC_EXPORT COwnAircraftAware : public IProviderAware<IOwnAircraftProvider>
{ {
virtual void anchor();
public: public:
//! Set the provider //! Set the provider
void setOwnAircraftProvider(IOwnAircraftProvider *provider) { this->setProvider(provider); } void setOwnAircraftProvider(IOwnAircraftProvider *provider) { this->setProvider(provider); }

View File

@@ -24,6 +24,9 @@ namespace BlackMisc
{ {
namespace Simulation namespace Simulation
{ {
IRemoteAircraftProvider::~IRemoteAircraftProvider()
{ }
const CLogCategoryList &CRemoteAircraftProvider::getLogCategories() const CLogCategoryList &CRemoteAircraftProvider::getLogCategories()
{ {
static const CLogCategoryList cats { CLogCategory::matching(), CLogCategory::network() }; static const CLogCategoryList cats { CLogCategory::matching(), CLogCategory::network() };
@@ -756,6 +759,9 @@ namespace BlackMisc
return removedCallsign; return removedCallsign;
} }
CRemoteAircraftAware::~CRemoteAircraftAware()
{ }
CSimulatedAircraftList CRemoteAircraftAware::getAircraftInRange() const CSimulatedAircraftList CRemoteAircraftAware::getAircraftInRange() const
{ {
Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available"); Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");

View File

@@ -52,7 +52,7 @@ namespace BlackMisc
static constexpr int DefaultOffsetTimeMs = 6000; //!< \fixme copied from CNetworkVatlib::c_positionTimeOffsetMsec static constexpr int DefaultOffsetTimeMs = 6000; //!< \fixme copied from CNetworkVatlib::c_positionTimeOffsetMsec
//! Destructor //! Destructor
virtual ~IRemoteAircraftProvider() {} virtual ~IRemoteAircraftProvider();
//! All remote aircraft //! All remote aircraft
//! \threadsafe //! \threadsafe
@@ -449,7 +449,7 @@ namespace BlackMisc
{ {
public: public:
//! Destructor //! Destructor
virtual ~CRemoteAircraftAware() {} virtual ~CRemoteAircraftAware();
//! \copydoc IRemoteAircraftProvider::getAircraftInRange //! \copydoc IRemoteAircraftProvider::getAircraftInRange
CSimulatedAircraftList getAircraftInRange() const; CSimulatedAircraftList getAircraftInRange() const;

View File

@@ -344,6 +344,10 @@ namespace BlackMisc
this->resetSimulationEnvironmentStatistics(); this->resetSimulationEnvironmentStatistics();
} }
// pin vtables to this file
void CSimulationEnvironmentAware::anchor()
{ }
CElevationPlane CSimulationEnvironmentAware::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const CElevationPlane CSimulationEnvironmentAware::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const
{ {
if (!this->hasProvider()) { return CElevationPlane::null(); } if (!this->hasProvider()) { return CElevationPlane::null(); }

View File

@@ -216,6 +216,8 @@ namespace BlackMisc
//! Class which can be directly used to access an \sa ISimulationEnvironmentProvider object //! Class which can be directly used to access an \sa ISimulationEnvironmentProvider object
class BLACKMISC_EXPORT CSimulationEnvironmentAware : public IProviderAware<ISimulationEnvironmentProvider> class BLACKMISC_EXPORT CSimulationEnvironmentAware : public IProviderAware<ISimulationEnvironmentProvider>
{ {
virtual void anchor();
public: public:
//! Set the provider //! Set the provider
void setSimulationEnvironmentProvider(ISimulationEnvironmentProvider *provider) { this->setProvider(provider); } void setSimulationEnvironmentProvider(ISimulationEnvironmentProvider *provider) { this->setProvider(provider); }