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