itom 1.3.0
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2013, Institut für Technische Optik (ITO), 00005 Universität 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 für 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 #ifdef linux 00037 #include <unistd.h> // neede for usleep 00038 #endif 00039 00040 // WARNING it is very EVIL to include ANY QT STUFF here!!! 00041 00042 namespace ito 00043 { 00044 #define PLUGINWAIT 5000 00045 00050 enum tLogLevel 00051 { 00052 logNone = 0x0, 00053 logError = 0x1, 00054 logWarning = 0x2, 00055 logInfo = 0x4, 00056 logAll = logInfo | logWarning | logError 00057 }; 00058 00059 00064 enum tRetValue 00065 { 00066 retOk = 0x0, 00067 retWarning = 0x1, 00068 retError = 0x2 00069 }; 00070 00075 enum tMsgType 00076 { 00077 msgReturnInfo, 00078 msgReturnWarning, 00079 msgReturnError, 00080 msgTextInfo, 00081 msgTextWarning, 00082 msgTextError 00083 }; 00084 00085 enum tPythonDbgCmd 00086 { 00087 pyDbgNone=0, 00088 pyDbgContinue=1, 00089 pyDbgStep=2, 00090 pyDbgStepOut=4, 00091 pyDbgStepOver=8, 00092 pyDbgQuit=16 00093 }; 00094 00095 enum tPythonTransitions 00096 { 00097 pyTransBeginRun = 1, 00098 pyTransEndRun = 2, 00099 pyTransBeginDebug = 4, 00100 pyTransEndDebug = 8, 00101 pyTransDebugWaiting = 16, 00102 pyTransDebugContinue = 32, 00103 pyTransDebugExecCmdBegin = 64, 00104 pyTransDebugExecCmdEnd = 128 00105 }; 00106 00107 enum tCompareResult 00108 { 00109 tCmpEqual, 00110 tCmpCompatible, 00111 tCmpFailed 00112 }; 00113 00114 enum tPythonState 00115 { 00116 pyStateIdle = 1, 00117 pyStateRunning = 2, 00118 pyStateDebugging = 4, 00119 pyStateDebuggingWaiting = 8, 00120 pyStateDebuggingWaitingButBusy = 16 00121 }; 00122 00127 enum tDataType 00128 { 00129 tInt8 = 0, 00130 tUInt8 = 1, 00131 tInt16 = 2, 00132 tUInt16 = 3, 00133 tInt32 = 4, 00134 tUInt32 = 5, 00135 tFloat32 = 6, 00136 tFloat64 = 7, 00137 tComplex64 = 8, 00138 tComplex128 = 9, 00139 tRGBA32 = 10 00140 }; 00141 00146 enum tPCLPointType 00147 { 00148 pclInvalid = 0x0000, 00149 pclXYZ = 0x0001, 00150 pclXYZI = 0x0002, 00151 pclXYZRGBA = 0x0004, 00152 pclXYZNormal = 0x0008, 00153 pclXYZINormal = 0x0010, 00154 pclXYZRGBNormal = 0x0020 00155 }; 00156 00157 // data types for images should always be the same size 00158 // so define them to fixed byte sizes here 00159 00160 // data types for images should always be the same size 00161 // so define them to fixed byte sizes here 00162 00163 00164 /*< \todo #define bool bool */ 00165 typedef int8_t int8; 00166 typedef int16_t int16; 00167 typedef int32_t int32; 00168 00169 #ifdef _WIN64 00170 //typedef int64_t int64; 00171 //typedef uint64_t uint64; 00172 #endif 00173 00174 //#define int int32 //commented by M. Gronle, 10.10.2011, since this caused problems while compiling with gcc and qtCreator 00175 //#define uint uint32 // impossible to define this, as in qglobal uint is also defined which causes problems 00176 00177 typedef uint8_t uint8; 00178 typedef uint16_t uint16; 00179 typedef uint32_t uint32; 00180 00181 typedef float float32; 00182 typedef double float64; 00183 00184 typedef std::complex<ito::float32> complex64; 00185 typedef std::complex<ito::float64> complex128; 00186 00187 class RgbaBase32 00188 { 00189 public: 00190 union 00191 { 00192 struct 00193 { 00194 ito::uint8 b; 00195 ito::uint8 g; 00196 ito::uint8 r; 00197 ito::uint8 a; 00198 }; 00199 ito::uint8 items[4]; 00200 ito::uint32 rgba; 00201 }; 00202 }; 00203 00204 #define GLOBAL_LOG_LEVEL tLogLevel(logAll) 00205 00206 #ifdef linux 00207 #define _strdup strdup 00208 #define _itoa itoa 00209 #define _snprintf snprintf 00210 #define Sleep(TIME) usleep(TIME*1000.0) 00211 #endif 00212 00213 // this will be set on Visual Studio only, so this code is added for all other compilers 00214 #ifndef _MSC_VER 00215 #define vsprintf_s(b,l,f,v) vsprintf(b,f,v); 00216 #define sprintf_s(b,l,f,v) sprintf(b,f,v); 00217 #define strcat_s(dest,len,source) strcat(dest,source); 00218 #define strcpy_s(dest,len,source) strcpy(dest,source); 00219 #endif 00220 00221 00222 00223 } // namespace ito 00224 00225 #endif