00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef VRS_CONFIG_H
00019 #define VRS_CONFIG_H
00020
00021
00022
00023
00024 #define VRS_VERSION 0x040000
00025 #define VRS_MAJOR_VERSION 4
00026 #define VRS_MINOR_VERSION 0
00027 #define VRS_PATCH_VERSION 0
00028
00029
00030
00031
00032
00033
00034 #if defined(WIN32) || defined(WIN64)
00035
00036 #define VRS_HAS_WSTRING
00037
00041
00042
00043 #ifdef VRS_CORE_EXPORTS
00044 # define VRS_CORE_API __declspec(dllexport)
00045 #else // VRS_CORE_EXPORTS
00046 # define VRS_CORE_API __declspec(dllimport)
00047 #endif // VRS_CORE_EXPORTS
00048
00052
00053
00054 #ifndef VRS_CORE_EXPORTS
00055 # ifdef NDEBUG
00056 # pragma comment(lib, "vrs_core.lib")
00057 # else // NDEBUG
00058 # pragma comment(lib, "vrs_core_debug.lib")
00059 # endif //NDEBUG
00060 #endif // VRS_CORE_EXPORTS
00061
00065
00066 #ifdef _MSC_VER // microsoft visual studio compiler
00067
00068 # pragma warning(disable: 4251) // class X needs to have dll-interface to be used by clients of class Y
00069 # pragma warning(disable: 4275) // non dll-interface class X used as base for dll-interface class Y
00070 # pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
00071 # pragma warning(disable: 4786) // identifier was truncated to X characters in the debug information
00072 # pragma warning(disable: 4800) // forcing value to bool 'true' or 'false' (performance warning)
00073 # pragma warning(disable: 4996) // function call with parameters that may be unsafe
00074
00075 #endif //_MSC_VER
00076
00077 #endif // WIN32 || WIN64
00078
00079
00080
00081
00082 #ifndef WIN32
00083 # define VRS_CORE_API
00084 # define VRS_HAS_WSTRING
00085 # include <vrs/autoconf.h>
00086 # include <cstring>
00087 #endif // WIN32
00088
00089
00090
00091
00092
00093 #ifndef VRS_WORDS_BIGENDIAN
00094 # define VRS_HAS_LITTLE_ENDIAN 1
00095 #else // VRS_WORDS_BIGENDIAN
00096 # define VRS_HAS_BIG_ENDIAN 1
00097 #endif // VRS_WORDS_BIGENDIAN
00098
00099
00100 #ifndef M_PI
00101 # define M_PI 3.14159265358979323846
00102 #endif // M_PI
00103
00104 #include <iostream>
00105 #include <string>
00106
00107
00108
00109
00110
00111
00112
00113 #define VRS_CONCATENATE_DIRECT(STR_A, STR_B) STR_A##STR_B
00114 #define VRS_CONCATENATE(STR_A, STR_B) VRS_CONCATENATE_DIRECT(STR_A, STR_B)
00115 #ifdef _MSC_VER // Necessary for edit & continue in MS Visual C++.
00116 # define VRS_ANONYMOUS_IDENTIFIER(str) VRS_CONCATENATE(str, __COUNTER__)
00117 #else // _MSC_VER
00118 # define VRS_ANONYMOUS_IDENTIFIER(str) VRS_CONCATENATE(str, __LINE__)
00119 #endif // _MSC_VER
00120
00121
00122
00123
00124
00125 #define QT_TR_NOOP(x) (x)
00126 #define QT_TRANSLATE_NOOP(scope,x) (x)
00127
00128
00129 namespace VRS {
00130
00131
00132
00133
00134 const double INF = 1e42;
00135 const double deg2rad = (M_PI / 180.0);
00136 const double rad2deg = (180.0 / M_PI);
00137
00138
00139
00140
00141 const unsigned int Version = VRS_VERSION;
00142 const unsigned int MinorVersion = VRS_MINOR_VERSION;
00143 const unsigned int MajorVersion = VRS_MAJOR_VERSION;
00144 const unsigned int PatchVersion = VRS_PATCH_VERSION;
00145
00146 typedef unsigned char UCHAR;
00147 typedef unsigned short USHORT;
00148 typedef unsigned int UINT;
00149 typedef unsigned long ULONG;
00150
00151 typedef unsigned char UINT8;
00152 typedef char INT8;
00153 typedef unsigned short UINT16;
00154 typedef short INT16;
00155
00156 typedef unsigned int UINT32;
00157 typedef int INT32;
00158
00159 #ifdef WIN32
00160
00161 # ifndef VRS_HAS_INT64
00162 # define VRS_HAS_INT64
00163 # endif // VRS_HAS_INT64
00164
00165 typedef unsigned __int64 UINT64;
00166 typedef __int64 INT64;
00167
00168 #else // WIN32
00169
00170
00171 # ifndef VRS_HAS_INT64
00172 # define VRS_HAS_INT64
00173 # endif // VRS_HAS_INT64
00174
00175
00176 #ifdef __LP64__
00177 typedef unsigned long int UINT64;
00178 typedef long int INT64;
00179 #else
00180 typedef unsigned long long int UINT64;
00181 typedef long long int INT64;
00182 #endif
00183
00184 #endif // WIN32
00185
00186
00187 const union {
00188 USHORT dummy;
00189 struct { UCHAR LITTLE, BIG; } IS;
00190 } ENDIAN = { 1 };
00191
00192
00193 template<bool x> struct STATIC_ASSERTION_FAILURE;
00194 template<> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
00195 template<int x> struct static_assert_test { };
00196 #define VRS_STATIC_ASSERT(B) \
00197 typedef VRS::static_assert_test<\
00198 sizeof(VRS::STATIC_ASSERTION_FAILURE<(bool)(B)>)\
00199 > VRS_ANONYMOUS_IDENTIFIER(vrs_static_assert_typedef_)
00200
00201 }
00202
00203
00204
00205 #include <vrs/memoryleakdetector.h>
00206
00207 #if !defined(NDEBUG) && defined(WIN32) && !defined(VRS_NO_MEM_LEAK_DETECTOR)
00208
00209
00210 inline void* operator new (size_t size) { return VRS::MemoryLeakDetector::alloc(size); }
00211 inline void* operator new[] (size_t size) { return VRS::MemoryLeakDetector::alloc(size); }
00212 inline void operator delete (void* pointer) { VRS::MemoryLeakDetector::dealloc(pointer); }
00213 inline void operator delete[](void* pointer) { VRS::MemoryLeakDetector::dealloc(pointer); }
00214
00215 #endif // !NDEBUG && WIN32 && !VRS_NO_MEM_LEAK_DETECTOR
00216
00217 #include <vrs/errorhandler.h>
00218
00219
00220 #define VRS_S2W(str) VRS::StringUtils::String2WString(str)
00221 #define VRS_W2S(str) VRS::StringUtils::WString2String(str)
00222
00223 #endif // VRS_CONFIG_H