00001 /**************************************************************************************** 00002 00003 Copyright (C) 2013 Autodesk, Inc. 00004 All rights reserved. 00005 00006 Use of this software is subject to the terms of the Autodesk license agreement 00007 provided at the time of installation or download, or which otherwise accompanies 00008 this software in either electronic or hard copy form. 00009 00010 ****************************************************************************************/ 00011 00019 #ifndef _FBXSDK_CORE_ARCH_TYPES_H_ 00020 #define _FBXSDK_CORE_ARCH_TYPES_H_ 00021 00022 #include <fbxsdk/core/arch/fbxarch.h> 00023 00024 //Note: On MacOSX and Linux 64-bit, long is defined as 64-bits while on Windows 00025 //it is still a 32-bits for backward compatibility. We stick with Windows standard. 00026 #if defined(FBXSDK_CPU_64) && !defined(FBXSDK_ENV_WIN) 00027 #define FBXSDK_SYSTEM_IS_LP64 1 00028 #endif 00029 00030 #include <fbxsdk/fbxsdk_nsbegin.h> 00031 00032 class FbxObject; 00033 00034 typedef bool FbxBool; 00035 typedef signed char FbxChar; 00036 typedef unsigned char FbxUChar; 00037 typedef signed short FbxShort; 00038 typedef unsigned short FbxUShort; 00039 typedef signed int FbxInt; 00040 typedef unsigned int FbxUInt; 00041 typedef float FbxFloat; 00042 typedef double FbxDouble; 00043 00044 typedef FbxBool* FbxBoolPtr; 00045 typedef FbxChar* FbxCharPtr; 00046 typedef FbxUChar* FbxUCharPtr; 00047 typedef FbxShort* FbxShortPtr; 00048 typedef FbxUShort* FbxUShortPtr; 00049 typedef FbxInt* FbxIntPtr; 00050 typedef FbxUInt* FbxUIntPtr; 00051 typedef FbxFloat* FbxFloatPtr; 00052 typedef FbxDouble* FbxDoublePtr; 00053 00054 typedef FbxInt FbxEnum; 00055 typedef FbxObject* FbxReference; 00056 00057 //------------------------------------------------------------------------------------- 00058 //Architecture independent defines (guarantee size) 00059 #if defined(FBXSDK_COMPILER_MSC) 00060 #define FBXSDK_LONGLONG(x) (x##i64) 00061 #define FBXSDK_ULONGLONG(x) (x##Ui64) 00062 00063 typedef signed __int8 FbxInt8; 00064 typedef unsigned __int8 FbxUInt8; 00065 typedef signed __int16 FbxInt16; 00066 typedef unsigned __int16 FbxUInt16; 00067 typedef signed __int32 FbxInt32; 00068 typedef unsigned __int32 FbxUInt32; 00069 typedef signed __int64 FbxInt64; 00070 typedef unsigned __int64 FbxUInt64; 00071 #else 00072 #define FBXSDK_LONGLONG(x) (x##LL) 00073 #define FBXSDK_ULONGLONG(x) (x##ULL) 00074 00075 typedef signed char FbxInt8; 00076 typedef unsigned char FbxUInt8; 00077 typedef signed short FbxInt16; 00078 typedef unsigned short FbxUInt16; 00079 typedef signed int FbxInt32; 00080 typedef unsigned int FbxUInt32; 00081 typedef signed long long FbxInt64; 00082 typedef unsigned long long FbxUInt64; 00083 #endif 00084 00085 #ifdef FBXSDK_SYSTEM_IS_LP64 00086 typedef signed int FbxLong; 00087 typedef unsigned int FbxULong; 00088 #else 00089 typedef signed long FbxLong; 00090 typedef unsigned long FbxULong; 00091 #endif 00092 typedef FbxInt64 FbxLongLong; 00093 typedef FbxUInt64 FbxULongLong; 00094 00095 typedef FbxLong* FbxLongPtr; 00096 typedef FbxULong* FbxULongPtr; 00097 typedef FbxLongLong* FbxLongLongPtr; 00098 typedef FbxULongLong* FbxULongLongPtr; 00099 00100 //------------------------------------------------------------------------------------- 00101 //Minimum and Maximum values for types 00102 #define FBXSDK_CHAR_MIN -128 00103 #define FBXSDK_CHAR_MAX 127 00104 #define FBXSDK_UCHAR_MIN 0 00105 #define FBXSDK_UCHAR_MAX 255 00106 #define FBXSDK_SHORT_MIN -32768 00107 #define FBXSDK_SHORT_MAX 32767 00108 #define FBXSDK_USHORT_MIN 0 00109 #define FBXSDK_USHORT_MAX 65535 00110 #define FBXSDK_INT_MIN 0x80000000 00111 #define FBXSDK_INT_MAX 0x7fffffff 00112 #define FBXSDK_UINT_MIN 0 00113 #define FBXSDK_UINT_MAX 0xffffffff 00114 #define FBXSDK_LONG_MIN FBXSDK_INT_MIN 00115 #define FBXSDK_LONG_MAX FBXSDK_INT_MAX 00116 #define FBXSDK_ULONG_MIN FBXSDK_UINT_MIN 00117 #define FBXSDK_ULONG_MAX FBXSDK_UINT_MAX 00118 #define FBXSDK_LONGLONG_MIN FBXSDK_LONGLONG(0x8000000000000000) 00119 #define FBXSDK_LONGLONG_MAX FBXSDK_LONGLONG(0x7fffffffffffffff) 00120 #define FBXSDK_ULONGLONG_MIN FBXSDK_ULONGLONG(0) 00121 #define FBXSDK_ULONGLONG_MAX FBXSDK_ULONGLONG(0xffffffffffffffff) 00122 #define FBXSDK_FLOAT_MIN FLT_MIN 00123 #define FBXSDK_FLOAT_MAX FLT_MAX 00124 #define FBXSDK_FLOAT_EPSILON FLT_EPSILON 00125 #define FBXSDK_DOUBLE_MIN DBL_MIN 00126 #define FBXSDK_DOUBLE_MAX DBL_MAX 00127 #define FBXSDK_DOUBLE_EPSILON DBL_EPSILON 00128 #define FBXSDK_TOLERANCE (1.0e-6) 00129 00130 //------------------------------------------------------------------------------------- 00131 //Handle and atomic definition (size change depending of architecture) 00132 #if defined(FBXSDK_CPU_32) 00133 typedef FbxUInt32 FbxHandle; 00134 #define FBXSDK_REF_MIN FBXSDK_UINT_MIN 00135 #define FBXSDK_REF_MAX FBXSDK_UINT_MAX 00136 00137 typedef FbxLong FbxAtomic; 00138 #define FBXSDK_ATOMIC_MIN FBXSDK_LONG_MIN 00139 #define FBXSDK_ATOMIC_MAX FBXSDK_LONG_MAX 00140 #elif defined(FBXSDK_CPU_64) 00141 typedef FbxUInt64 FbxHandle; 00142 #define FBXSDK_REF_MIN FBXSDK_ULONGLONG_MIN 00143 #define FBXSDK_REF_MAX FBXSDK_ULONGLONG_MAX 00144 00145 typedef FbxInt64 FbxAtomic; 00146 #define FBXSDK_ATOMIC_MIN FBXSDK_LONGLONG_MIN 00147 #define FBXSDK_ATOMIC_MAX FBXSDK_LONGLONG_MAX 00148 #else 00149 #error Unsupported architecture! 00150 #endif 00151 00152 //------------------------------------------------------------------------------------- 00153 //Various utility functions for fbxsdk basic types 00154 inline const FbxChar FbxMin(const FbxChar){ return FBXSDK_CHAR_MIN; } 00155 inline const FbxUChar FbxMin(const FbxUChar){ return FBXSDK_UCHAR_MIN; } 00156 inline const FbxShort FbxMin(const FbxShort){ return FBXSDK_SHORT_MIN; } 00157 inline const FbxUShort FbxMin(const FbxUShort){ return FBXSDK_USHORT_MIN; } 00158 inline const FbxInt FbxMin(const FbxInt){ return FBXSDK_INT_MIN; } 00159 inline const FbxUInt FbxMin(const FbxUInt){ return FBXSDK_UINT_MIN; } 00160 inline const FbxLongLong FbxMin(const FbxLongLong){ return FBXSDK_LONGLONG_MIN; } 00161 inline const FbxULongLong FbxMin(const FbxULongLong){ return FBXSDK_ULONGLONG_MIN; } 00162 inline const FbxFloat FbxMin(const FbxFloat){ return FBXSDK_FLOAT_MIN; } 00163 inline const FbxDouble FbxMin(const FbxDouble){ return FBXSDK_DOUBLE_MIN; } 00164 00165 inline const FbxChar FbxMax(const FbxChar){ return FBXSDK_CHAR_MAX; } 00166 inline const FbxUChar FbxMax(const FbxUChar){ return FBXSDK_UCHAR_MAX; } 00167 inline const FbxShort FbxMax(const FbxShort){ return FBXSDK_SHORT_MAX; } 00168 inline const FbxUShort FbxMax(const FbxUShort){ return FBXSDK_USHORT_MAX; } 00169 inline const FbxInt FbxMax(const FbxInt){ return FBXSDK_INT_MAX; } 00170 inline const FbxUInt FbxMax(const FbxUInt){ return FBXSDK_UINT_MAX; } 00171 inline const FbxLongLong FbxMax(const FbxLongLong){ return FBXSDK_LONGLONG_MAX; } 00172 inline const FbxULongLong FbxMax(const FbxULongLong){ return FBXSDK_ULONGLONG_MAX; } 00173 inline const FbxFloat FbxMax(const FbxFloat){ return FBXSDK_FLOAT_MAX; } 00174 inline const FbxDouble FbxMax(const FbxDouble){ return FBXSDK_DOUBLE_MAX; } 00175 00176 #ifndef FBXSDK_SYSTEM_IS_LP64 00177 inline const FbxLong FbxMin(const FbxLong){ return FBXSDK_LONG_MIN; } 00178 inline const FbxULong FbxMin(const FbxULong){ return FBXSDK_ULONG_MIN; } 00179 inline const FbxLong FbxMax(const FbxLong){ return FBXSDK_LONG_MAX; } 00180 inline const FbxULong FbxMax(const FbxULong){ return FBXSDK_ULONG_MAX; } 00181 #endif 00182 00183 template<class T> inline const T FbxMin(const T){}; 00184 template<class T> inline const T FbxMax(const T){}; 00185 00186 template<class T> inline T FbxMin(const T x, const T y){ return (x < y) ? x : y; } 00187 template<class T> inline T FbxMax(const T x, const T y){ return (x > y) ? x : y; } 00188 00189 //------------------------------------------------------------------------------------- 00190 //Vector Template Types 00191 template<class T> class FBXSDK_DLL FbxVectorTemplate2 00192 { 00193 public: 00194 inline FbxVectorTemplate2(){ *this = T(0); } 00195 inline explicit FbxVectorTemplate2(T pValue){ *this = pValue; } 00196 inline FbxVectorTemplate2(T pData0, T pData1){ mData[0] = pData0; mData[1] = pData1; } 00197 inline ~FbxVectorTemplate2(){} 00198 inline T& operator[](int pIndex){ return mData[pIndex]; } 00199 inline const T& operator[](int pIndex) const { return mData[pIndex]; } 00200 inline FbxVectorTemplate2<T>& operator=(const T& pValue){ mData[0] = pValue; mData[1] = pValue; return *this; } 00201 inline FbxVectorTemplate2<T>& operator=(const FbxVectorTemplate2<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; return *this; } 00202 inline bool operator==(const FbxVectorTemplate2<T>& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1])); } 00203 inline bool operator!=(const FbxVectorTemplate2<T>& pVector) const { return !operator==( pVector ); } 00204 inline T* Buffer(){ return mData; } 00205 inline const T* Buffer() const { return mData; } 00206 T mData[2]; 00207 }; 00208 00209 template<class T> class FBXSDK_DLL FbxVectorTemplate3 00210 { 00211 public: 00212 inline FbxVectorTemplate3(){ *this = T(0); } 00213 inline explicit FbxVectorTemplate3(T pValue){ *this = pValue; } 00214 inline FbxVectorTemplate3(T pData0, T pData1, T pData2){ mData[0] = pData0; mData[1] = pData1; mData[2] = pData2; } 00215 inline ~FbxVectorTemplate3(){} 00216 inline T& operator[](int pIndex) { return mData[pIndex]; } 00217 inline const T& operator[](int pIndex) const { return mData[pIndex]; } 00218 inline operator FbxVectorTemplate2<T>& () const { return *((FbxVectorTemplate2<T>*)this); } 00219 inline FbxVectorTemplate3<T>& operator=(T const &pValue){ mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; return *this; } 00220 inline FbxVectorTemplate3<T>& operator=(const FbxVectorTemplate2<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; return *this; } 00221 inline FbxVectorTemplate3<T>& operator=(const FbxVectorTemplate3<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; mData[2] = pVector.mData[2]; return *this; } 00222 inline bool operator==(const FbxVectorTemplate3<T>& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1]) && (mData[2] == pVector.mData[2])); } 00223 inline bool operator!=(const FbxVectorTemplate3<T>& pVector) const { return !operator==(pVector); } 00224 inline T* Buffer(){ return mData; } 00225 inline const T* Buffer() const { return mData; } 00226 T mData[3]; 00227 }; 00228 00229 template<class T> class FBXSDK_DLL FbxVectorTemplate4 00230 { 00231 public: 00232 inline FbxVectorTemplate4(){ *this = T(0); } 00233 inline explicit FbxVectorTemplate4(T pValue){ *this = pValue; } 00234 inline FbxVectorTemplate4(T pData0, T pData1, T pData2, T pData3){ mData[0] = pData0; mData[1] = pData1; mData[2] = pData2; mData[3] = pData3; } 00235 inline ~FbxVectorTemplate4(){} 00236 inline T& operator[](int pIndex){ return mData[pIndex]; } 00237 inline const T& operator[](int pIndex) const { return mData[pIndex]; } 00238 inline operator FbxVectorTemplate3<T>& () const { return *((FbxVectorTemplate3<T>*)this); } 00239 inline FbxVectorTemplate4<T>& operator=(const T& pValue){ mData[0] = pValue; mData[1] = pValue; mData[2] = pValue; mData[3] = pValue; return *this; } 00240 inline FbxVectorTemplate4<T>& operator=(const FbxVectorTemplate3<T>& pValue){ mData[0] = pValue[0]; mData[1] = pValue[1]; mData[2] = pValue[2]; return *this; } 00241 inline FbxVectorTemplate4<T>& operator=(const FbxVectorTemplate4<T>& pVector){ mData[0] = pVector.mData[0]; mData[1] = pVector.mData[1]; mData[2] = pVector.mData[2]; mData[3] = pVector.mData[3]; return *this; } 00242 inline bool operator==(const FbxVectorTemplate4<T>& pVector) const { return ((mData[0] == pVector.mData[0]) && (mData[1] == pVector.mData[1]) && (mData[2] == pVector.mData[2]) && (mData[3] == pVector.mData[3])); } 00243 inline bool operator!=(const FbxVectorTemplate4<T>& pVector) const { return !operator==( pVector ); } 00244 inline T* Buffer(){ return mData; } 00245 inline const T* Buffer() const { return mData; } 00246 T mData[4]; 00247 }; 00248 00249 typedef FbxVectorTemplate2<FbxDouble> FbxDouble2; 00250 typedef FbxVectorTemplate3<FbxDouble> FbxDouble3; 00251 typedef FbxVectorTemplate4<FbxDouble> FbxDouble4; 00252 typedef FbxVectorTemplate4<FbxDouble4> FbxDouble4x4; 00253 00254 #include <fbxsdk/fbxsdk_nsend.h> 00255 00256 #endif /* _FBXSDK_CORE_ARCH_TYPES_H_ */