mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Explicit template instantiations for mixins for PQ and units
This commit is contained in:
@@ -36,6 +36,16 @@
|
||||
#include <limits>
|
||||
#include <cmath>
|
||||
|
||||
BLACK_DEFINE_PQ_MIXINS(CAngleUnit, CAngle)
|
||||
BLACK_DEFINE_PQ_MIXINS(CLengthUnit, CLength)
|
||||
BLACK_DEFINE_PQ_MIXINS(CPressureUnit, CPressure)
|
||||
BLACK_DEFINE_PQ_MIXINS(CFrequencyUnit, CFrequency)
|
||||
BLACK_DEFINE_PQ_MIXINS(CMassUnit, CMass)
|
||||
BLACK_DEFINE_PQ_MIXINS(CTemperatureUnit, CTemperature)
|
||||
BLACK_DEFINE_PQ_MIXINS(CSpeedUnit, CSpeed)
|
||||
BLACK_DEFINE_PQ_MIXINS(CTimeUnit, CTime)
|
||||
BLACK_DEFINE_PQ_MIXINS(CAccelerationUnit, CAcceleration)
|
||||
|
||||
namespace BlackMisc::PhysicalQuantities
|
||||
{
|
||||
template <class MU, class PQ>
|
||||
|
||||
@@ -28,6 +28,62 @@
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace BlackMisc::PhysicalQuantities
|
||||
{
|
||||
template <class MU, class PQ> class CPhysicalQuantity;
|
||||
}
|
||||
|
||||
//! \cond
|
||||
#define BLACK_TEMPLATE_PQ_MIXINS(MU, PQ, Extern, Export) \
|
||||
namespace BlackMisc::PhysicalQuantities { class PQ; } \
|
||||
namespace BlackMisc::Private \
|
||||
{ \
|
||||
Extern template struct Export CValueObjectMetaInfo<PhysicalQuantities::PQ>; \
|
||||
Extern template struct Export MetaTypeHelper<PhysicalQuantities::PQ>; \
|
||||
} \
|
||||
namespace BlackMisc::Mixin \
|
||||
{ \
|
||||
Extern template class Export DBusOperators<PhysicalQuantities::CPhysicalQuantity<PhysicalQuantities::MU, PhysicalQuantities::PQ>>; \
|
||||
Extern template class Export DataStreamOperators<PhysicalQuantities::CPhysicalQuantity<PhysicalQuantities::MU, PhysicalQuantities::PQ>>;\
|
||||
Extern template class Export JsonOperators<PhysicalQuantities::CPhysicalQuantity<PhysicalQuantities::MU, PhysicalQuantities::PQ>>; \
|
||||
Extern template class Export Index<PhysicalQuantities::PQ>; \
|
||||
Extern template class Export MetaType<PhysicalQuantities::PQ>; \
|
||||
Extern template class Export String<PhysicalQuantities::PQ>; \
|
||||
Extern template class Export Icon<PhysicalQuantities::CPhysicalQuantity<PhysicalQuantities::MU, PhysicalQuantities::PQ>>; \
|
||||
}
|
||||
//! \endcond
|
||||
|
||||
/*!
|
||||
* \def BLACK_DECLARE_PQ_MIXINS
|
||||
* Explicit template declaration of mixins for a CPhysicalQuantity subclass
|
||||
* to be placed near the top of the header that defines the class
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \def BLACK_DEFINE_PQ_MIXINS
|
||||
* Explicit template definition of mixins for a CPhysicalQuantity subclass
|
||||
*/
|
||||
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||
# define BLACK_DECLARE_PQ_MIXINS(MU, PQ)
|
||||
# define BLACK_DEFINE_PQ_MIXINS(MU, PQ)
|
||||
#elif defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
||||
# define BLACK_DECLARE_PQ_MIXINS(MU, PQ) BLACK_TEMPLATE_PQ_MIXINS(MU, PQ, extern, )
|
||||
# define BLACK_DEFINE_PQ_MIXINS(MU, PQ) BLACK_TEMPLATE_PQ_MIXINS(MU, PQ, , BLACKMISC_EXPORT)
|
||||
#else
|
||||
# define BLACK_DECLARE_PQ_MIXINS(MU, PQ) BLACK_TEMPLATE_PQ_MIXINS(MU, PQ, extern, )
|
||||
# define BLACK_DEFINE_PQ_MIXINS(MU, PQ) BLACK_TEMPLATE_PQ_MIXINS(MU, PQ, , )
|
||||
#endif
|
||||
|
||||
BLACK_DECLARE_PQ_MIXINS(CAngleUnit, CAngle)
|
||||
BLACK_DECLARE_PQ_MIXINS(CLengthUnit, CLength)
|
||||
BLACK_DECLARE_PQ_MIXINS(CPressureUnit, CPressure)
|
||||
BLACK_DECLARE_PQ_MIXINS(CFrequencyUnit, CFrequency)
|
||||
BLACK_DECLARE_PQ_MIXINS(CMassUnit, CMass)
|
||||
BLACK_DECLARE_PQ_MIXINS(CTemperatureUnit, CTemperature)
|
||||
BLACK_DECLARE_PQ_MIXINS(CSpeedUnit, CSpeed)
|
||||
BLACK_DECLARE_PQ_MIXINS(CTimeUnit, CTime)
|
||||
BLACK_DECLARE_PQ_MIXINS(CAccelerationUnit, CAcceleration)
|
||||
|
||||
namespace BlackMisc::PhysicalQuantities
|
||||
{
|
||||
class CAngle;
|
||||
@@ -38,7 +94,6 @@ namespace BlackMisc::PhysicalQuantities
|
||||
class CTemperature;
|
||||
class CSpeed;
|
||||
class CTime;
|
||||
class CPressure;
|
||||
class CAcceleration;
|
||||
|
||||
/*!
|
||||
|
||||
@@ -11,6 +11,16 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
BLACK_DEFINE_UNIT_MIXINS(CAngleUnit)
|
||||
BLACK_DEFINE_UNIT_MIXINS(CLengthUnit)
|
||||
BLACK_DEFINE_UNIT_MIXINS(CPressureUnit)
|
||||
BLACK_DEFINE_UNIT_MIXINS(CFrequencyUnit)
|
||||
BLACK_DEFINE_UNIT_MIXINS(CMassUnit)
|
||||
BLACK_DEFINE_UNIT_MIXINS(CTemperatureUnit)
|
||||
BLACK_DEFINE_UNIT_MIXINS(CSpeedUnit)
|
||||
BLACK_DEFINE_UNIT_MIXINS(CTimeUnit)
|
||||
BLACK_DEFINE_UNIT_MIXINS(CAccelerationUnit)
|
||||
|
||||
namespace BlackMisc::PhysicalQuantities
|
||||
{
|
||||
using BlackMisc::Math::CMathUtils;
|
||||
|
||||
@@ -29,6 +29,54 @@
|
||||
#include <QtMath>
|
||||
#include <cstddef>
|
||||
|
||||
//! \cond
|
||||
#define BLACK_TEMPLATE_UNIT_MIXINS(MU, Extern, Export) \
|
||||
namespace BlackMisc::PhysicalQuantities { class MU; } \
|
||||
namespace BlackMisc::Private \
|
||||
{ \
|
||||
Extern template struct Export CValueObjectMetaInfo<PhysicalQuantities::MU>; \
|
||||
Extern template struct Export MetaTypeHelper<PhysicalQuantities::MU>; \
|
||||
} \
|
||||
namespace BlackMisc::Mixin \
|
||||
{ \
|
||||
Extern template class Export MetaType<PhysicalQuantities::MU>; \
|
||||
Extern template class Export DBusOperators<PhysicalQuantities::MU>; \
|
||||
Extern template class Export DataStreamOperators<PhysicalQuantities::MU>; \
|
||||
Extern template class Export Index<PhysicalQuantities::MU>; \
|
||||
}
|
||||
//! \endcond
|
||||
|
||||
/*!
|
||||
* \def BLACK_DECLARE_UNIT_MIXINS
|
||||
* Explicit template declaration of mixins for a CMeasurementUnit subclass
|
||||
* to be placed near the top of the header that defines the class
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \def BLACK_DEFINE_UNIT_MIXINS
|
||||
* Explicit template definition of mixins for a CMeasurementUnit subclass
|
||||
*/
|
||||
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||
# define BLACK_DECLARE_UNIT_MIXINS(MU)
|
||||
# define BLACK_DEFINE_UNIT_MIXINS(MU)
|
||||
#elif defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
||||
# define BLACK_DECLARE_UNIT_MIXINS(MU) BLACK_TEMPLATE_UNIT_MIXINS(MU, extern, )
|
||||
# define BLACK_DEFINE_UNIT_MIXINS(MU) BLACK_TEMPLATE_UNIT_MIXINS(MU, , BLACKMISC_EXPORT)
|
||||
#else
|
||||
# define BLACK_DECLARE_UNIT_MIXINS(MU) BLACK_TEMPLATE_UNIT_MIXINS(MU, extern, )
|
||||
# define BLACK_DEFINE_UNIT_MIXINS(MU) BLACK_TEMPLATE_UNIT_MIXINS(MU, , )
|
||||
#endif
|
||||
|
||||
BLACK_DECLARE_UNIT_MIXINS(CAngleUnit)
|
||||
BLACK_DECLARE_UNIT_MIXINS(CLengthUnit)
|
||||
BLACK_DECLARE_UNIT_MIXINS(CPressureUnit)
|
||||
BLACK_DECLARE_UNIT_MIXINS(CFrequencyUnit)
|
||||
BLACK_DECLARE_UNIT_MIXINS(CMassUnit)
|
||||
BLACK_DECLARE_UNIT_MIXINS(CTemperatureUnit)
|
||||
BLACK_DECLARE_UNIT_MIXINS(CSpeedUnit)
|
||||
BLACK_DECLARE_UNIT_MIXINS(CTimeUnit)
|
||||
BLACK_DECLARE_UNIT_MIXINS(CAccelerationUnit)
|
||||
|
||||
//
|
||||
// Used with the template for quantities. This is the reason for
|
||||
// having all units in one file, since template requires concrete instantiations
|
||||
|
||||
Reference in New Issue
Block a user