37#ifndef MATLAB_FLEXTYPE
38#define MATLAB_FLEXTYPE
42#define NOFLEXIBLETYPE vigraMain(outputs, inputs);
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()))\
49 inClass = mxGetClassID(inputs[pos]);\
53 if(!inputs.options_.isValid())\
54 mexErrMsgTxt("Input at (Position: pos, Name in Struct: name) not set");\
55 inClass = mxGetClassID(inputs.options_[#name]);\
60 std::string msg = "Invalid Inputtype for data element '" + name_str + "' - see documentation for supported Types";\
61 mexErrMsgTxt(msg.c_str());\
64#define FLEXIBLE_TYPE_START(pos, name)\
66 std::string name_str(#name);\
67 if ((1##pos##1) != 0 && ((pos < inputs.size()-1) || pos == (inputs.size()-1) && !inputs.options_.isValid()))\
69 inClass = mxGetClassID(inputs[pos]);\
73 if(!inputs.options_.isValid())\
74 mexErrMsgTxt("Input at (Position: pos, Name in Struct: name) not set");\
75 inClass = mxGetClassID(inputs.options_[#name]);\
81#define FLEXIBLE_TYPE_END\
83 std::string msg = "Invalid Inputtype for data element " + name_str + " - see documentation for supported Types";\
84 mexErrMsgTxt(msg.c_str());\
92 vigraMain<UInt8>(outputs, inputs); break;\
94 vigraMain<UInt16>(outputs, inputs); break;\
96 vigraMain<UInt32>(outputs, inputs); break;\
98 vigraMain<UInt64>(outputs, inputs); break;
103 vigraMain<UInt8>(outputs, inputs); break;
105#define ALLOW_UINT_16\
106 case mxUINT16_CLASS:\
107 vigraMain<UInt16>(outputs, inputs); break;
109#define ALLOW_UINT_32\
110 case mxUINT32_CLASS:\
111 vigraMain<UInt32>(outputs, inputs); break;
113#define ALLOW_UINT_64\
114 case mxUINT64_CLASS:\
115 vigraMain<UInt64>(outputs, inputs); break;
117#define ALLOW_UINT_8_16\
119 vigraMain<UInt8>(outputs, inputs); break;\
120 case mxUINT16_CLASS:\
121 vigraMain<UInt16>(outputs, inputs); break;
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;
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;
135#define ALLOW_UINT_8_32\
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;
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;
155 vigraMain<Int8>(outputs, inputs); break;\
157 vigraMain<Int16>(outputs, inputs); break;\
159 vigraMain<Int32>(outputs, inputs); break;\
161 vigraMain<Int64>(outputs, inputs); break;
163#define ALLOW_INT_8_64 ALLOW_INT;
164#define ALLOW_UINT_8_64 ALLOW_UINT;
168 vigraMain<Int8>(outputs, inputs); break;
172 vigraMain<Int16>(outputs, inputs); break;
176 vigraMain<Int32>(outputs, inputs); break;
180 vigraMain<Int64>(outputs, inputs); break;
182#define ALLOW_INT_8_16\
184 vigraMain<Int8>(outputs, inputs); break;\
186 vigraMain<Int16>(outputs, inputs); break;
188#define ALLOW_INT_16_32\
190 vigraMain<Int16>(outputs, inputs); break;\
192 vigraMain<Int32>(outputs, inputs); break;
194#define ALLOW_INT_32_64\
196 vigraMain<Int32>(outputs, inputs); break;\
198 vigraMain<Int64>(outputs, inputs); break;
200#define ALLOW_INT_8_32\
202 vigraMain<Int8>(outputs, inputs); break;\
204 vigraMain<Int16>(outputs, inputs); break;\
206 vigraMain<Int32>(outputs, inputs); break;
208#define ALLOW_INT_16_64\
210 vigraMain<Int16>(outputs, inputs); break;\
212 vigraMain<Int32>(outputs, inputs); break;\
214 vigraMain<Int64>(outputs, inputs); break;
219 case mxDOUBLE_CLASS:\
220 vigraMain<double>(outputs, inputs); break;\
221 case mxSINGLE_CLASS:\
222 vigraMain<float>(outputs, inputs); break;
225 case mxSINGLE_CLASS:\
226 vigraMain<float>(outputs, inputs); break;
229 case mxDOUBLE_CLASS:\
230 vigraMain<double>(outputs, inputs); break;