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
{
public:
//! Set the corresponding component
virtual void setMappingComponent(CDbMappingComponent *component);
@@ -35,6 +37,9 @@ namespace BlackGui
//! Constructor
CDbMappingComponentAware(QObject *parent);
//! Destructor
virtual ~CDbMappingComponentAware() {}
private :
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
CEnableForDockWidgetInfoArea(CDockWidgetInfoArea *parentInfoArea = nullptr);
// Destructor
virtual ~CEnableForDockWidgetInfoArea() {}
private:
BlackGui::CDockWidgetInfoArea *m_parentDockableInfoArea = nullptr; //!< my parent dockable widget
BlackMisc::CConnectionGuard m_connections;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -132,6 +132,10 @@ namespace BlackMisc
return true;
}
// Pin the vtable to this file
void CClientAware::anchor()
{ }
CClientList CClientAware::getClients() const
{
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 BLACKMISC_EXPORT CClientAware : public IProviderAware<IClientProvider>
{
virtual void anchor();
public:
//! \copydoc CClientProvider::getClients
CClientList getClients() const;

View File

@@ -57,6 +57,10 @@ namespace BlackMisc
return true;
}
// pin vtable to this file
void CEcosystemAware::anchor()
{ }
CEcosystem CEcosystemAware::getCurrentEcosystem() const
{
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
class BLACKMISC_EXPORT CEcosystemAware : public IProviderAware<IEcosystemProvider>
{
virtual void anchor();
public:
//! Set the provider
void setEcosystemProvider(IEcosystemProvider *provider) { this->setProvider(provider); }

View File

@@ -18,6 +18,29 @@ namespace BlackMisc
{
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
{
if (digits < 0) digits = this->getDisplayDigits();

View File

@@ -56,6 +56,8 @@ namespace BlackMisc
struct StatuteMilesToMeters { static double factor() { return 1609.3472; } };
using MetersToMeters = One;
virtual void anchor();
public:
//! Base type
using base_type = CMeasurementUnit;
@@ -271,6 +273,8 @@ namespace BlackMisc
using HertzToHertz = One;
virtual void anchor();
public:
//! Base type
using base_type = CMeasurementUnit;
@@ -362,6 +366,8 @@ namespace BlackMisc
using GramsToKilograms = Milli<One>;
struct PoundsToKilograms { static double factor() { return 0.45359237; } };
virtual void anchor();
public:
//! Base type
using base_type = CMeasurementUnit;
@@ -464,6 +470,8 @@ namespace BlackMisc
struct InchesToHectopascals { static double factor() { return 33.86389; } };
struct MillimetersToHectopascals { static double factor() { return 860.142806; } };
virtual void anchor();
public:
//! Base type
using base_type = CMeasurementUnit;
@@ -589,6 +597,8 @@ namespace BlackMisc
static double offset() { return 32.0; }
};
virtual void anchor();
public:
//! Base type
using base_type = CMeasurementUnit;
@@ -673,6 +683,8 @@ namespace BlackMisc
struct FtPerSecToMps { static double factor() { return 0.3048 ; } };
struct FtPerMinToMps { static double factor() { return 0.3048 / 60.0; } };
virtual void anchor();
public:
//! Base type
using base_type = CMeasurementUnit;
@@ -918,6 +930,8 @@ namespace BlackMisc
struct FeetToMeters { static double factor() { return 0.3048; } };
virtual void anchor();
public:
//! Base type
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
{
//! Base class for providers
class IProvider
class BLACKMISC_EXPORT IProvider
{
public:
//! Dtor
virtual ~IProvider() {}
virtual ~IProvider();
//! Return as QObject
virtual QObject *asQObject() { return nullptr; }

View File

@@ -197,6 +197,10 @@ namespace BlackMisc
return m_setups;
}
// pin vtables to this file
void CInterpolationSetupAware::anchor()
{ }
CInterpolationAndRenderingSetupPerCallsign CInterpolationSetupAware::getInterpolationSetupPerCallsignOrDefault(const CCallsign &callsign) const
{
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 BLACKMISC_EXPORT CInterpolationSetupAware : public IProviderAware<IInterpolationSetupProvider>
{
virtual void anchor();
public:
//! \copydoc IInterpolationSetupProvider::getInterpolationSetupPerCallsignOrDefault
CInterpolationAndRenderingSetupPerCallsign getInterpolationSetupPerCallsignOrDefault(const Aviation::CCallsign &callsign) const;

View File

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

View File

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

View File

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

View File

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

View File

@@ -24,6 +24,10 @@ namespace BlackMisc
return changed1 || changed2;
}
// pin vtables to this file
void COwnAircraftAware::anchor()
{ }
CSimulatedAircraft COwnAircraftAware::getOwnAircraft() const
{
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
class BLACKMISC_EXPORT COwnAircraftAware : public IProviderAware<IOwnAircraftProvider>
{
virtual void anchor();
public:
//! Set the provider
void setOwnAircraftProvider(IOwnAircraftProvider *provider) { this->setProvider(provider); }

View File

@@ -24,6 +24,9 @@ namespace BlackMisc
{
namespace Simulation
{
IRemoteAircraftProvider::~IRemoteAircraftProvider()
{ }
const CLogCategoryList &CRemoteAircraftProvider::getLogCategories()
{
static const CLogCategoryList cats { CLogCategory::matching(), CLogCategory::network() };
@@ -756,6 +759,9 @@ namespace BlackMisc
return removedCallsign;
}
CRemoteAircraftAware::~CRemoteAircraftAware()
{ }
CSimulatedAircraftList CRemoteAircraftAware::getAircraftInRange() const
{
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
//! Destructor
virtual ~IRemoteAircraftProvider() {}
virtual ~IRemoteAircraftProvider();
//! All remote aircraft
//! \threadsafe
@@ -449,7 +449,7 @@ namespace BlackMisc
{
public:
//! Destructor
virtual ~CRemoteAircraftAware() {}
virtual ~CRemoteAircraftAware();
//! \copydoc IRemoteAircraftProvider::getAircraftInRange
CSimulatedAircraftList getAircraftInRange() const;

View File

@@ -344,6 +344,10 @@ namespace BlackMisc
this->resetSimulationEnvironmentStatistics();
}
// pin vtables to this file
void CSimulationEnvironmentAware::anchor()
{ }
CElevationPlane CSimulationEnvironmentAware::findClosestElevationWithinRange(const ICoordinateGeodetic &reference, const PhysicalQuantities::CLength &range) const
{
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 BLACKMISC_EXPORT CSimulationEnvironmentAware : public IProviderAware<ISimulationEnvironmentProvider>
{
virtual void anchor();
public:
//! Set the provider
void setSimulationEnvironmentProvider(ISimulationEnvironmentProvider *provider) { this->setProvider(provider); }