[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

matlab_FLEXTYPE.hxx |

1 /************************************************************************/
2 /* */
3 /* Copyright 2009 by Rahul Nair */
4 /* */
5 /* This file is part of the VIGRA computer vision library. */
6 /* The VIGRA Website is */
7 /* http://hci.iwr.uni-heidelberg.de/vigra/ */
8 /* Please direct questions, bug reports, and contributions to */
9 /* ullrich.koethe@iwr.uni-heidelberg.de or */
10 /* vigra@informatik.uni-hamburg.de */
11 /* */
12 /* Permission is hereby granted, free of charge, to any person */
13 /* obtaining a copy of this software and associated documentation */
14 /* files (the "Software"), to deal in the Software without */
15 /* restriction, including without limitation the rights to use, */
16 /* copy, modify, merge, publish, distribute, sublicense, and/or */
17 /* sell copies of the Software, and to permit persons to whom the */
18 /* Software is furnished to do so, subject to the following */
19 /* conditions: */
20 /* */
21 /* The above copyright notice and this permission notice shall be */
22 /* included in all copies or substantial portions of the */
23 /* Software. */
24 /* */
25 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
26 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
27 /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
28 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
29 /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
30 /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
31 /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
32 /* OTHER DEALINGS IN THE SOFTWARE. */
33 /* */
34 /************************************************************************/
35
36 #include <string>
37 #ifndef MATLAB_FLEXTYPE
38 #define MATLAB_FLEXTYPE
39
40
41
42 #define NOFLEXIBLETYPE vigraMain(outputs, inputs);
43
44
45 #define FLEX_TYPE(inClass, pos, name)\
46 std::string name_str(#name);\
47 if ((1##pos##1) != 0 && ((pos < inputs.size()-1) || pos == (inputs.size()-1) && !inputs.options_.isValid()))\
48 {\
49 inClass = mxGetClassID(inputs[pos]);\
50 }\
51 else\
52 {\
53 if(!inputs.options_.isValid())\
54 mexErrMsgTxt("Input at (Position: pos, Name in Struct: name) not set");\
55 inClass = mxGetClassID(inputs.options_[#name]);\
56 }\
57
58 #define DEFAULT_ERROR\
59 default:\
60 std::string msg = "Invalid Inputtype for data element '" + name_str + "' - see documentation for supported Types";\
61 mexErrMsgTxt(msg.c_str());\
62
63
64 #define FLEXIBLE_TYPE_START(pos, name)\
65 mxClassID inClass;\
66 std::string name_str(#name);\
67 if ((1##pos##1) != 0 && ((pos < inputs.size()-1) || pos == (inputs.size()-1) && !inputs.options_.isValid()))\
68 {\
69 inClass = mxGetClassID(inputs[pos]);\
70 }\
71 else\
72 {\
73 if(!inputs.options_.isValid())\
74 mexErrMsgTxt("Input at (Position: pos, Name in Struct: name) not set");\
75 inClass = mxGetClassID(inputs.options_[#name]);\
76 }\
77 switch(inClass){\
78
79
80
81 #define FLEXIBLE_TYPE_END\
82 default:\
83 std::string msg = "Invalid Inputtype for data element " + name_str + " - see documentation for supported Types";\
84 mexErrMsgTxt(msg.c_str());\
85 }
86
87
88 /*UINT*/
89
90 #define ALLOW_UINT\
91 case mxUINT8_CLASS:\
92 vigraMain<UInt8>(outputs, inputs); break;\
93 case mxUINT16_CLASS:\
94 vigraMain<UInt16>(outputs, inputs); break;\
95 case mxUINT32_CLASS:\
96 vigraMain<UInt32>(outputs, inputs); break;\
97 case mxUINT64_CLASS:\
98 vigraMain<UInt64>(outputs, inputs); break;
99
100
101 #define ALLOW_UINT_8\
102 case mxUINT8_CLASS:\
103 vigraMain<UInt8>(outputs, inputs); break;
104
105 #define ALLOW_UINT_16\
106 case mxUINT16_CLASS:\
107 vigraMain<UInt16>(outputs, inputs); break;
108
109 #define ALLOW_UINT_32\
110 case mxUINT32_CLASS:\
111 vigraMain<UInt32>(outputs, inputs); break;
112
113 #define ALLOW_UINT_64\
114 case mxUINT64_CLASS:\
115 vigraMain<UInt64>(outputs, inputs); break;
116
117 #define ALLOW_UINT_8_16\
118 case mxUINT8_CLASS:\
119 vigraMain<UInt8>(outputs, inputs); break;\
120 case mxUINT16_CLASS:\
121 vigraMain<UInt16>(outputs, inputs); break;
122
123 #define ALLOW_UINT_16_32\
124 case mxUINT16_CLASS:\
125 vigraMain<UInt16>(outputs, inputs); break;\
126 case mxUINT32_CLASS:\
127 vigraMain<UInt32>(outputs, inputs); break;
128
129 #define ALLOW_UINT_32_64\
130 case mxUINT16_CLASS:\
131 vigraMain<UInt32>(outputs, inputs); break;\
132 case mxUINT32_CLASS:\
133 vigraMain<UInt64>(outputs, inputs); break;
134
135 #define ALLOW_UINT_8_32\
136 case mxUINT8_CLASS:\
137 vigraMain<UInt8>(outputs, inputs); break;\
138 case mxUINT16_CLASS:\
139 vigraMain<UInt16>(outputs, inputs); break;\
140 case mxUINT32_CLASS:\
141 vigraMain<UInt32>(outputs, inputs); break;
142
143 #define ALLOW_UINT_16_64\
144 case mxUINT16_CLASS:\
145 vigraMain<UInt16>(outputs, inputs); break;\
146 case mxUINT32_CLASS:\
147 vigraMain<UInt32>(outputs, inputs); break;\
148 case mxUINT64_CLASS:\
149 vigraMain<UInt64>(outputs, inputs); break;
150
151
152 /*INT*/
153 #define ALLOW_INT\
154 case mxINT8_CLASS:\
155 vigraMain<Int8>(outputs, inputs); break;\
156 case mxINT16_CLASS:\
157 vigraMain<Int16>(outputs, inputs); break;\
158 case mxINT32_CLASS:\
159 vigraMain<Int32>(outputs, inputs); break;\
160 case mxINT64_CLASS:\
161 vigraMain<Int64>(outputs, inputs); break;
162
163 #define ALLOW_INT_8_64 ALLOW_INT;
164 #define ALLOW_UINT_8_64 ALLOW_UINT;
165
166 #define ALLOW_INT_8\
167 case mxINT8_CLASS:\
168 vigraMain<Int8>(outputs, inputs); break;
169
170 #define ALLOW_INT_16\
171 case mxINT16_CLASS:\
172 vigraMain<Int16>(outputs, inputs); break;
173
174 #define ALLOW_INT_32\
175 case mxINT32_CLASS:\
176 vigraMain<Int32>(outputs, inputs); break;
177
178 #define ALLOW_INT_64\
179 case mxINT64_CLASS:\
180 vigraMain<Int64>(outputs, inputs); break;
181
182 #define ALLOW_INT_8_16\
183 case mxINT8_CLASS:\
184 vigraMain<Int8>(outputs, inputs); break;\
185 case mxINT16_CLASS:\
186 vigraMain<Int16>(outputs, inputs); break;
187
188 #define ALLOW_INT_16_32\
189 case mxINT16_CLASS:\
190 vigraMain<Int16>(outputs, inputs); break;\
191 case mxINT32_CLASS:\
192 vigraMain<Int32>(outputs, inputs); break;
193
194 #define ALLOW_INT_32_64\
195 case mxINT16_CLASS:\
196 vigraMain<Int32>(outputs, inputs); break;\
197 case mxINT32_CLASS:\
198 vigraMain<Int64>(outputs, inputs); break;
199
200 #define ALLOW_INT_8_32\
201 case mxINT8_CLASS:\
202 vigraMain<Int8>(outputs, inputs); break;\
203 case mxINT16_CLASS:\
204 vigraMain<Int16>(outputs, inputs); break;\
205 case mxINT32_CLASS:\
206 vigraMain<Int32>(outputs, inputs); break;
207
208 #define ALLOW_INT_16_64\
209 case mxINT16_CLASS:\
210 vigraMain<Int16>(outputs, inputs); break;\
211 case mxINT32_CLASS:\
212 vigraMain<Int32>(outputs, inputs); break;\
213 case mxINT64_CLASS:\
214 vigraMain<Int64>(outputs, inputs); break;
215
216 /*Float double*/
217
218 #define ALLOW_FD\
219 case mxDOUBLE_CLASS:\
220 vigraMain<double>(outputs, inputs); break;\
221 case mxSINGLE_CLASS:\
222 vigraMain<float>(outputs, inputs); break;
223
224 #define ALLOW_F\
225 case mxSINGLE_CLASS:\
226 vigraMain<float>(outputs, inputs); break;
227
228 #define ALLOW_D\
229 case mxDOUBLE_CLASS:\
230 vigraMain<double>(outputs, inputs); break;
231
232 #endif

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.11.0 (Fri May 19 2017)