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

vigra/matlab_FLEXTYPE.hxx |

    00001 /************************************************************************/
    00002 /*                                                                      */
    00003 /*                    Copyright 2009 by Rahul Nair                      */
    00004 /*                                                                      */
    00005 /*    This file is part of the VIGRA computer vision library.           */
    00006 /*    The VIGRA Website is                                              */
    00007 /*        http://hci.iwr.uni-heidelberg.de/vigra/                       */
    00008 /*    Please direct questions, bug reports, and contributions to        */
    00009 /*        ullrich.koethe@iwr.uni-heidelberg.de    or                    */
    00010 /*        vigra@informatik.uni-hamburg.de                               */
    00011 /*                                                                      */
    00012 /*    Permission is hereby granted, free of charge, to any person       */
    00013 /*    obtaining a copy of this software and associated documentation    */
    00014 /*    files (the "Software"), to deal in the Software without           */
    00015 /*    restriction, including without limitation the rights to use,      */
    00016 /*    copy, modify, merge, publish, distribute, sublicense, and/or      */
    00017 /*    sell copies of the Software, and to permit persons to whom the    */
    00018 /*    Software is furnished to do so, subject to the following          */
    00019 /*    conditions:                                                       */
    00020 /*                                                                      */
    00021 /*    The above copyright notice and this permission notice shall be    */
    00022 /*    included in all copies or substantial portions of the             */
    00023 /*    Software.                                                         */
    00024 /*                                                                      */
    00025 /*    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND    */
    00026 /*    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES   */
    00027 /*    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND          */
    00028 /*    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT       */
    00029 /*    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,      */
    00030 /*    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      */
    00031 /*    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR     */
    00032 /*    OTHER DEALINGS IN THE SOFTWARE.                                   */
    00033 /*                                                                      */
    00034 /************************************************************************/
    00035
    00036 #include <string>
    00037 #ifndef MATLAB_FLEXTYPE
    00038 #define MATLAB_FLEXTYPE
    00039
    00040
    00041
    00042 #define NOFLEXIBLETYPE vigraMain(outputs, inputs);
    00043
    00044
    00045 #define FLEX_TYPE(inClass, pos, name)\
    00046     std::string name_str(#name);\
    00047     if ((1##pos##1) != 0 && ((pos < inputs.size()-1) || pos == (inputs.size()-1) && !inputs.options_.isValid()))\
    00048     {\
    00049         inClass = mxGetClassID(inputs[pos]);\
    00050     }\
    00051     else\
    00052     {\
    00053         if(!inputs.options_.isValid())\
    00054             mexErrMsgTxt("Input at (Position: pos, Name in Struct: name) not set");\
    00055         inClass = mxGetClassID(inputs.options_[#name]);\
    00056     }\
    00057
    00058 #define DEFAULT_ERROR\
    00059     default:\
    00060     std::string msg = "Invalid Inputtype for data element '" + name_str + "' - see documentation for supported Types";\
    00061     mexErrMsgTxt(msg.c_str());\
    00062
    00063
    00064 #define FLEXIBLE_TYPE_START(pos, name)\
    00065     mxClassID inClass;\
    00066     std::string name_str(#name);\
    00067     if ((1##pos##1) != 0 && ((pos < inputs.size()-1) || pos == (inputs.size()-1) && !inputs.options_.isValid()))\
    00068     {\
    00069         inClass = mxGetClassID(inputs[pos]);\
    00070     }\
    00071     else\
    00072     {\
    00073         if(!inputs.options_.isValid())\
    00074             mexErrMsgTxt("Input at (Position: pos, Name in Struct: name) not set");\
    00075         inClass = mxGetClassID(inputs.options_[#name]);\
    00076     }\
    00077     switch(inClass){\
    00078
    00079
    00080
    00081 #define FLEXIBLE_TYPE_END\
    00082     default:\
    00083     std::string msg = "Invalid Inputtype for data element " + name_str + " - see documentation for supported Types";\
    00084     mexErrMsgTxt(msg.c_str());\
    00085     }
    00086
    00087
    00088 /*UINT*/
    00089
    00090 #define ALLOW_UINT\
    00091         case mxUINT8_CLASS:\
    00092             vigraMain<UInt8>(outputs, inputs);     break;\
    00093         case mxUINT16_CLASS:\
    00094             vigraMain<UInt16>(outputs, inputs);    break;\
    00095         case mxUINT32_CLASS:\
    00096             vigraMain<UInt32>(outputs, inputs);    break;\
    00097         case mxUINT64_CLASS:\
    00098             vigraMain<UInt64>(outputs, inputs);    break;
    00099
    00100
    00101 #define ALLOW_UINT_8\
    00102         case mxUINT8_CLASS:\
    00103             vigraMain<UInt8>(outputs, inputs);     break;
    00104
    00105 #define ALLOW_UINT_16\
    00106         case mxUINT16_CLASS:\
    00107             vigraMain<UInt16>(outputs, inputs);     break;
    00108
    00109 #define ALLOW_UINT_32\
    00110         case mxUINT32_CLASS:\
    00111             vigraMain<UInt32>(outputs, inputs);     break;
    00112
    00113 #define ALLOW_UINT_64\
    00114         case mxUINT64_CLASS:\
    00115             vigraMain<UInt64>(outputs, inputs);     break;
    00116
    00117 #define ALLOW_UINT_8_16\
    00118         case mxUINT8_CLASS:\
    00119             vigraMain<UInt8>(outputs, inputs);     break;\
    00120         case mxUINT16_CLASS:\
    00121             vigraMain<UInt16>(outputs, inputs);    break;
    00122
    00123 #define ALLOW_UINT_16_32\
    00124         case mxUINT16_CLASS:\
    00125             vigraMain<UInt16>(outputs, inputs);     break;\
    00126         case mxUINT32_CLASS:\
    00127             vigraMain<UInt32>(outputs, inputs);    break;
    00128
    00129 #define ALLOW_UINT_32_64\
    00130         case mxUINT16_CLASS:\
    00131             vigraMain<UInt32>(outputs, inputs);     break;\
    00132         case mxUINT32_CLASS:\
    00133             vigraMain<UInt64>(outputs, inputs);    break;
    00134
    00135 #define ALLOW_UINT_8_32\
    00136         case mxUINT8_CLASS:\
    00137             vigraMain<UInt8>(outputs, inputs);     break;\
    00138         case mxUINT16_CLASS:\
    00139             vigraMain<UInt16>(outputs, inputs);    break;\
    00140         case mxUINT32_CLASS:\
    00141             vigraMain<UInt32>(outputs, inputs);    break;
    00142
    00143 #define ALLOW_UINT_16_64\
    00144         case mxUINT16_CLASS:\
    00145             vigraMain<UInt16>(outputs, inputs);    break;\
    00146         case mxUINT32_CLASS:\
    00147             vigraMain<UInt32>(outputs, inputs);    break;\
    00148         case mxUINT64_CLASS:\
    00149             vigraMain<UInt64>(outputs, inputs);     break;
    00150
    00151
    00152 /*INT*/
    00153 #define ALLOW_INT\
    00154         case mxINT8_CLASS:\
    00155             vigraMain<Int8>(outputs, inputs);     break;\
    00156         case mxINT16_CLASS:\
    00157             vigraMain<Int16>(outputs, inputs);    break;\
    00158         case mxINT32_CLASS:\
    00159             vigraMain<Int32>(outputs, inputs);    break;\
    00160         case mxINT64_CLASS:\
    00161             vigraMain<Int64>(outputs, inputs);    break;
    00162
    00163 #define ALLOW_INT_8_64 ALLOW_INT;
    00164 #define ALLOW_UINT_8_64 ALLOW_UINT;
    00165
    00166 #define ALLOW_INT_8\
    00167         case mxINT8_CLASS:\
    00168             vigraMain<Int8>(outputs, inputs);     break;
    00169
    00170 #define ALLOW_INT_16\
    00171         case mxINT16_CLASS:\
    00172             vigraMain<Int16>(outputs, inputs);     break;
    00173
    00174 #define ALLOW_INT_32\
    00175         case mxINT32_CLASS:\
    00176             vigraMain<Int32>(outputs, inputs);     break;
    00177
    00178 #define ALLOW_INT_64\
    00179         case mxINT64_CLASS:\
    00180             vigraMain<Int64>(outputs, inputs);     break;
    00181
    00182 #define ALLOW_INT_8_16\
    00183         case mxINT8_CLASS:\
    00184             vigraMain<Int8>(outputs, inputs);     break;\
    00185         case mxINT16_CLASS:\
    00186             vigraMain<Int16>(outputs, inputs);    break;
    00187
    00188 #define ALLOW_INT_16_32\
    00189         case mxINT16_CLASS:\
    00190             vigraMain<Int16>(outputs, inputs);     break;\
    00191         case mxINT32_CLASS:\
    00192             vigraMain<Int32>(outputs, inputs);    break;
    00193
    00194 #define ALLOW_INT_32_64\
    00195         case mxINT16_CLASS:\
    00196             vigraMain<Int32>(outputs, inputs);     break;\
    00197         case mxINT32_CLASS:\
    00198             vigraMain<Int64>(outputs, inputs);    break;
    00199
    00200 #define ALLOW_INT_8_32\
    00201         case mxINT8_CLASS:\
    00202             vigraMain<Int8>(outputs, inputs);     break;\
    00203         case mxINT16_CLASS:\
    00204             vigraMain<Int16>(outputs, inputs);    break;\
    00205         case mxINT32_CLASS:\
    00206             vigraMain<Int32>(outputs, inputs);    break;
    00207
    00208 #define ALLOW_INT_16_64\
    00209         case mxINT16_CLASS:\
    00210             vigraMain<Int16>(outputs, inputs);    break;\
    00211         case mxINT32_CLASS:\
    00212             vigraMain<Int32>(outputs, inputs);    break;\
    00213         case mxINT64_CLASS:\
    00214             vigraMain<Int64>(outputs, inputs);     break;
    00215
    00216 /*Float double*/
    00217
    00218 #define ALLOW_FD\
    00219         case mxDOUBLE_CLASS:\
    00220             vigraMain<double>(outputs, inputs);    break;\
    00221         case mxSINGLE_CLASS:\
    00222             vigraMain<float>(outputs, inputs);     break;
    00223
    00224 #define ALLOW_F\
    00225         case mxSINGLE_CLASS:\
    00226             vigraMain<float>(outputs, inputs);     break;
    00227
    00228 #define ALLOW_D\
    00229         case mxDOUBLE_CLASS:\
    00230             vigraMain<double>(outputs, inputs);    break;
    00231
    00232 #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.7.1 (3 Dec 2010)