itom 2.0.0
D:/git-itom/sources/itom/common/typeDefs.h
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 #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 tLogLevel
00057     {
00058         logNone     = 0x0,
00059         logError    = 0x1,
00060         logWarning  = 0x2,
00061         logInfo     = 0x4,
00062         logAll      = logInfo | logWarning | logError
00063     };
00064 
00065 
00070     enum tRetValue
00071     {
00072         retOk       = 0x0,  
00073         retWarning  = 0x1,  
00074         retError    = 0x2   
00075     };
00076 
00081     enum tMsgType
00082     { 
00083         msgReturnInfo, 
00084         msgReturnWarning, 
00085         msgReturnError, 
00086         msgTextInfo,
00087         msgTextWarning, 
00088         msgTextError
00089     };
00090 
00091     enum tPythonDbgCmd
00092     { 
00093         pyDbgNone=0, 
00094         pyDbgContinue=1, 
00095         pyDbgStep=2, 
00096         pyDbgStepOut=4, 
00097         pyDbgStepOver=8,
00098         pyDbgQuit=16
00099     };
00100 
00101     enum tPythonTransitions
00102     {
00103         pyTransBeginRun = 1,
00104         pyTransEndRun = 2,
00105         pyTransBeginDebug = 4,
00106         pyTransEndDebug = 8,
00107         pyTransDebugWaiting = 16,
00108         pyTransDebugContinue = 32,
00109         pyTransDebugExecCmdBegin = 64,
00110         pyTransDebugExecCmdEnd = 128
00111     };
00112 
00113     enum tCompareResult 
00114     { 
00115         tCmpEqual, 
00116         tCmpCompatible, 
00117         tCmpFailed 
00118     };
00119 
00120     enum tPythonState
00121     {
00122         pyStateIdle = 1,
00123         pyStateRunning = 2,
00124         pyStateDebugging = 4,
00125         pyStateDebuggingWaiting = 8,
00126         pyStateDebuggingWaitingButBusy = 16
00127     };
00128 
00133     enum tDataType
00134     {
00135         tInt8 = 0,       
00136         tUInt8 = 1,      
00137         tInt16 = 2,      
00138         tUInt16 = 3,     
00139         tInt32 = 4,      
00140         tUInt32 = 5,     
00141         tFloat32 = 6,    
00142         tFloat64 = 7,    
00143         tComplex64 = 8,  
00144         tComplex128 = 9, 
00145         tRGBA32 = 10     
00146     };
00147 
00152     enum tPCLPointType
00153     {
00154         pclInvalid      = 0x0000, 
00155         pclXYZ          = 0x0001, 
00156         pclXYZI         = 0x0002, 
00157         pclXYZRGBA      = 0x0004, 
00158         pclXYZNormal    = 0x0008, 
00159         pclXYZINormal   = 0x0010, 
00160         pclXYZRGBNormal = 0x0020  
00161     };  
00162 
00163     // data types for images should always be the same size
00164     // so define them to fixed byte sizes here
00165 
00166    // data types for images should always be the same size
00167     // so define them to fixed byte sizes here
00168 
00169 
00170     /*< \todo #define bool bool */
00171     typedef int8_t  int8;
00172     typedef int16_t int16;
00173     typedef int32_t int32;
00174 
00175 #ifdef _WIN64
00176     //typedef int64_t int64;
00177     //typedef uint64_t uint64;
00178 #endif
00179 
00180     //#define int int32 //commented by M. Gronle, 10.10.2011, since this caused problems while compiling with gcc and qtCreator
00181     //#define uint uint32   // impossible to define this, as in qglobal uint is also defined which causes problems
00182 
00183     typedef uint8_t uint8;
00184     typedef uint16_t uint16;
00185     typedef uint32_t uint32;
00186 
00187     typedef float float32;
00188     typedef double float64;
00189 
00190     typedef std::complex<ito::float32> complex64;
00191     typedef std::complex<ito::float64> complex128;
00192 
00193     class RgbaBase32
00194     {
00195     public:
00196         union
00197         {
00198             struct
00199             {
00200                 ito::uint8 b;
00201                 ito::uint8 g;
00202                 ito::uint8 r;
00203                 ito::uint8 a;
00204             };
00205             ito::uint8  items[4];
00206             ito::uint32 rgba;
00207         };
00208     };
00209 
00210     #define GLOBAL_LOG_LEVEL tLogLevel(logAll)
00211 
00212 #ifndef WIN32
00213     #define _strdup strdup
00214     #define _itoa itoa
00215     #define _snprintf snprintf
00216     #define Sleep(TIME) usleep(TIME*1000.0)
00217 #endif
00218 
00219 // this will be set on Visual Studio only, so this code is added for all other compilers
00220 #ifndef _MSC_VER
00221     //for the ##__VA_ARGS__ trick see http://stackoverflow.com/questions/5588855/standard-alternative-to-gccs-va-args-trick
00222     #define vsprintf_s(b,l,f,...) vsprintf(b,f,##__VA_ARGS__);
00223     #define sprintf_s(b,l,f,...) sprintf(b,f,##__VA_ARGS__);
00224     #define strcat_s(dest,len,source) strcat(dest,source);
00225     #define strcpy_s(dest,len,source) strcpy(dest,source);
00226 #endif
00227 
00228 } // namespace ito
00229 
00230 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends