Cinder

  • Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

include/OpenCV/cxerror.h

Go to the documentation of this file.
00001 /*M///////////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
00004 //
00005 //  By downloading, copying, installing or using the software you agree to this license.
00006 //  If you do not agree to this license, do not download, install,
00007 //  copy or use the software.
00008 //
00009 //
00010 //                        Intel License Agreement
00011 //                For Open Source Computer Vision Library
00012 //
00013 // Copyright (C) 2000, Intel Corporation, all rights reserved.
00014 // Third party copyrights are property of their respective owners.
00015 //
00016 // Redistribution and use in source and binary forms, with or without modification,
00017 // are permitted provided that the following conditions are met:
00018 //
00019 //   * Redistribution's of source code must retain the above copyright notice,
00020 //     this list of conditions and the following disclaimer.
00021 //
00022 //   * Redistribution's in binary form must reproduce the above copyright notice,
00023 //     this list of conditions and the following disclaimer in the documentation
00024 //     and/or other materials provided with the distribution.
00025 //
00026 //   * The name of Intel Corporation may not be used to endorse or promote products
00027 //     derived from this software without specific prior written permission.
00028 //
00029 // This software is provided by the copyright holders and contributors "as is" and
00030 // any express or implied warranties, including, but not limited to, the implied
00031 // warranties of merchantability and fitness for a particular purpose are disclaimed.
00032 // In no event shall the Intel Corporation or contributors be liable for any direct,
00033 // indirect, incidental, special, exemplary, or consequential damages
00034 // (including, but not limited to, procurement of substitute goods or services;
00035 // loss of use, data, or profits; or business interruption) however caused
00036 // and on any theory of liability, whether in contract, strict liability,
00037 // or tort (including negligence or otherwise) arising in any way out of
00038 // the use of this software, even if advised of the possibility of such damage.
00039 //
00040 //M*/
00041 
00042 #ifndef __OPENCV_ERROR_H__
00043 #define __OPENCV_ERROR_H__
00044 
00045 /************Below is declaration of error handling stuff in PLSuite manner**/
00046 
00047 typedef int CVStatus;
00048 
00049 /* this part of CVStatus is compatible with IPLStatus 
00050   Some of below symbols are not [yet] used in OpenCV
00051 */
00052 #define CV_StsOk                    0  /* everithing is ok                */
00053 #define CV_StsBackTrace            -1  /* pseudo error for back trace     */
00054 #define CV_StsError                -2  /* unknown /unspecified error      */
00055 #define CV_StsInternal             -3  /* internal error (bad state)      */
00056 #define CV_StsNoMem                -4  /* insufficient memory             */
00057 #define CV_StsBadArg               -5  /* function arg/param is bad       */
00058 #define CV_StsBadFunc              -6  /* unsupported function            */
00059 #define CV_StsNoConv               -7  /* iter. didn't converge           */
00060 #define CV_StsAutoTrace            -8  /* tracing                         */
00061 
00062 #define CV_HeaderIsNull            -9  /* image header is NULL            */
00063 #define CV_BadImageSize            -10 /* image size is invalid           */
00064 #define CV_BadOffset               -11 /* offset is invalid               */
00065 #define CV_BadDataPtr              -12 
00066 #define CV_BadStep                 -13 
00067 #define CV_BadModelOrChSeq         -14 
00068 #define CV_BadNumChannels          -15 
00069 #define CV_BadNumChannel1U         -16 
00070 #define CV_BadDepth                -17 
00071 #define CV_BadAlphaChannel         -18 
00072 #define CV_BadOrder                -19 
00073 #define CV_BadOrigin               -20 
00074 #define CV_BadAlign                -21 
00075 #define CV_BadCallBack             -22 
00076 #define CV_BadTileSize             -23 
00077 #define CV_BadCOI                  -24 
00078 #define CV_BadROISize              -25 
00079 
00080 #define CV_MaskIsTiled             -26 
00081 
00082 #define CV_StsNullPtr                -27 /* null pointer */
00083 #define CV_StsVecLengthErr           -28 /* incorrect vector length */
00084 #define CV_StsFilterStructContentErr -29 /* incorr. filter structure content */
00085 #define CV_StsKernelStructContentErr -30 /* incorr. transform kernel content */
00086 #define CV_StsFilterOffsetErr        -31 /* incorrect filter ofset value */
00087 
00088 /*extra for CV */
00089 #define CV_StsBadSize                -201 /* the input/output structure size is incorrect  */
00090 #define CV_StsDivByZero              -202 /* division by zero */
00091 #define CV_StsInplaceNotSupported    -203 /* in-place operation is not supported */
00092 #define CV_StsObjectNotFound         -204 /* request can't be completed */
00093 #define CV_StsUnmatchedFormats       -205 /* formats of input/output arrays differ */
00094 #define CV_StsBadFlag                -206 /* flag is wrong or not supported */  
00095 #define CV_StsBadPoint               -207 /* bad CvPoint */ 
00096 #define CV_StsBadMask                -208 /* bad format of mask (neither 8uC1 nor 8sC1)*/
00097 #define CV_StsUnmatchedSizes         -209 /* sizes of input/output structures do not match */
00098 #define CV_StsUnsupportedFormat      -210 /* the data format/type is not supported by the function*/
00099 #define CV_StsOutOfRange             -211 /* some of parameters are out of range */
00100 #define CV_StsParseError             -212 /* invalid syntax/structure of the parsed file */
00101 #define CV_StsNotImplemented         -213 /* the requested function/feature is not implemented */
00102 #define CV_StsBadMemBlock            -214 /* an allocated block has been corrupted */
00103 #define CV_StsAssert                 -215 /* assertion failed */
00104 
00105 /********************************* Error handling Macros ********************************/
00106 
00107 #define OPENCV_ERROR(status,func,context)                           \
00108                 cvError((status),(func),(context),__FILE__,__LINE__)
00109 
00110 #define OPENCV_ERRCHK(func,context)                                 \
00111                 {if (cvGetErrStatus() >= 0)                         \
00112                  {OPENCV_ERROR(CV_StsBackTrace,(func),(context));}}
00113 
00114 #define OPENCV_ASSERT(expr,func,context)                            \
00115                 {if (! (expr))                                      \
00116                  {OPENCV_ERROR(CV_StsInternal,(func),(context));}}
00117 
00118 #define OPENCV_RSTERR() (cvSetErrStatus(CV_StsOk))
00119 
00120 #define OPENCV_CALL( Func )                                         \
00121 {                                                                   \
00122     Func;                                                           \
00123 } 
00124 
00125 
00126 /**************************** OpenCV-style error handling *******************************/
00127 
00128 /* CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */
00129 #ifdef CV_NO_FUNC_NAMES
00130     #define CV_FUNCNAME( Name )
00131     #define cvFuncName ""
00132 #else    
00133     #define CV_FUNCNAME( Name )  \
00134     static char cvFuncName[] = Name
00135 #endif
00136 
00137 
00138 /*
00139   CV_ERROR macro unconditionally raises error with passed code and message.
00140   After raising error, control will be transferred to the exit label.
00141 */
00142 #define CV_ERROR( Code, Msg )                                       \
00143 {                                                                   \
00144      cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ );        \
00145      __CV_EXIT__;                                                   \
00146 }
00147 
00148 /* Simplified form of CV_ERROR */
00149 #define CV_ERROR_FROM_CODE( code )   \
00150     CV_ERROR( code, "" )
00151 
00152 /*
00153  CV_CHECK macro checks error status after CV (or IPL)
00154  function call. If error detected, control will be transferred to the exit
00155  label.
00156 */
00157 #define CV_CHECK()                                                  \
00158 {                                                                   \
00159     if( cvGetErrStatus() < 0 )                                      \
00160         CV_ERROR( CV_StsBackTrace, "Inner function failed." );      \
00161 }
00162 
00163 
00164 /*
00165  CV_CALL macro calls CV (or IPL) function, checks error status and
00166  signals a error if the function failed. Useful in "parent node"
00167  error procesing mode
00168 */
00169 #define CV_CALL( Func )                                             \
00170 {                                                                   \
00171     Func;                                                           \
00172     CV_CHECK();                                                     \
00173 }
00174 
00175 
00176 /* Runtime assertion macro */
00177 #define CV_ASSERT( Condition )                                          \
00178 {                                                                       \
00179     if( !(Condition) )                                                  \
00180         CV_ERROR( CV_StsInternal, "Assertion: " #Condition " failed" ); \
00181 }
00182 
00183 #define __CV_BEGIN__       {
00184 #define __CV_END__         goto exit; exit: ; }
00185 #define __CV_EXIT__        goto exit
00186 
00187 #endif /* _CXCORE_ERROR_H_ */
00188 
00189 /* End of file. */