GestureRecognitionToolkit  Version: 1.0 Revision: 04-03-15
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
GRTTypedefs.h
1 /*
2 GRT MIT License
3 Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT>
4 
5 Permission is hereby granted, free of charge, to any person obtaining a copy of this software
6 and associated documentation files (the "Software"), to deal in the Software without restriction,
7 including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
9 subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in all copies or substantial
12 portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 */
20 
21 #ifndef GRT_TYPEDEFS_HEADER
22 #define GRT_TYPEDEFS_HEADER
23 
24 #include "GRTVersionInfo.h"
25 #include <vector>
26 
27 namespace GRT {
28 
29 //Declare any common definitions that are not OS specific
30 #ifndef PI
31  #define PI 3.14159265358979323846264338327950288
32 #endif
33 
34 #ifndef TWO_PI
35  #define TWO_PI 6.28318530718
36 #endif
37 
38 #ifndef SQRT_TWO_PI
39  #define SQRT_TWO_PI 2.506628274631
40 #endif
41 
42 template<class T> inline T SQR(const T &a) {return a*a;}
43 template<class T> inline void SWAP(T &a,T &b) { T temp(a); a = b; b = temp; }
44 
45 inline double SIGN(const double &a, const double &b) {return (b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a));}
46 
47 inline double antilog(const double &x){ return exp( x ); }
48 
49 #ifndef MIN
50  #define MIN(a,b) (((a)<(b))?(a):(b))
51 #endif
52 #ifndef MAX
53  #define MAX(a,b) (((a)>(b))?(a):(b))
54 #endif
55 
56 #define GRT_DEFAULT_NULL_CLASS_LABEL 0
57 #define GRT_SAFE_CHECKING true
58 
59 
60 #ifdef __GRT_WINDOWS_BUILD__
61 #define grt_isnan(x) (x != x)
62 #define grt_isinf(x) (!grt_isnan(x) && grt_isnan(x - x))
63 
64 //NAN is not defined on Visual Studio version of math.h so define it here
65 #ifndef NAN
66  static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
67  #define NAN (*(const float *) __nan)
68 #endif
69 
70 #ifndef INFINITY
71  #define INFINITY (DBL_MAX+DBL_MAX)
72 #endif
73 
74 //Remove the min and max macros as they cause lots of issues
75 #ifndef NOMINMAX
76 #define NOMINMAX
77 #endif
78 
79 #endif
80 
81 #ifdef __GRT_OSX_BUILD__
82 #define grt_isnan(x) (x != x)
83 #define grt_isinf(x) (!grt_isnan(x) && grt_isnan(x - x))
84 
85 typedef unsigned int UINT;
86 typedef signed int SINT;
87 typedef unsigned long ULONG;
88 #endif
89 
90 #ifdef __GRT_LINUX_BUILD__
91 #define grt_isnan(x) (x != x)
92 #define grt_isinf(x) (!grt_isnan(x) && grt_isnan(x - x))
93 
94 typedef unsigned int UINT;
95 typedef signed int SINT;
96 typedef unsigned long ULONG;
97 #endif
98 
99 //Define any common GRT OS independent typedefs
100 typedef std::vector<double> VectorDouble;
101 
102 //Declare typedefs for the legacy data types
103 class ClassificationData;
104 class RegressionData;
105 class TimeSeriesClassificationData;
106 class UnlabelledData;
107 typedef ClassificationData LabelledClassificationData;
108 typedef RegressionData LabelledRegressionData;
109 typedef TimeSeriesClassificationData LabelledTimeSeriesClassificationData;
110 typedef UnlabelledData UnlabelledClassificationData;
111 }
112 
113 #endif //GRT_TYPEDEFS_HEADER
Definition: AdaBoost.cpp:25