itom  4.1.0
typeDefs.h
1 /* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5 Universitaet Stuttgart, Germany
6 
7 This file is part of itom and its software development toolkit (SDK).
8 
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13 
14 In addition, as a special exception, the Institut fuer Technische
15 Optik (ITO) gives you certain additional rights.
16 These rights are described in the ITO LGPL Exception version 1.0,
17 which can be found in the file LGPL_EXCEPTION.txt in this package.
18 
19 itom is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22 General Public Licence for more details.
23 
24 You should have received a copy of the GNU Library General Public License
25 along with itom. If not, see <http://www.gnu.org/licenses/>.
26 *********************************************************************** */
27 
28 #ifndef TYPEDEFS_H
29 #define TYPEDEFS_H
30 
31 #include <stdint.h>
32 #include <complex>
33 #include <exception> // std::exception
34 #include <string.h>
35 #include <stdexcept>
36 #ifndef WIN32
37 #include <unistd.h> // neede for usleep
38 #endif
39 
40 #ifdef _MSC_VER
41 #if (_MSC_VER >= 1800)
42 #include <algorithm>
43 #endif
44 #endif
45 
46 // WARNING it is very EVIL to include ANY QT STUFF here!!!
47 
48 namespace ito
49 {
50 #define PLUGINWAIT 5000
51 
56  enum tRetValue
57  {
58  retOk = 0x0,
59  retWarning = 0x1,
60  retError = 0x2
61  };
62 
67  {
68  tCmpEqual,
69  tCmpCompatible,
70  tCmpFailed
71  };
72 
77  {
78  msgStreamOut = 1,
79  msgStreamErr = 2,
80  msgStreamIn = 3
81  };
82 
87  enum tDataType
88  {
89  tInt8 = 0,
90  tUInt8 = 1,
91  tInt16 = 2,
92  tUInt16 = 3,
93  tInt32 = 4,
94  tUInt32 = 5,
95  tFloat32 = 6,
96  tFloat64 = 7,
97  tComplex64 = 8,
99  tRGBA32 = 10
100  };
101 
107  {
108  pclInvalid = 0x0000,
109  pclXYZ = 0x0001,
110  pclXYZI = 0x0002,
111  pclXYZRGBA = 0x0004,
112  pclXYZNormal = 0x0008,
113  pclXYZINormal = 0x0010,
114  pclXYZRGBNormal = 0x0020
115  };
116 
117  // data types for images should always be the same size
118  // so define them to fixed byte sizes here
119 
120 
121  /*< \todo #define bool bool */
122  typedef int8_t int8;
123  typedef int16_t int16;
124  typedef int32_t int32;
125 
126 #ifdef _WIN64
127  //typedef int64_t int64;
128  //typedef uint64_t uint64;
129 #endif
130 
131  //#define int int32 //commented by M. Gronle, 10.10.2011, since this caused problems while compiling with gcc and qtCreator
132  //#define uint uint32 // impossible to define this, as in qglobal uint is also defined which causes problems
133 
134  typedef uint8_t uint8;
135  typedef uint16_t uint16;
136  typedef uint32_t uint32;
137 
138  typedef float float32;
139  typedef double float64;
140 
141  typedef std::complex<ito::float32> complex64;
142  typedef std::complex<ito::float64> complex128;
143 
145  {
146  public:
147  union
148  {
149  struct
150  {
151  ito::uint8 b;
152  ito::uint8 g;
153  ito::uint8 r;
154  ito::uint8 a;
155  };
156  ito::uint8 items[4];
157  ito::uint32 rgba;
158  };
159  };
160 
161 } // namespace ito
162 
163 #ifdef __GNUC__
164 #define DEPRECATED __attribute__((deprecated))
165 #elif defined(_MSC_VER)
166 #define DEPRECATED __declspec(deprecated)
167 #else
168 #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
169 #define DEPRECATED
170 #endif
171 
172 
173 #ifndef WIN32
174 #define _strdup strdup
175 #define _itoa itoa
176 #define _snprintf snprintf
177 #define Sleep(TIME) usleep(TIME*1000.0)
178 #endif
179 
180  // this will be set on Visual Studio only, so this code is added for all other compilers
181 #ifndef _MSC_VER
182  //for the ##__VA_ARGS__ trick see http://stackoverflow.com/questions/5588855/standard-alternative-to-gccs-va-args-trick
183 #define vsprintf_s(b,l,f,...) vsprintf(b,f,##__VA_ARGS__);
184 #define sprintf_s(b,l,f,...) sprintf(b,f,##__VA_ARGS__);
185 #define strcat_s(dest,len,source) strcat(dest,source);
186 #define strcpy_s(dest,len,source) strcpy(dest,source);
187 #endif
188 
189  //If the compiler is set to c++11 mode, NULL is not known any more.
190  //Therefore replace the NULL macro by the c++11 value 'nullptr'
191 #if __cplusplus >= 201103L
192 #ifdef NULL
193 #undef NULL
194 #endif
195 #define NULL nullptr
196 #endif
197 
198 #endif
Definition: typeDefs.h:99
Definition: typeDefs.h:110
Definition: typeDefs.h:114
Definition: typeDefs.h:91
Definition: typeDefs.h:60
Definition: typeDefs.h:96
Definition: typeDefs.h:98
Definition: typeDefs.h:97
Definition: typeDefs.h:111
tCompareResult
Definition: typeDefs.h:66
Definition: typeDefs.h:94
Definition: typeDefs.h:58
Definition: typeDefs.h:89
Definition: typeDefs.h:59
Definition: apiFunctionsGraph.cpp:39
Definition: typeDefs.h:112
Definition: typeDefs.h:93
tPCLPointType
Definition: typeDefs.h:106
Definition: typeDefs.h:95
Definition: typeDefs.h:108
tStreamMessageType
Definition: typeDefs.h:76
Definition: typeDefs.h:113
Definition: typeDefs.h:92
tRetValue
Definition: typeDefs.h:56
Definition: typeDefs.h:109
tDataType
Definition: typeDefs.h:87
Definition: typeDefs.h:90
Definition: typeDefs.h:144