JD2022-TU1/main/extern/dtest/dtcore/inc/dtconstant.h

182 lines
6.3 KiB
C++

#pragma once
#include "dtcore/inc/dtdefinitions.h"
#ifdef PI
#undef PI
#endif
namespace dt
{
static const int INVALID_ID = 0;
static const char INVALID_GUID[] = "00000000-0000-0000-0000-000000000000";
static const int INVALID_VALUE = -1;
static const float INVALID_VALUE_FLOAT = -1.f;
template<class T> class Constant
{
public:
static const T EPSILON;
static const T MAX;
static const T MIN;
static const T PI;
static const T TWO_PI;
static const T HALF_PI;
static const T INV_PI;
static const T INV_TWO_PI;
static const T DEG_TO_RAD;
static const T RAD_TO_DEG;
};
template<> class Constant<float>
{
public:
DT_CORE_DLL_ENTRY static const float EPSILON;
DT_CORE_DLL_ENTRY static const float MAX;
DT_CORE_DLL_ENTRY static const float MIN;
DT_CORE_DLL_ENTRY static const float PI;
DT_CORE_DLL_ENTRY static const float TWO_PI;
DT_CORE_DLL_ENTRY static const float HALF_PI;
DT_CORE_DLL_ENTRY static const float INV_PI;
DT_CORE_DLL_ENTRY static const float INV_TWO_PI;
DT_CORE_DLL_ENTRY static const float DEG_TO_RAD;
DT_CORE_DLL_ENTRY static const float RAD_TO_DEG;
};
template<> class Constant<double>
{
public:
DT_CORE_DLL_ENTRY static const double EPSILON;
DT_CORE_DLL_ENTRY static const double MAX;
DT_CORE_DLL_ENTRY static const double MIN;
DT_CORE_DLL_ENTRY static const double PI;
DT_CORE_DLL_ENTRY static const double TWO_PI;
DT_CORE_DLL_ENTRY static const double HALF_PI;
DT_CORE_DLL_ENTRY static const double INV_PI;
DT_CORE_DLL_ENTRY static const double INV_TWO_PI;
DT_CORE_DLL_ENTRY static const double DEG_TO_RAD;
DT_CORE_DLL_ENTRY static const double RAD_TO_DEG;
};
template<> class Constant<S8>
{
public:
DT_CORE_DLL_ENTRY static const S8 EPSILON;
DT_CORE_DLL_ENTRY static const S8 MAX;
DT_CORE_DLL_ENTRY static const S8 MIN;
DT_CORE_DLL_ENTRY static const S8 PI;
DT_CORE_DLL_ENTRY static const S8 TWO_PI;
DT_CORE_DLL_ENTRY static const S8 HALF_PI;
DT_CORE_DLL_ENTRY static const S8 INV_PI;
DT_CORE_DLL_ENTRY static const S8 INV_TWO_PI;
DT_CORE_DLL_ENTRY static const S8 DEG_TO_RAD;
DT_CORE_DLL_ENTRY static const S8 RAD_TO_DEG;
};
template<> class Constant<U8>
{
public:
DT_CORE_DLL_ENTRY static const U8 EPSILON;
DT_CORE_DLL_ENTRY static const U8 MAX;
DT_CORE_DLL_ENTRY static const U8 MIN;
DT_CORE_DLL_ENTRY static const U8 PI;
DT_CORE_DLL_ENTRY static const U8 TWO_PI;
DT_CORE_DLL_ENTRY static const U8 HALF_PI;
DT_CORE_DLL_ENTRY static const U8 INV_PI;
DT_CORE_DLL_ENTRY static const U8 INV_TWO_PI;
DT_CORE_DLL_ENTRY static const U8 DEG_TO_RAD;
DT_CORE_DLL_ENTRY static const U8 RAD_TO_DEG;
};
template<> class Constant<S16>
{
public:
DT_CORE_DLL_ENTRY static const S16 EPSILON;
DT_CORE_DLL_ENTRY static const S16 MAX;
DT_CORE_DLL_ENTRY static const S16 MIN;
DT_CORE_DLL_ENTRY static const S16 PI;
DT_CORE_DLL_ENTRY static const S16 TWO_PI;
DT_CORE_DLL_ENTRY static const S16 HALF_PI;
DT_CORE_DLL_ENTRY static const S16 INV_PI;
DT_CORE_DLL_ENTRY static const S16 INV_TWO_PI;
DT_CORE_DLL_ENTRY static const S16 DEG_TO_RAD;
DT_CORE_DLL_ENTRY static const S16 RAD_TO_DEG;
};
template<> class Constant<U16>
{
public:
DT_CORE_DLL_ENTRY static const U16 EPSILON;
DT_CORE_DLL_ENTRY static const U16 MAX;
DT_CORE_DLL_ENTRY static const U16 MIN;
DT_CORE_DLL_ENTRY static const U16 PI;
DT_CORE_DLL_ENTRY static const U16 TWO_PI;
DT_CORE_DLL_ENTRY static const U16 HALF_PI;
DT_CORE_DLL_ENTRY static const U16 INV_PI;
DT_CORE_DLL_ENTRY static const U16 INV_TWO_PI;
DT_CORE_DLL_ENTRY static const U16 DEG_TO_RAD;
DT_CORE_DLL_ENTRY static const U16 RAD_TO_DEG;
};
template<> class Constant<S32>
{
public:
DT_CORE_DLL_ENTRY static const S32 EPSILON;
DT_CORE_DLL_ENTRY static const S32 MAX;
DT_CORE_DLL_ENTRY static const S32 MIN;
DT_CORE_DLL_ENTRY static const S32 PI;
DT_CORE_DLL_ENTRY static const S32 TWO_PI;
DT_CORE_DLL_ENTRY static const S32 HALF_PI;
DT_CORE_DLL_ENTRY static const S32 INV_PI;
DT_CORE_DLL_ENTRY static const S32 INV_TWO_PI;
DT_CORE_DLL_ENTRY static const S32 DEG_TO_RAD;
DT_CORE_DLL_ENTRY static const S32 RAD_TO_DEG;
};
template<> class Constant<U32>
{
public:
DT_CORE_DLL_ENTRY static const U32 EPSILON;
DT_CORE_DLL_ENTRY static const U32 MAX;
DT_CORE_DLL_ENTRY static const U32 MIN;
DT_CORE_DLL_ENTRY static const U32 PI;
DT_CORE_DLL_ENTRY static const U32 TWO_PI;
DT_CORE_DLL_ENTRY static const U32 HALF_PI;
DT_CORE_DLL_ENTRY static const U32 INV_PI;
DT_CORE_DLL_ENTRY static const U32 INV_TWO_PI;
DT_CORE_DLL_ENTRY static const U32 DEG_TO_RAD;
DT_CORE_DLL_ENTRY static const U32 RAD_TO_DEG;
};
template<> class Constant<S64>
{
public:
DT_CORE_DLL_ENTRY static const S64 EPSILON;
DT_CORE_DLL_ENTRY static const S64 MAX;
DT_CORE_DLL_ENTRY static const S64 MIN;
DT_CORE_DLL_ENTRY static const S64 PI;
DT_CORE_DLL_ENTRY static const S64 TWO_PI;
DT_CORE_DLL_ENTRY static const S64 HALF_PI;
DT_CORE_DLL_ENTRY static const S64 INV_PI;
DT_CORE_DLL_ENTRY static const S64 INV_TWO_PI;
DT_CORE_DLL_ENTRY static const S64 DEG_TO_RAD;
DT_CORE_DLL_ENTRY static const S64 RAD_TO_DEG;
};
template<> class Constant<U64>
{
public:
DT_CORE_DLL_ENTRY static const U64 EPSILON;
DT_CORE_DLL_ENTRY static const U64 MAX;
DT_CORE_DLL_ENTRY static const U64 MIN;
DT_CORE_DLL_ENTRY static const U64 PI;
DT_CORE_DLL_ENTRY static const U64 TWO_PI;
DT_CORE_DLL_ENTRY static const U64 HALF_PI;
DT_CORE_DLL_ENTRY static const U64 INV_PI;
DT_CORE_DLL_ENTRY static const U64 INV_TWO_PI;
DT_CORE_DLL_ENTRY static const U64 DEG_TO_RAD;
DT_CORE_DLL_ENTRY static const U64 RAD_TO_DEG;
};
}