type_traits_detail.hpp
Go to the documentation of this file.
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
8 //
9 //
10 // License Agreement
11 // For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
16 //
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
19 //
20 // * Redistribution's of source code must retain the above copyright notice,
21 // this list of conditions and the following disclaimer.
22 //
23 // * Redistribution's in binary form must reproduce the above copyright notice,
24 // this list of conditions and the following disclaimer in the documentation
25 // and/or other materials provided with the distribution.
26 //
27 // * The name of the copyright holders may not be used to endorse or promote products
28 // derived from this software without specific prior written permission.
29 //
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
40 //
41 //M*/
42 
43 #ifndef __OPENCV_GPU_TYPE_TRAITS_DETAIL_HPP__
44 #define __OPENCV_GPU_TYPE_TRAITS_DETAIL_HPP__
45 
46 #include "../common.hpp"
47 #include "../vec_traits.hpp"
48 
49 namespace cv { namespace gpu { namespace device
50 {
51  namespace type_traits_detail
52  {
53  template <bool, typename T1, typename T2> struct Select { typedef T1 type; };
54  template <typename T1, typename T2> struct Select<false, T1, T2> { typedef T2 type; };
55 
56  template <typename T> struct IsSignedIntergral { enum {value = 0}; };
57  template <> struct IsSignedIntergral<schar> { enum {value = 1}; };
58  template <> struct IsSignedIntergral<char1> { enum {value = 1}; };
59  template <> struct IsSignedIntergral<short> { enum {value = 1}; };
60  template <> struct IsSignedIntergral<short1> { enum {value = 1}; };
61  template <> struct IsSignedIntergral<int> { enum {value = 1}; };
62  template <> struct IsSignedIntergral<int1> { enum {value = 1}; };
63 
64  template <typename T> struct IsUnsignedIntegral { enum {value = 0}; };
65  template <> struct IsUnsignedIntegral<uchar> { enum {value = 1}; };
66  template <> struct IsUnsignedIntegral<uchar1> { enum {value = 1}; };
67  template <> struct IsUnsignedIntegral<ushort> { enum {value = 1}; };
68  template <> struct IsUnsignedIntegral<ushort1> { enum {value = 1}; };
69  template <> struct IsUnsignedIntegral<uint> { enum {value = 1}; };
70  template <> struct IsUnsignedIntegral<uint1> { enum {value = 1}; };
71 
72  template <typename T> struct IsIntegral { enum {value = IsSignedIntergral<T>::value || IsUnsignedIntegral<T>::value}; };
73  template <> struct IsIntegral<char> { enum {value = 1}; };
74  template <> struct IsIntegral<bool> { enum {value = 1}; };
75 
76  template <typename T> struct IsFloat { enum {value = 0}; };
77  template <> struct IsFloat<float> { enum {value = 1}; };
78  template <> struct IsFloat<double> { enum {value = 1}; };
79 
80  template <typename T> struct IsVec { enum {value = 0}; };
81  template <> struct IsVec<uchar1> { enum {value = 1}; };
82  template <> struct IsVec<uchar2> { enum {value = 1}; };
83  template <> struct IsVec<uchar3> { enum {value = 1}; };
84  template <> struct IsVec<uchar4> { enum {value = 1}; };
85  template <> struct IsVec<uchar8> { enum {value = 1}; };
86  template <> struct IsVec<char1> { enum {value = 1}; };
87  template <> struct IsVec<char2> { enum {value = 1}; };
88  template <> struct IsVec<char3> { enum {value = 1}; };
89  template <> struct IsVec<char4> { enum {value = 1}; };
90  template <> struct IsVec<char8> { enum {value = 1}; };
91  template <> struct IsVec<ushort1> { enum {value = 1}; };
92  template <> struct IsVec<ushort2> { enum {value = 1}; };
93  template <> struct IsVec<ushort3> { enum {value = 1}; };
94  template <> struct IsVec<ushort4> { enum {value = 1}; };
95  template <> struct IsVec<ushort8> { enum {value = 1}; };
96  template <> struct IsVec<short1> { enum {value = 1}; };
97  template <> struct IsVec<short2> { enum {value = 1}; };
98  template <> struct IsVec<short3> { enum {value = 1}; };
99  template <> struct IsVec<short4> { enum {value = 1}; };
100  template <> struct IsVec<short8> { enum {value = 1}; };
101  template <> struct IsVec<uint1> { enum {value = 1}; };
102  template <> struct IsVec<uint2> { enum {value = 1}; };
103  template <> struct IsVec<uint3> { enum {value = 1}; };
104  template <> struct IsVec<uint4> { enum {value = 1}; };
105  template <> struct IsVec<uint8> { enum {value = 1}; };
106  template <> struct IsVec<int1> { enum {value = 1}; };
107  template <> struct IsVec<int2> { enum {value = 1}; };
108  template <> struct IsVec<int3> { enum {value = 1}; };
109  template <> struct IsVec<int4> { enum {value = 1}; };
110  template <> struct IsVec<int8> { enum {value = 1}; };
111  template <> struct IsVec<float1> { enum {value = 1}; };
112  template <> struct IsVec<float2> { enum {value = 1}; };
113  template <> struct IsVec<float3> { enum {value = 1}; };
114  template <> struct IsVec<float4> { enum {value = 1}; };
115  template <> struct IsVec<float8> { enum {value = 1}; };
116  template <> struct IsVec<double1> { enum {value = 1}; };
117  template <> struct IsVec<double2> { enum {value = 1}; };
118  template <> struct IsVec<double3> { enum {value = 1}; };
119  template <> struct IsVec<double4> { enum {value = 1}; };
120  template <> struct IsVec<double8> { enum {value = 1}; };
121 
122  template <class U> struct AddParameterType { typedef const U& type; };
123  template <class U> struct AddParameterType<U&> { typedef U& type; };
124  template <> struct AddParameterType<void> { typedef void type; };
125 
126  template <class U> struct ReferenceTraits
127  {
128  enum { value = false };
129  typedef U type;
130  };
131  template <class U> struct ReferenceTraits<U&>
132  {
133  enum { value = true };
134  typedef U type;
135  };
136 
137  template <class U> struct PointerTraits
138  {
139  enum { value = false };
140  typedef void type;
141  };
142  template <class U> struct PointerTraits<U*>
143  {
144  enum { value = true };
145  typedef U type;
146  };
147  template <class U> struct PointerTraits<U*&>
148  {
149  enum { value = true };
150  typedef U type;
151  };
152 
153  template <class U> struct UnConst
154  {
155  typedef U type;
156  enum { value = 0 };
157  };
158  template <class U> struct UnConst<const U>
159  {
160  typedef U type;
161  enum { value = 1 };
162  };
163  template <class U> struct UnConst<const U&>
164  {
165  typedef U& type;
166  enum { value = 1 };
167  };
168 
169  template <class U> struct UnVolatile
170  {
171  typedef U type;
172  enum { value = 0 };
173  };
174  template <class U> struct UnVolatile<volatile U>
175  {
176  typedef U type;
177  enum { value = 1 };
178  };
179  template <class U> struct UnVolatile<volatile U&>
180  {
181  typedef U& type;
182  enum { value = 1 };
183  };
184  } // namespace type_traits_detail
185 }}} // namespace cv { namespace gpu { namespace device
186 
187 #endif // __OPENCV_GPU_TYPE_TRAITS_DETAIL_HPP__
Definition: type_traits_detail.hpp:153
short float uchar uchar uchar uchar uchar ushort int uchar ushort int float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float int int int float int int int float int CV_CUDEV_IMPLEMENT_VEC_BINARY_OP char CV_CUDEV_IMPLEMENT_VEC_BINARY_OP ushort CV_CUDEV_IMPLEMENT_VEC_BINARY_OP short CV_CUDEV_IMPLEMENT_VEC_BINARY_OP int CV_CUDEV_IMPLEMENT_VEC_BINARY_OP uint CV_CUDEV_IMPLEMENT_VEC_BINARY_OP float CV_CUDEV_IMPLEMENT_VEC_BINARY_OP double char
Definition: vec_math.hpp:426
Definition: type_traits_detail.hpp:53
U & type
Definition: type_traits_detail.hpp:123
const CvArr * U
Definition: core_c.h:733
U type
Definition: type_traits_detail.hpp:171
Definition: type_traits_detail.hpp:76
Definition: type_traits_detail.hpp:122
Definition: type_traits_detail.hpp:56
void type
Definition: type_traits_detail.hpp:140
U type
Definition: type_traits_detail.hpp:145
typedef void(CV_CDECL *CvMouseCallback)(int event
signed char schar
Definition: common.hpp:102
unsigned char uchar
Definition: common.hpp:100
U & type
Definition: type_traits_detail.hpp:181
U type
Definition: type_traits_detail.hpp:134
U type
Definition: type_traits_detail.hpp:150
unsigned int uint
Definition: common.hpp:104
Definition: type_traits_detail.hpp:72
unsigned short ushort
Definition: common.hpp:101
GLsizei const GLfloat * value
Definition: core_c.h:341
T1 type
Definition: type_traits_detail.hpp:53
U type
Definition: type_traits_detail.hpp:160
void type
Definition: type_traits_detail.hpp:124
Definition: type_traits_detail.hpp:169
U & type
Definition: type_traits_detail.hpp:165
const U & type
Definition: type_traits_detail.hpp:122
::max::max::max float
Definition: functional.hpp:326
false
Definition: color.hpp:230
::max::max int
Definition: functional.hpp:324
Definition: type_traits_detail.hpp:126
short
Definition: vec_math.hpp:153
Definition: type_traits_detail.hpp:137
Definition: type_traits_detail.hpp:64
U type
Definition: type_traits_detail.hpp:129
U type
Definition: type_traits_detail.hpp:155
Definition: type_traits_detail.hpp:80
Definition: vec_traits.hpp:115
short float uchar uchar uchar uchar uchar ushort int uchar ushort int float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float float int int int float int int int float int CV_CUDEV_IMPLEMENT_VEC_BINARY_OP char CV_CUDEV_IMPLEMENT_VEC_BINARY_OP ushort CV_CUDEV_IMPLEMENT_VEC_BINARY_OP short CV_CUDEV_IMPLEMENT_VEC_BINARY_OP int CV_CUDEV_IMPLEMENT_VEC_BINARY_OP uint CV_CUDEV_IMPLEMENT_VEC_BINARY_OP float CV_CUDEV_IMPLEMENT_VEC_BINARY_OP double int int uint double
Definition: vec_math.hpp:432
T2 type
Definition: type_traits_detail.hpp:54