- Main Page
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# fbxtypes.h

Go to the documentation of this file.

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