itom 2.2.1
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2016, Institut fuer Technische Optik (ITO), 00005 Universitaet Stuttgart, Germany 00006 00007 This file is part of itom and its software development toolkit (SDK). 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 In addition, as a special exception, the Institut fuer Technische 00015 Optik (ITO) gives you certain additional rights. 00016 These rights are described in the ITO LGPL Exception version 1.0, 00017 which can be found in the file LGPL_EXCEPTION.txt in this package. 00018 00019 itom is distributed in the hope that it will be useful, but 00020 WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00022 General Public Licence for more details. 00023 00024 You should have received a copy of the GNU Library General Public License 00025 along with itom. If not, see <http://www.gnu.org/licenses/>. 00026 *********************************************************************** */ 00027 00028 #ifndef TYPEDEFS_H 00029 #define TYPEDEFS_H 00030 00031 #include <stdint.h> 00032 #include <complex> 00033 #include <exception> // std::exception 00034 #include <string.h> 00035 #include <stdexcept> 00036 #ifndef WIN32 00037 #include <unistd.h> // neede for usleep 00038 #endif 00039 00040 #ifdef _MSC_VER 00041 #if (_MSC_VER >= 1800) 00042 #include <algorithm> 00043 #endif 00044 #endif 00045 00046 // WARNING it is very EVIL to include ANY QT STUFF here!!! 00047 00048 namespace ito 00049 { 00050 #define PLUGINWAIT 5000 00051 00056 enum tRetValue 00057 { 00058 retOk = 0x0, 00059 retWarning = 0x1, 00060 retError = 0x2 00061 }; 00062 00066 enum tCompareResult 00067 { 00068 tCmpEqual, 00069 tCmpCompatible, 00070 tCmpFailed 00071 }; 00072 00077 enum tDataType 00078 { 00079 tInt8 = 0, 00080 tUInt8 = 1, 00081 tInt16 = 2, 00082 tUInt16 = 3, 00083 tInt32 = 4, 00084 tUInt32 = 5, 00085 tFloat32 = 6, 00086 tFloat64 = 7, 00087 tComplex64 = 8, 00088 tComplex128 = 9, 00089 tRGBA32 = 10 00090 }; 00091 00096 enum tPCLPointType 00097 { 00098 pclInvalid = 0x0000, 00099 pclXYZ = 0x0001, 00100 pclXYZI = 0x0002, 00101 pclXYZRGBA = 0x0004, 00102 pclXYZNormal = 0x0008, 00103 pclXYZINormal = 0x0010, 00104 pclXYZRGBNormal = 0x0020 00105 }; 00106 00107 // data types for images should always be the same size 00108 // so define them to fixed byte sizes here 00109 00110 00111 /*< \todo #define bool bool */ 00112 typedef int8_t int8; 00113 typedef int16_t int16; 00114 typedef int32_t int32; 00115 00116 #ifdef _WIN64 00117 //typedef int64_t int64; 00118 //typedef uint64_t uint64; 00119 #endif 00120 00121 //#define int int32 //commented by M. Gronle, 10.10.2011, since this caused problems while compiling with gcc and qtCreator 00122 //#define uint uint32 // impossible to define this, as in qglobal uint is also defined which causes problems 00123 00124 typedef uint8_t uint8; 00125 typedef uint16_t uint16; 00126 typedef uint32_t uint32; 00127 00128 typedef float float32; 00129 typedef double float64; 00130 00131 typedef std::complex<ito::float32> complex64; 00132 typedef std::complex<ito::float64> complex128; 00133 00134 class RgbaBase32 00135 { 00136 public: 00137 union 00138 { 00139 struct 00140 { 00141 ito::uint8 b; 00142 ito::uint8 g; 00143 ito::uint8 r; 00144 ito::uint8 a; 00145 }; 00146 ito::uint8 items[4]; 00147 ito::uint32 rgba; 00148 }; 00149 }; 00150 00151 00152 #ifdef __GNUC__ 00153 #define DEPRECATED __attribute__((deprecated)) 00154 #elif defined(_MSC_VER) 00155 #define DEPRECATED __declspec(deprecated) 00156 #else 00157 #pragma message("WARNING: You need to implement DEPRECATED for this compiler") 00158 #define DEPRECATED 00159 #endif 00160 00161 00162 #ifndef WIN32 00163 #define _strdup strdup 00164 #define _itoa itoa 00165 #define _snprintf snprintf 00166 #define Sleep(TIME) usleep(TIME*1000.0) 00167 #endif 00168 00169 // this will be set on Visual Studio only, so this code is added for all other compilers 00170 #ifndef _MSC_VER 00171 //for the ##__VA_ARGS__ trick see http://stackoverflow.com/questions/5588855/standard-alternative-to-gccs-va-args-trick 00172 #define vsprintf_s(b,l,f,...) vsprintf(b,f,##__VA_ARGS__); 00173 #define sprintf_s(b,l,f,...) sprintf(b,f,##__VA_ARGS__); 00174 #define strcat_s(dest,len,source) strcat(dest,source); 00175 #define strcpy_s(dest,len,source) strcpy(dest,source); 00176 #endif 00177 00178 } // namespace ito 00179 00180 #endif